Beispiel #1
0
    public string GetMonthCalender(int p_intMonth, int p_intYear)
    {
        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());
        }
        Session["CaseID"] = Session["SZ_CASE_ID"];
        String szHtmlString = "<table width='98%' bgcolor='gray' border=1><tr>";
        Bill_Sys_BillingCompanyDetails_BO _obj = new Bill_Sys_BillingCompanyDetails_BO();

        try
        {
            int iDaysInMonths = 0;

            for (int k = 1; k <= 7; k++)
            {
                szHtmlString = szHtmlString + "<td width='14%' height='60px' bgcolor='blue' align='center' class='css-calendar-grid-td'><b>" + getDay(k) + "</b></td>";
            }
            szHtmlString = szHtmlString + "</tr><tr>";

            DateTime objDate = new DateTime(p_intYear, p_intMonth, 1);
            iDaysInMonths = System.DateTime.DaysInMonth(p_intYear, p_intMonth);
            int iStartNumber = getDayNumber(objDate.DayOfWeek.ToString());
            int j            = 1;
            while (j < iStartNumber)
            {
                szHtmlString = szHtmlString + "<td width='14%' height='60px'>&nbsp</td>";
                j++;
            }
            int count = 0;
            for (int i = 1; i <= iDaysInMonths; i++)
            {
                if (Convert.ToInt32(System.DateTime.Today.Day) == i)
                {
                    count = i;
                    int daysDiff = 0;
                    int totDays  = Convert.ToInt32(System.DateTime.Today.Day) + 7;
                    if (totDays > iDaysInMonths)
                    {
                        daysDiff = totDays - iDaysInMonths;
                    }
                    while (iDaysInMonths >= count && totDays >= count)
                    {
                        if (Convert.ToInt32(System.DateTime.Today.Day) == count)
                        {
                            szHtmlString = szHtmlString + "<td width='14%' height='60px' style='color:WhiteSmoke;'><table width='100%'><tr><td style='text-align:left;vertical-align:top;height:100%;font-weight:bold;font-size:18px;' width='100%'> " + count + "</td></tr><tr><td width='100%' style='font-weight:bold;font-size:18px;'>" + _obj.GetPerDayWithTimeEvent(Session["CaseID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, System.DateTime.Today.Month + "/" + count + "/" + System.DateTime.Today.Year, Convert.ToInt32(Session["CALENDER_TIME"].ToString())) + "</td></tr></table></td>";
                        }
                        else
                        {
                            szHtmlString = szHtmlString + "<td width='14%' height='60px' style='color:WhiteSmoke;'><table width='100%'><tr><td style='text-align:left;vertical-align:top;height:100%;font-weight:bold;font-size:18px;' width='100%'> " + count + "</td></tr><tr><td width='100%' style='font-weight:bold;font-size:18px;'>" + _obj.GetPerDayUpcomingEvent(Session["CaseID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, System.DateTime.Today.Month + "/" + count + "/" + System.DateTime.Today.Year) + "</td></tr></table></td>";
                        }
                        if ((count + iStartNumber) % 7 == 1)
                        {
                            szHtmlString = szHtmlString + "</tr><tr>";
                        }
                        count++;
                    }
                    i     = count;
                    count = 1;
                    if (daysDiff > count)
                    {
                        int iStartNumberDay = Convert.ToInt32(getDayNumber(System.DateTime.Today.Date.AddMonths(1).Day.ToString())) + 1;
                        while (daysDiff > count)
                        {
                            if (Convert.ToInt32(System.DateTime.Today.Day) == count)
                            {
                                szHtmlString = szHtmlString + "<td width='14%' height='60px' style='color:WhiteSmoke;'><table width='100%'><tr><td style='text-align:left;vertical-align:top;height:100%;font-weight:bold;font-size:18px;' width='100%'> " + count + "</td></tr><tr><td width='100%' style='font-weight:bold;font-size:18px;'>" + _obj.GetPerDayUpcomingEvent(Session["CaseID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, Convert.ToInt32(System.DateTime.Today.Month) + 1 + "/" + count + "/" + System.DateTime.Today.Year) + "</td></tr></table></td>";
                            }
                            else
                            {
                                szHtmlString = szHtmlString + "<td width='14%' height='60px' style='color:WhiteSmoke;'><table width='100%'><tr><td style='text-align:left;vertical-align:top;height:100%;font-weight:bold;font-size:18px;' width='100%'> " + count + "</td></tr><tr><td width='100%' style='font-weight:bold;font-size:18px;'>" + _obj.GetPerDayUpcomingEvent(Session["CaseID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, Convert.ToInt32(System.DateTime.Today.Month) + 1 + "/" + count + "/" + System.DateTime.Today.Year) + "</td></tr></table></td>";
                            }
                            if ((count + iStartNumberDay) % 7 == 1)
                            {
                                szHtmlString = szHtmlString + "</tr><tr>";
                            }
                            count++;
                        }
                    }
                }
                else
                {
                    szHtmlString = szHtmlString + "<td width='14%' height='60px' style='color:WhiteSmoke;'><table width='100%'><tr><td style='text-align:left;vertical-align:top;height:100%;' width='100%'> " + i + "</td></tr><tr><td width='100%' ></td></tr></table></td>";
                }
                if ((i + iStartNumber) % 7 == 1)
                {
                    szHtmlString = szHtmlString + "</tr><tr>";
                }
            }
        }
        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);
        }

        tdMonthCalender.InnerHtml = szHtmlString;
        return(null);

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }