protected void radQuarters_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         if (Convert.ToInt32(radQuarters.SelectedItem.Value) > 0)
         {
             if (string.Compare(radFinPeriod.SelectedItem.Text, "Select", true) != 0)
             {
                 DataTable dt           = GetDataTable();
                 int       noOfQuarters = Convert.ToInt32(radQuarters.SelectedItem.Value);
                 for (int i = 1; i <= noOfQuarters; i++)
                 {
                     dt.Rows.Add(i, "Quarter " + i.ToString(), Convert.ToDateTime(hdnStartDate.Value), Convert.ToDateTime(hdnEndDate.Value), null, null);
                 }
                 btn_Save.Visible       = true;
                 Rg_Quarters.Visible    = true;
                 Rg_Quarters.Enabled    = true;
                 Rg_Quarters.DataSource = dt;
                 Rg_Quarters.DataBind();
             }
             else
             {
                 btn_Save.Visible    = false;
                 Rg_Quarters.Visible = false;
                 radQuarters.ClearSelection();
                 BLL.ShowMessage(this, "Please select Financial Period");
                 return;
             }
         }
         else
         {
             btn_Save.Visible    = false;
             Rg_Quarters.Visible = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_AddQuarters", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void lnk_Edit_Command(object sender, CommandEventArgs e)
    {
        try
        {
            clearControls();

            _obj_Smhr_PensionQrtrs           = new SMHR_PENSION_QUARTERS();
            _obj_Smhr_PensionQrtrs.OPERATION = operation.Get;
            _obj_Smhr_PensionQrtrs.QRTR_ID   = Convert.ToInt32(e.CommandArgument);
            lblID.Text = _obj_Smhr_PensionQrtrs.QRTR_ID.ToString();
            _obj_Smhr_PensionQrtrs.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable dt = BLL.get_PensionQuarters(_obj_Smhr_PensionQrtrs);
            BindFinancialPeriod();
            radFinPeriod.SelectedIndex = radFinPeriod.FindItemIndexByValue(dt.Rows[0]["QRTR_PERIODID"].ToString());
            radQuarters.SelectedIndex  = radQuarters.FindItemIndexByValue(dt.Rows[0]["QRTR_NOOFQRTRS"].ToString());
            radFinPeriod.Enabled       = radQuarters.Enabled = false;
            DataTable dtGridData = GetDataTable();
            for (int i = 1; i <= Convert.ToInt32(dt.Rows[0]["QRTR_NOOFQRTRS"]); i++)
            {
                switch (i.ToString())
                {
                case "1":
                    dtGridData.Rows.Add(i, "Quarter " + i.ToString(), Convert.ToDateTime(dt.Rows[0]["PERIOD_STARTDATE"]), Convert.ToDateTime(dt.Rows[0]["PERIOD_ENDDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR1SDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR1EDATE"]));
                    break;

                case "2":
                    dtGridData.Rows.Add(i, "Quarter " + i.ToString(), Convert.ToDateTime(dt.Rows[0]["PERIOD_STARTDATE"]), Convert.ToDateTime(dt.Rows[0]["PERIOD_ENDDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR2SDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR2EDATE"]));
                    break;

                case "3":
                    dtGridData.Rows.Add(i, "Quarter " + i.ToString(), Convert.ToDateTime(dt.Rows[0]["PERIOD_STARTDATE"]), Convert.ToDateTime(dt.Rows[0]["PERIOD_ENDDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR3SDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR3EDATE"]));
                    break;

                case "4":
                    dtGridData.Rows.Add(i, "Quarter " + i.ToString(), Convert.ToDateTime(dt.Rows[0]["PERIOD_STARTDATE"]), Convert.ToDateTime(dt.Rows[0]["PERIOD_ENDDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR4SDATE"]), Convert.ToDateTime(dt.Rows[0]["QRTR_QRTR4EDATE"]));
                    break;
                }
            }
            Rg_Quarters.DataSource = dtGridData;
            Rg_Quarters.DataBind();
            Rg_Quarters.Visible = true;
            SMHR_PERIOD osmhr_period = new SMHR_PERIOD();
            osmhr_period.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            osmhr_period.PERIOD_ID       = Convert.ToInt32(radFinPeriod.SelectedValue);
            DataTable dtCurrentFinPeriod = BLL.IscurrentFinPeriod(osmhr_period);
            if (string.Compare(dtCurrentFinPeriod.Rows[0]["ISEXISTS"].ToString(), "0", true) == 0)
            {
                Rg_Quarters.Enabled = false;
                btn_Update.Visible  = false;
            }
            else
            {
                Rg_Quarters.Enabled = Convert.ToBoolean(dt.Rows[0]["ISEnable"]);
                btn_Update.Visible  = Convert.ToBoolean(dt.Rows[0]["ISEnable"]);
            }

            Rm_CY_page.SelectedIndex = 1;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_AddQuarters", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }