I am needing to change the duration into the timeslote created event as I am using that to show holidays but i see in the event the duration is readonly when i access that is their anyway to change that at all please.
01.
protected
void
apertureAppointments_TimeSlotCreated(
object
sender, TimeSlotCreatedEventArgs e)
02.
{
03.
int
i = 0;
04.
bool
isFound =
false
;
05.
List<tblApertureNetShiftPattern> _list =
new
List<tblApertureNetShiftPattern>();
06.
_list = _dal.getHolidays();
07.
List<Resource> resources =
new
List<Resource>(apertureAppointments.Resources.GetResourcesByType(
"Managers"
));
08.
Resource res = resources[5];
09.
10.
foreach
(tblApertureNetShiftPattern sp
in
_list)
11.
{
12.
if
(_list.Count >= 1)
13.
i++;
14.
else
15.
i = 0;
16.
17.
DateTime dt1 = Convert.ToDateTime(_list[i - 1].startdate);
18.
DateTime dt2 = Convert.ToDateTime(_list[i - 1].endDate);
19.
20.
TimeSpan span = dt2.Subtract(dt1);
21.
if
(e.TimeSlot.Start == dt1 && e.TimeSlot.Resource.Text == sp.manager_name)
22.
{
23.
isFound =
true
;
24.
if
(DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound ==
true
)
25.
{
26.
Label temperatureLabel =
new
Label();
27.
28.
if
(sp.appointmentType == Constants.shiftDayoff)
29.
{
30.
e.TimeSlot.CssClass =
"DayOfCssStyle"
;
31.
temperatureLabel.CssClass =
"DayOfCssStyle"
;
32.
temperatureLabel.Text = sp.Description;
33.
}
34.
else
if
(sp.appointmentType == Constants.shiftHoliday)
35.
{
36.
e.TimeSlot.CssClass =
"HolidayCssStyle"
;
37.
temperatureLabel.CssClass =
"HolidayCssStyle"
;
38.
temperatureLabel.Text = sp.Description;
39.
}
40.
else
if
(sp.appointmentType == Constants.shiftStat)
41.
{
42.
e.TimeSlot.CssClass =
"statCssStyle"
;
43.
temperatureLabel.CssClass =
"statCssStyle"
;
44.
temperatureLabel.Text = sp.Description;
45.
}
46.
else
if
(sp.appointmentType == Constants.shiftsickDay)
47.
{
48.
e.TimeSlot.CssClass =
"SickDayStyle"
;
49.
temperatureLabel.CssClass =
"SickDayStyle"
;
50.
temperatureLabel.Text = sp.Description;
51.
}
52.
else
53.
temperatureLabel.Text =
"OCCUPIED"
;
54.
55.
Image imageControl =
new
Image();
56.
57.
imageControl.ImageUrl = @
"~\images\aperturenet\Calendar\resources\holidays.png"
;
58.
59.
temperatureLabel.BackColor = System.Drawing.Color.Orange;
60.
61.
e.TimeSlot.Control.Controls.AddAt(1, temperatureLabel);
//add the image
62.
e.TimeSlot.Control.Controls.AddAt(2, imageControl);
63.
}
64.
}
65.
}
66.
}