RadiantQ WPF Gantt
Calendar and CalendarWithExceptions
Previous Topic  Next Topic 

The Calendar and CalendarWithExceptions are used to create a  WorkTimeSchedule from a string which defines the working/non-working days and working/non-working time. 


Here is some example Calendar definition strings.


Calendar Name

Calendar definition string

  8X5 Calendar

MON 08:00:00 16:00:00;TUE 08:00:00 16:00:00;WED 08:00:00 16:00:00;THU 08:00:00 16:00:00;FRI 08:00:00 16:00:00;SAT 08:00:00 16:00:00

  24X7 Calendar

Mon 00:00:00 23:00:00;Tue 00:00:00 23:00:00;Wed 00:00:00 23:00:00;thu 00:00:00 23:00:00;fri 00:00:00 23:00:00;sat 00:00:00 23:00:00;sun 00:00:00 23:00:00;

  24X7 With Holidays

Mon 00:00:00 23:00:00;Tue 00:00:00 23:00:00;Wed 00:00:00 23:00:00;thu 00:00:00 23:00:00;fri 00:00:00 23:00:00;sat 00:00:00 23:00:00;sun 00:00:00 23:00:00; HOL 2013-9-16;TeamOut:2013-9-18;


The Calendar definition string holds the following information


  1. Working Days of the week - The first part of the string is where you would specify a "working day" and the working times in that day. For example, "MON 08:30:00 12:30:00, 13:30:00 17:30:00;" which means Monday is a working day with working times from 8.30AM to 12.30PM and 1.30PM to 5.30PM. Any day not represented is considered a day off. Separate different day definitions with a semicolon (;) and multiple time breaks must be separated by commas (,).
  2. Holidays - The second part of the string lets you specify holidays by date. Start this part with a HOL keyword prefix, followed by the different dates separated by semi-colons. Specific holidays can optionally include a name. For an example see above list.


Code  Example


Calendar projectCalendar = new RadiantQ.Windows.Controls.Gantt.Calendar(/*Calendar Name */ "8X5 Calendar",

    /*Calendar Definition string*/  "MON 08:00:00 16:00:00;TUE 08:00:00 16:00:00;WED 08:00:00 16:00:00;THU 08:00:00 16:00:00;FRI 08:00:00 16:00:00;SAT 08:00:00 16:00:00");


//To create a work time schedule from Calendar from the above base calendar.

WorkTimeSchedule workTimeSchedule = Calendar.CreateSchedule(baseCalendar); // This can then be assigned to the GanttControl's WorkTimeSchedule.


CalendarWithExceptions


Used to define some exceptions (working days, non-working days, week days and week day times) that overrides a base calendar defined above.


Here is an example CalendarWithExceptions definition string.


WorkDaySpecific OT:2014-1-13 TimePeriod 08:00:00 20:00:00;OT:2015-5-23; NonWorkDaySpecific Meeting:2014-1-27;Meeting:2014-2-1;Meeting:2014-3-10; WeekDaySpecific Sun 00:00:00 1.00:00:00;



The CalendarWithExceptions definition string holds the following information


  1. Workday Specific- A string that defines a specific day (non-working day in the base calendar) as a working day and it's working time. Separate multiple entries with a semicolon (;). Each entry could include an optional name like "OT" above and can also include optional times (if not specified, the times from the weekday will be used.).
  2. NonWorkDay Specific - A string that defines a specific day (working day in the base calendar) as a non-working day.
  3. WeekDay Specific - A string that defines the working times of specific weekdays, overriding what was specified in the base calendar.



Code  Example

Calendar baseCalendar = new RadiantQ.Windows.Controls.Gantt.Calendar(/*Calendar Name */ "8X5 Calendar",

    /*Calendar Definition string*/  "MON 08:00:00 16:00:00;TUE 08:00:00 16:00:00;WED 08:00:00 16:00:00;THU 08:00:00 16:00:00;FRI 08:00:00 16:00:00;SAT 08:00:00 16:00:00");


CalendarWithExceptions expCalendar = new CalendarWithExceptions(/* base Calendar */baseCalendar,

    /*Calendar with Exceptions Definition string*/

    "WorkDaySpecific OT:2014-1-13 TimePeriod 08:00:00 20:00:00;OT:2015-5-23; NonWorkDaySpecific Meeting:2014-1-27;Meeting:2014-2-1;Meeting:2014-3-10; WeekDaySpecific Sun 00:00:00 1.00:00:00;");


//To create a work time schedule from the above CalendarWithExceptions.

WorkTimeSchedule workTimeSchedule =  RadiantQ.Gantt.CalendarWithExceptions.CreateWorkTimeSchedule(expCalendar);




© RadiantQ 2009 - 2019. All Rights Reserved.