/// <summary> /// Write date to container with style. /// </summary> /// <param name="writer">HtmlTextWriter.</param> /// <param name="dwt">Date.</param> /// <param name="Container">HtmlContainer.</param> /// <param name="fWriteTime">Write date(false) or time(true).</param> /// <param name="UserID">ID of user.</param> private void WriteDataTime(HtmlTextWriter writer, DayWorkTime dwt, String Container, bool fWriteTime, int? UserID) { CalendarItem calItem = new CalendarItem(dwt); String strValue = fWriteTime ? DateTimePresenter.GetTime(dwt.WorkTime) : dwt.Date.ToString("dd/MM"); Color cellColor = new Color(); if (UserID != null && dwt.WorkTime == TimeSpan.Zero && !calItem.IsWeekend) { WorkEvent workEvent = WorkEvent.GetCurrentEventOfDate((int) UserID, dwt.Date); if (workEvent != null) switch (workEvent.EventType) { case WorkEventType.BusinessTrip: strValue = "Trip"; cellColor = Color.LightSlateGray; break; case WorkEventType.Ill: strValue = "Ill"; cellColor = Color.LightPink; break; case WorkEventType.TrustIll: strValue = "Trust Ill"; cellColor = Color.LightPink; break; case WorkEventType.Vacation: strValue = "Vacation"; cellColor = Color.LightYellow; break; } } if (calItem.IsWeekend) writer.WriteLine("<{0} class='weekend'>{1}</{0}>", Container, strValue); else writer.WriteLine("<{0} style='background-color: {1};' align='center'>{2}</{0}>", Container, cellColor.ToKnownColor(), strValue); }
/// <summary> /// Constructor. /// </summary> /// <param name="Date">Day work time.</param> public CalendarItem(DayWorkTime date) { m_Date = date.Date; m_WorkTime = date.WorkTime; }