Date Range Selector user control


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi All,

I am very exited with recent announcement of the StrataFrame Team for the 2012 Roadmap so with that in mind  I would like to share with the community my first ever workable BigGrin user control, it is a VB.

This DateRangeSelector user controls allows you to select a pre-defined date periods like Today, This Week-To-Date, This Year, Last Year and many more as well as a Custom Date that will allow the end user to select Start and End dates.

Useful features:
  • Selected date will used StrataFrame functionality to store that selection in the Registry if the Form's RegistryRepositoryKey is filled.
  • Public properties to pre-select a date range or each Start and End date values.  Look at the "+Progytech: Actions" group in the property sheet.
  • A SelectedValueChanged event is triggered whenever the date range period has changed.  Use this event to fill your BOs or requery your listviews.
  • The StrataFrame custom error provider is used to validate that the date range is good before passing the values to any method.
  • Internally we are expecting the based class used as MicroFour.StrataFrame.UI.Windows.Forms.StandardForm but feel free to use your own base class.
For learning purpose, I tried to keep this sample project as simple as possible, but in the bizOrders.vb business object I am using a Custom Field Property to show the Customer Name and this field is filled from the FillByDateRange() method in this BO which uses a SQL Query with a JOIN condition to grab the Customer Name as cfp_CustomerName and take advantage of StrataFrame Custom Field Properties functinality.

I hope this sample can be useful to the community and please, feel free to exchange your comments, suggestions and any enhancements to make this User Control better.

Enjoy!!!

http://forum.strataframe.net/Uploads/Images/40f839b9-310e-421f-b191-4ec1.png

Edhy Rijo

Attachments
DateRangeSelector.zip (238 views, 141.00 KB)
Edited 13 Years Ago by Edhy Rijo
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Well done Edhy! Wink

Here is the Enum I populate mine with, there are some you might want to implement:

''' <summary>
''' Pre-defined Dates Interval
''' </summary>
''' <remarks></remarks>
Public Enum PreDefinedPeriods As Integer
    <EnumDisplayValue("PFNTEnum - DefinedBelow", True)> _
    DefinedBelow = 1
    <EnumDisplayValue("PFNTEnum - Today", True)> _
    Today = 2
    <EnumDisplayValue("PFNTEnum - LifeToDate", True)> _
    LifeToDate = 3
    <EnumDisplayValue("PFNTEnum - LifeToFuture", True)> _
    LifeToFuture = 4
    <EnumDisplayValue("PFNTEnum - TodayToFuture", True)> _
    TodayToFuture = 5
    <EnumDisplayValue("PFNTEnum - CurrentWeek", True)> _
    CurrentWeek = 6
    <EnumDisplayValue("PFNTEnum - CurrentMonth", True)> _
    CurrentMonth = 7
    <EnumDisplayValue("PFNTEnum - CurrentQuarter", True)> _
    CurrentQuarter = 8
    <EnumDisplayValue("PFNTEnum - CurrentYear", True)> _
    CurrentYear = 9
    <EnumDisplayValue("PFNTEnum - MonthToDate", True)> _
    MonthToDate = 10
    <EnumDisplayValue("PFNTEnum - QuarterToDate", True)> _
    QuarterToDate = 11
    <EnumDisplayValue("PFNTEnum - YearToDate", True)> _
    YearToDate = 12
    <EnumDisplayValue("PFNTEnum - LastWeek", True)> _
    LastWeek = 13
    <EnumDisplayValue("PFNTEnum - LastMonth", True)> _
    LastMonth = 14
    <EnumDisplayValue("PFNTEnum - LastQuarter", True)> _
    LastQuarter = 15
    <EnumDisplayValue("PFNTEnum - LastYear", True)> _
    LastYear = 16
    <EnumDisplayValue("PFNTEnum - NextWeek", True)> _
    NextWeek = 17
    <EnumDisplayValue("PFNTEnum - NextMonth", True)> _
    NextMonth = 18
End Enum

Russell Scott Brown
Russell Scott Brown
StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)
Group: Forum Members
Posts: 124, Visits: 597
Very slick and useful.

Thanks Edhy!

Russ Brown (Using C#2010/SQL Server 2008)
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thanks Ivan, Russell,

Ivan, about your Enum, there are some like LifeToDate which I don't quite understand, but i believe these are specific to your application, right?
For now I just implemented the ones I needed so the end user would not be overwhelm with options not applicable to the application.

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Life to Date would be everything from the past till today.

Life to Future would be everything from the past till everything in the future. So, everything. BigGrin

And Today to Future, of course, from Today onwards.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search