Back to Devexpress

Work Time Rules

aspnetmvc-401882-components-gantt-work-time-rules.md

latest5.6 KB
Original Source

Work Time Rules

  • May 18, 2021
  • 4 minutes to read

The Gantt extension allows you to specify work days, work hours, and holidays.

Run Demo: MVCxGantt - Work Time Schedule

To set up work time rules, populate the WorkTimeRules collection with the following objects:

The following table lists common rule settings:

|

Property

|

Description

| | --- | --- | |

IsWorkDay

|

Specifies whether a day is a work day.

| |

Recurrence

|

Contains recurrence settings that depend on the rule type.

| |

WorkTimeRanges

|

Contains settings for work time ranges.

|

Daily Rule

The Daily class contains settings for a daily recurrence pattern.

|

Property

|

Description

| | --- | --- | |

Start

|

Start date.

| |

End

|

End date.

| |

OccurrenceCount

|

Number of occurrences.

| |

Interval

|

Interval between adjacent occurrences, in days.

|

Work time patterns:

  • In March of 2019, a work day is from 8:00 AM to 5:00 PM - with an hour break from noon to 1:00 PM.

  • In March of 2019, every third day is a work day - with a work shift from 10:00 AM to 10:00 PM.

Weekly Rule

The Weekly class contains settings for a weekly recurrence pattern.

|

Property

|

Description

| | --- | --- | |

DayOfWeek

|

Day of the week.

| |

Start

|

Start date.

| |

End

|

End date.

| |

OccurrenceCount

|

Number of occurrences.

| |

Interval

|

Interval between adjacent occurrences, in weeks.

|

Work time patterns:

  • Fridays, Saturdays, and Sundays are non-working days.

  • Monday to Wednesday – work days from 8:00 AM to 2:00 PM; Thursday to Friday – work days from 2:00 PM to 8:00 PM; Saturday and Sunday – non-work days.

Monthly Rule

The Monthly class contains settings for a monthly recurrence pattern.

|

Property

|

Description

| | --- | --- | |

CalculateByDayOfWeek

|

Specifies whether the Gantt chart applies the rule to a day of the week (DayOfWeekOccurrence, DayOfWeek) or a specific day (Day).

| |

Day

|

Day.

| |

DayOfWeekOccurrence

|

Designates an occurrence interval for a specific day of the week.

| |

DayOfWeek

|

Day of the week.

| |

Start

|

Start date.

| |

End

|

End date.

| |

OccurrenceCount

|

Number of occurrences.

| |

Interval

|

Interval between adjacent occurrences, in months.

|

Work time patterns:

  • Every second Friday in a month has a different work time.

  • Every 10th of the month is a non-work day (for three months).

Yearly Rule

The Yearly class contains settings for a yearly recurrence pattern.

|

Property

|

Description

| | --- | --- | |

CalculateByDayOfWeek

|

Specifies whether the Gantt chart applies the rule to a day of the week (DayOfWeekOccurrence, DayOfWeek) or a specific day (Day, Month)

| |

Day

|

Day.

| |

Month

|

Month.

| |

DayOfWeekOccurrence

|

Designates an occurrence interval for a specific day of the week.

| |

DayOfWeek

|

Day of the week.

| |

Start

|

Start date.

| |

End

|

End date.

| |

OccurrenceCount

|

Number of occurrences.

| |

Interval

|

Interval between adjacent occurrences, in years.

|

Work time patterns:

  • 2-week holidays.

  • The work day before a holiday is shortened by one hour.