Custom Holiday DateTime picker


Author
Message
Charles Thomas Blankenship...
Charles Thomas Blankenship
StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
I needed a control that allowed the user to select a valid date (while specifying whether or not they wanted to Skip Holidays and/or Skip Weekends), and to also optionally, select a SQL Server validated Start and Ending Date/Time).  The control had to be driven by a table of customer generated Holidays ... IOW ... birthdays, Jewish Holidays, special company events, etc.  based upon the content of a Holiday table).

It also had to take the form of a user control so it could be used throughout the project just by dropping it on the form.

It took a while of trial and error (I not gonna tell you how much trial and error as I don't want to embarrass myself) before I reached a code base that was remotely professional.

The project contains custom controls (I never knew how to create these before now ... I wanted to learn).

It also contains a text file named HolidayDefinitionScript.txt which, when run, creates the required SQL Server Holiday table.

Hope this helps someone.

CT

https://www.dropbox.com/s/tb8af1gvhzcfiqc/NovantCustomControls.zip

Here is how to implement it after you drop it on one of your forms:

        public TestForm()        {            InitializeComponent();            DataTable dtHolidays = HolidaysBO.getAllFutureHolidays();            adpAppointmentPicker.addHolidays(dtHolidays);         }
All I did was to create a public method in my HolidaysBO business object that returns all future Holidays and then pass the resulting DataTable to the control's .AddHolidays() method.

Maybe ... just maybe ... someone will figure how to bind the properties ( _startDateTime, _endDateTime and _appointmentDate) to three corresponding properties of a BO ... hint, hint.

C.T.
















Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
Charles Thomas Blankenship...
Charles Thomas Blankenship
StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)StrataFrame User (350 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
Sorry about the formatting ... this should help:

I needed a control that allowed the user to select a valid date (while specifying whether or not they wanted to Skip Holidays and/or Skip Weekends), and to also optionally, select a SQL Server validated Start and Ending Date/Time).  The control had to be driven by a table of customer generated Holidays ... IOW ... birthdays, Jewish Holidays, special company events, etc.  based upon the content of a Holiday table).

It also had to take the form of a user control so it could be used throughout the project just by dropping it on the form.

It took a while of trial and error (I not gonna tell you how much trial and error as I don't want to embarrass myself) before I reached a code base that was remotely professional.

The project contains custom controls (I never knew how to create these before now ... I wanted to learn).

It also contains a text file named HolidayDefinitionScript.txt which, when run, creates the required SQL Server Holiday table.

Hope this helps someone.

CT

https://www.dropbox.com/s/tb8af1gvhzcfiqc/NovantCustomControls.zip

Here is how to implement it after you drop it on one of your forms:



        public TestForm()        
        {InitializeComponent();            
         DataTable dtHolidays = HolidaysBO.getAllFutureHolidays();            
         adpAppointmentPicker.addHolidays(dtHolidays);}
All I did was to create a public method in my HolidaysBO business object that returns all future Holidays and then pass the resulting DataTable to the control's .AddHolidays() method.

Maybe ... just maybe ... someone will figure how to bind the properties ( _startDateTime, _endDateTime and _appointmentDate) to three corresponding properties of a BO ... hint, hint.




Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
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