0

I was trying to create a facility/equipment and setting its work hours through c# code, i am successfully able to create the facility and set its work hours. I am able to set the work hours at Freq = Daily/Weekly. The problem i am facing right now is i am not able to set different timings for different days (Freq = weekly), what is happening is the timings are getting set for all the days in the week and if i change one of the timings all the timings of other days gets changed.

Ex: I set timings like this

calendarRule1.Attributes["duration"] = 540;
calendarRule1.Attributes["offset"] = 480;
calendarRule1.Attributes["timezonecode"] = 190;

for the calendar rule as shown below:

calendarRule.Attributes["duration"] = 1440; 
calendarRule.Attributes["pattern"] = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR";
calendarRule.Attributes["timezonecode"] = 190;

The above code adds work hours from Monday to Friday with work hours (8 AM to 5 PM ) Can someone assist me with code as to how to set different work hours on different days i.e. Vary-by-day.

Thanks in advance (code snippet is just an example shown - i have all the supporting code added)

Rahul J
  • 103
  • 1
  • 11

1 Answers1

0

Change the BYDAY value to only specify the day(s) you want to set:

For example, to just set for Tuesday and Wednesday:

'es["pattern"] = "FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,WE"'

Nicknow
  • 7,154
  • 3
  • 22
  • 38
  • I am concerned about setting different timings on different days.........its not about only different days. – Rahul J Apr 20 '16 at 12:33