(1) I can set up the daily schedule for each owner by using
owner.DayOfWeekSettings[ DayOfWeekEnum.xxx ].WorkDayStartTime = DateTime.Today.Date.AddHours( start24hr );owner.DayOfWeekSettings[ DayOfWeekEnum.xxx ].WorkDayEndTime = DateTime.Today.Date.AddHours( end24hr );
where "xxx" is Monday, Tuesday, Wednesday, and Thursday; where each day is 9 hours long.
(2) however, in a 9/80 schedule, Fridays alternate between 8 hrs workday (on day), and 0 hr workday (off day).
(3) Therefore, if I use the following logic, the TimelineView will show this for every friday.
owner.DayOfWeekSettings[ DayOfWeekEnum.Friday ].WorkDayStartTime = DateTime.Today.Date.AddHours( start24hr );owner.DayOfWeekSettings[ DayOfWeekEnum.xxx ].WorkDayEndTime = DateTime.Today.Date.AddHours( end24hr -1.0 );
(4) I was going to set up the "off-day" as an appointment programatically, but my users don't like the clutter in the TimelineView.
Is there another way to set up a 9/80 workweek?
Thanks.
Hello ,
Owner object has RecurrentDateSettings property which allows you to managed recurrent day settings along with working hours based on some pattern:
http://help.infragistics.com/Help/Doc/WinForms/2014.2/CLR4.0/html/Infragistics4.Win.UltraWinSchedule.v14.2~Infragistics.Win.UltraWinSchedule.Owner~RecurringDateSettings.html
Also I’ve implemented simple sample in order to demonstrate you this approach.
Please let me know if you have any further questions.
It is working great for the ON-days (working days)! Thank you!
However, when I tried to reverse the settings to be an OFF-day (friday day off, similar to weekend), it gives me unusual results:
DateRecurrence offFriday = new DateRecurrence( new DateTime(2014, 1,3) ); // this is offset by 1 week from the ON-fridaysoffFriday.RangeEndDate = new DateTime(2014, 12,19) ); // this is offset by 1 week from the ON-fridaysoffFriday.PatternFrequency = RecurrencePatternFrequency.Weekly;offFriday.PatternInterval = 2; // every 2 weeksoffFriday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; // every other Friday off
OwnerRecurringDateSettings offFridaySettings = new OwnerRecurringDateSettings(offFriday) ;//**does-nothing**// offFridaySettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(0.0), TimeSpan.FromHours(0.0) )); // OFF Friday, so no working hours//**crash**// offFridaySettings.WorkingHours.Remove( new TimeRange( TimeSpan.FromHours(0.0), TimeSpan.FromHours(24.0) )); // OFF Friday, so no workingoffFridaySettings.IsWorkDay = DefaultableBoolean.False;myOwner.RecurringDateSettings.Add( offFridaySettings );
I was expecting the daySchedule to display the day to be similar to weekends (highlighted in color). and hourSchedule to display the entire day (highlighted in color), but instead, it showed workingHours to be (startHour+3 to endHour-1) and (startHour-1 to endHour) for my two owners...???
if I set every friday as off, and try to override with the code above, it doesn't get overwritten - all fridays are always off: owner.DayOfWeekSettings[DayOfWeekEnum.Friday].IsWorkDay = DefaultableBoolean.False;
Is there a different set of code to add (off fridays)?
thanks.