Ejemplo n.º 1
0
    private void DisplayCalender(DateTime _date)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            string topLabel = "<table id='Calendar1' cellspacing='0' cellpadding='2' rules='all'" +
                              "title='Calendar' border='1' style='width: 100%; height: 400px; font-size: 9pt;" +
                              "font-family: Verdana; color: Black; border-width: 1px; border-style: Solid; border-color: Silver;" +
                              "background-color: White; border-collapse: collapse;'>";

            string dayHeader = "<tr>" +
                               " <th align='center' abbr='Sunday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "  font-size: 8pt; font-weight: bold;'>" +
                               "  Sun</th>" +
                               "<th align='center' abbr='Monday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold;'>" +
                               "  Mon</th>" +
                               "<th align='center' abbr='Tuesday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold; width: 123px;'>" +
                               "  Tue</th>" +
                               "<th align='center' abbr='Wednesday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold;'>" +
                               "  Wed</th>" +
                               "<th align='center' abbr='Thursday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold;'>" +
                               "  Thu</th>" +
                               "<th align='center' abbr='Friday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold;'>" +
                               "  Fri</th>" +
                               "<th align='center' abbr='Saturday' scope='col' style='border-width: 1px;height: 60px; border-style: solid;background-color:#CCCCCC;" +
                               "   font-size: 8pt; font-weight: bold;'>" +
                               " Sat</th>" +

                               "</tr>";

            int    setNumber  = ComputeLastDayOfMonth(_date);
            int    totalDays  = DateTime.DaysInMonth(_date.Year, _date.Month);
            string innertabel = "";
            int    dateStatus = 1;
            for (int i = 0; i <= 5; i++)
            {
                innertabel = innertabel + "<tr>";
                for (int j = 1; j <= 7; j++)
                {
                    if (setNumber == j && dateStatus <= totalDays)
                    {//href='javascript:
                        string            currentDate        = _date.Month.ToString() + "/" + dateStatus.ToString() + "/" + _date.Year.ToString();
                        Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                        ArrayList         obj = new ArrayList();
                        obj.Add(txtCaseID.Text);
                        obj.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                        obj.Add(currentDate);
                        decimal _percentage = _bill_Sys_Calender.GET_EVENT_PERCENTAGE(obj);


                        string _color = ParseXML(Server.MapPath("Config/EventColor.xml"), _percentage);

                        innertabel = innertabel + "<td align='left' valign='top' style='color: #999999; width: 8%; height: 85px; background-color:" + _color + "; '>" +
                                     "<a href='#' onclick=\" var _date       = new Date(); _date='" + currentDate + "'; setDiv(_date);\" style='color: Black' title='" + getMonth(_date.Month) + " " + dateStatus.ToString() + "'>" +
                                     "" + dateStatus.ToString() + "</a></td>";
                        dateStatus = dateStatus + 1;
                        setNumber  = setNumber + 1;
                    }
                    else
                    {
                        innertabel = innertabel + "<td align='left' valign='top' style='color: #999999; width: 8%; height: 85px;'>" +
                                     "</td>";
                    }
                }
                setNumber  = 1;
                innertabel = innertabel + "</tr>";
            }

            Cal.InnerHtml = topLabel + dayHeader + innertabel + "</table>";
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }