예제 #1
0
 protected void DayRender(Object Sender, DayRenderEventArgs e)
 {
     e.Day.IsSelectable = false;
     if (e.Day.Date != calThis.SelectedDate)
     {
         e.Cell.Attributes.Add("onmouseover", "CalendarOver(this);");
         e.Cell.Attributes.Add("onmouseout", "CalendarOut(this);");
     }
     e.Cell.Attributes.Add("onclick", "DateSelect('" + e.Day.Date.ToShortDateString() + "');");
     e.Cell.ToolTip = e.Day.Date.ToLongDateString();
     if (boolAll == false)
     {
         e.Cell.Text = "<div style=\"width:100%;height:80;overflow:hidden\">";
     }
     else
     {
         e.Cell.Text = "<div style=\"width:100%;height:100%;overflow:visible\">";
     }
     e.Cell.Text += "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">";
     if (e.Day.IsOtherMonth == false && e.Day.IsWeekend == false)
     {
         e.Cell.Text += "<tr><td class=\"calendarhead\">" + e.Day.DayNumberText + "</td></tr>";
     }
     else
     {
         e.Cell.Text += "<tr><td class=\"calendarotherhead\">" + e.Day.DayNumberText + "</td></tr>";
     }
     ds = oHoliday.Get(e.Day.Date);
     if (ds.Tables[0].Rows.Count > 0)
     {
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             e.Cell.Text += "<tr><td class=\"calendarred\">" + dr["name"].ToString() + "</span></td></tr>";
         }
     }
     else
     {
         ds = oVacation.Get(e.Day.Date, intApplication);
         int intCount = 0;
         if (ds.Tables[0].Rows.Count > 0)
         {
             while (intCount < ds.Tables[0].Rows.Count && intCount < intRows)
             {
                 string strType   = "";
                 string strReason = ds.Tables[0].Rows[intCount]["reason"].ToString();
                 if (ds.Tables[0].Rows[intCount]["vacation"].ToString() == "1")
                 {
                     strType   = "V:";
                     strReason = "Vacation";
                 }
                 else if (ds.Tables[0].Rows[intCount]["holiday"].ToString() == "1")
                 {
                     strType   = "F:";
                     strReason = "Floating Holiday";
                 }
                 else if (ds.Tables[0].Rows[intCount]["personal"].ToString() == "1")
                 {
                     strType   = "P:";
                     strReason = "Personal / Sick day";
                 }
                 else if (strReason == "Highland Hills")
                 {
                     strType = "HH:";
                 }
                 if (e.Day.IsOtherMonth == false && e.Day.IsWeekend == false)
                 {
                     e.Cell.Text += "<tr><td class=\"calendar\"><span title=\"" + ds.Tables[0].Rows[0]["username"].ToString() + "&#13;" + strReason + "&#13;" + e.Day.Date.ToString("MMMM dd, yyyy") + "\">" + strType + ds.Tables[0].Rows[intCount]["username"].ToString() + "</span></td></tr>";
                 }
                 else
                 {
                     e.Cell.Text += "<tr><td class=\"calendarother\"><span title=\"" + ds.Tables[0].Rows[0]["username"].ToString() + "&#13;" + strReason + "&#13;" + e.Day.Date.ToString("MMMM dd, yyyy") + "\">" + strType + ds.Tables[0].Rows[intCount]["username"].ToString() + "</span></td></tr>";
                 }
                 intCount++;
             }
         }
     }
     e.Cell.Text += "</table>";
     //if (boolAll == false)
     e.Cell.Text += "</div>";
 }