private void BindGrid()
    {
        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
        {
            _obj = new Bill_Sys_Schedular();
            decimal temp = 0.30M;

            grdScheduleReport.DataSource = _obj.GET_EVENT_DETAIL(txtCompanyID.Text, DateTime.Today, temp, extddlReferringFacility.Text);
            grdScheduleReport.DataBind();
        }
        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());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        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
        {
            btnShowGrid.Attributes.Add("onclick", "return formValidator('frmCalPatientEntry','txtDate,ddlInterval,extddlReferringFacility');");
            txtCompanyID.Text = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            if (Session["PopUp"] != null)
            {
                if (Session["TestFacilityID"] != null && Session["AppointmentDate"] != null)
                {
                    if (Session["PopUp"].ToString() == "True")
                    {
                        extddlReferringFacility.Flag_ID = txtCompanyID.Text.ToString();
                        extddlReferringFacility.Text    = Session["TestFacilityID"].ToString();
                        string strSelectedDate = Session["AppointmentDate"].ToString();
                        Session["AppointmentDate"] = null;
                        Session["TestFacilityID"]  = null;
                        GetCalenderDayAppointments(Convert.ToDateTime(strSelectedDate).ToString("MM/dd/yyyy"), extddlReferringFacility.Text);
                        Session["PopUp"] = null;
                    }
                }
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                    {
                        extddlReferringFacility.Visible = false;
                        lblTestFacility.Visible         = false;
                    }
                    extddlReferringFacility.Flag_ID = txtCompanyID.Text.ToString();
                    //txtDate.Text = DateTime.Today.Date.ToShortDateString();
                    _obj = new Bill_Sys_Schedular();
                    if (extddlReferringFacility.Visible == false)
                    {
                        GetCalenderDayAppointments(System.DateTime.Today.Date.ToString("MM/dd/yyyy"), txtCompanyID.Text);
                        // grdScheduleReport.DataSource = _obj.GET_EVENT_DETAIL(txtCompanyID.Text, Convert.ToDateTime(txtDate.Text), Convert.ToDecimal(ddlInterval.SelectedValue), txtCompanyID.Text);
                        //grdScheduleReport.DataBind();
                    }
                    else
                    {
                        GetCalenderDayAppointments(System.DateTime.Today.Date.ToString("MM/dd/yyyy"), extddlReferringFacility.Text);
                    }
                    if (Request.QueryString["Flag"] != null)
                    {
                        Session["Flag"]           = true;
                        lblHeaderPatientName.Text = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_PATIENT_NAME;
                    }
                    else
                    {
                        Session["Flag"]           = null;
                        lblHeaderPatientName.Text = "";
                    }
                }
            }
            string strDate = System.DateTime.Today.Date.ToString("MM/dd/yyyy");

            //objCalendar = new Calendar_DAO();
            //objCalendar.ControlIDPrefix = "Calendar_" + Convert.ToDateTime(strDate).AddMonths(-1).ToString("MMM").ToUpper().ToString();
            //objCalendar.InitialDisplayMonth = Convert.ToDateTime(strDate).AddMonths(-1).ToString("MMM").ToUpper().ToString();
            //objCalendar.InitialDisplayYear = Convert.ToDateTime(strDate).AddMonths(-1).Year.ToString();

            //showCalendar(objCalendar);


            objCalendar = new Calendar_DAO();
            objCalendar.ControlIDPrefix     = "Calendar_" + Convert.ToDateTime(strDate).ToString("MMM").ToUpper().ToString();
            objCalendar.InitialDisplayMonth = Convert.ToDateTime(strDate).ToString("MMM").ToUpper().ToString();
            objCalendar.InitialDisplayYear  = Convert.ToDateTime(strDate).Year.ToString();

            showCalendar(objCalendar);


            objCalendar = new Calendar_DAO();
            objCalendar.ControlIDPrefix     = "Calendar_" + Convert.ToDateTime(strDate).AddMonths(1).ToString("MMM").ToUpper().ToString();
            objCalendar.InitialDisplayMonth = Convert.ToDateTime(strDate).AddMonths(1).ToString("MMM").ToUpper().ToString();
            objCalendar.InitialDisplayYear  = Convert.ToDateTime(strDate).AddMonths(1).Year.ToString();

            showCalendar(objCalendar);
        }
        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);
        }

        #region "check version readonly or not"
        string app_status = ((Bill_Sys_BillingCompanyObject)Session["APPSTATUS"]).SZ_READ_ONLY.ToString();
        if (app_status.Equals("True"))
        {
            Bill_Sys_ChangeVersion cv = new Bill_Sys_ChangeVersion(this.Page);
            cv.MakeReadOnlyPage("Bill_Sys_CalPatientEntry.aspx");
        }
        #endregion
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }