protected void rcmb_PeriodType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            rcmb_DurationType.Items.Clear();
            _obj_Smhr_PeriodType = new SMHR_PERIODTYPE();
            _obj_Smhr_PeriodType.PERIODTYPE_ID = Convert.ToInt32(rcmb_PeriodType.SelectedItem.Value);
            DataTable dtperiodtype = BLL.get_PeriodType(_obj_Smhr_PeriodType);
            int       days         = Convert.ToInt32(dtperiodtype.Rows[0]["PERIODTYPE_NOOFDAYS"]);

            if (days >= 31)
            {
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Select", "-1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Years", "1"));
            }
            else
            {
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Select", "-1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Years", "1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Months", "2"));
            }

            Rg_PeriodDetails.DataSource = null;
            Rg_PeriodDetails.DataBind();
            rcmb_DurationType.SelectedIndex = 1;
            btn_Save.Visible = false;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodCalender", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Пример #2
0
    protected void btn_Generate_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_Smhr_Period           = new SMHR_PERIOD();
            _obj_Smhr_Period.OPERATION = operation.Empty;
            //_obj_Smhr_Period.PERIOD_ID = null; ;
            _obj_Smhr_Period.PERIOD_NAME      = Convert.ToString(rtxt_PeriodName.Text);
            _obj_Smhr_Period.PERIOD_STARTDATE = Convert.ToDateTime(rdtp_StartDate.SelectedDate);
            _obj_Smhr_Period.PERIOD_TYPE      = Convert.ToInt32(rcmb_PeriodType.SelectedItem.Value);
            _obj_Smhr_Period.PERIOD_DURATION  = Convert.ToInt32(rtxt_Duration.Text);
            if (rcmb_DurationType.SelectedValue != "")
            {
                if (rcmb_DurationType.SelectedItem.Value != "-1")
                {
                    _obj_Smhr_Period.PERIOD_DURATIONTYPE = Convert.ToInt32(rcmb_DurationType.SelectedIndex);
                }
                else
                {
                    BLL.ShowMessage(this, "Please select Durtaion Type");
                    // return;
                }
            }
            else
            {
                BLL.ShowMessage(this, "Please select Period Type");
                //return;
            }

            dt1 = BLL.GeneratePeriodDetails(_obj_Smhr_Period);
            //if and else added by bharat
            // as it is throwing error if then don't select period type and click on generate button
            if (dt1.Rows.Count > 0)
            {
                Rg_PeriodDetails.DataSource   = dt1;
                ViewState["Rg_PeriodDetails"] = dt1;
                Rg_PeriodDetails.DataBind();
                Rg_PeriodDetails.Visible  = true;
                btn_Save.Visible          = true;
                rdtp_EndDate.SelectedDate = Convert.ToDateTime(dt1.Rows[dt1.Rows.Count - 1]["prddtl_enddate"]);
            }
            else
            {
                BLL.ShowMessage(this, "Unable to Generate Details, Please Select Proper Information");
                btn_Save.Visible         = false;
                Rg_PeriodDetails.Visible = false;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Period", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Пример #3
0
 protected void rdtp_StartDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
 {
     try
     {
         if (rdtp_StartDate.SelectedDate.HasValue)
         {
             Rg_PeriodDetails.DataSource = null;
             Rg_PeriodDetails.DataBind();
             rdtp_EndDate.SelectedDate = null;
             btn_Save.Visible          = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Period", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void clearControls()
    {
        try
        {
            rtxt_PeriodName.Enabled   = true;
            rcmb_PeriodType.Enabled   = true;
            rdtp_StartDate.Enabled    = true;
            rtxt_Duration.Enabled     = true;
            rcmb_DurationType.Enabled = true;

            Rg_PeriodDetails.DataSource = null;
            Rg_PeriodDetails.DataBind();
            rtxt_PeriodName.Text          = string.Empty;
            rcmb_PeriodType.SelectedIndex = -1;
            rdtp_StartDate.SelectedDate   = null;
            rdtp_EndDate.SelectedDate     = null;
            //rtxt_Duration.Text = string.Empty;
            rcmb_DurationType.SelectedIndex = -1;
            btn_Save.Visible = false;
            btn_Edit.Visible = false;
            //code for security
            if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
            {
                btn_GeneratePeriods.Visible = false;
            }

            else
            {
                btn_GeneratePeriods.Visible = true;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodCalender", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void lnk_Edit_Command(object sender, CommandEventArgs e)
    {
        try
        {
            ViewState["Rg_PeriodDetails"] = null;
            _obj_Smhr_Period = new SMHR_PERIOD();
            _obj_Smhr_Prddtl = new SMHR_PERIODDTL();
            _obj_Smhr_Period.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_Smhr_Period.PERIOD_ID       = Convert.ToInt32(Convert.ToString(e.CommandArgument));
            dt = BLL.get_PeriodHeaderDetails_Calendar(_obj_Smhr_Period);
            if (dt.Rows.Count > 0)
            {
                rtxt_PeriodName.Text          = Convert.ToString(dt.Rows[0]["PERIOD_NAME"]);
                rcmb_PeriodType.SelectedIndex = rcmb_PeriodType.Items.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["PERIOD_TYPE"]));
                rdtp_StartDate.SelectedDate   = Convert.ToDateTime(dt.Rows[0]["PERIOD_STARTDATE"]);
                rdtp_EndDate.SelectedDate     = Convert.ToDateTime(dt.Rows[0]["PERIOD_ENDDATE"]);
                rtxt_Duration.Text            = Convert.ToString(dt.Rows[0]["PERIOD_DURATION"]);
                rcmb_PeriodType_SelectedIndexChanged(null, null);
                rcmb_DurationType.SelectedIndex = rcmb_DurationType.Items.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["PERIOD_DURATIONTYPE"]));

                rtxt_PeriodName.Enabled   = false;
                rcmb_PeriodType.Enabled   = false;
                rdtp_StartDate.Enabled    = false;
                rdtp_EndDate.Enabled      = false;
                rtxt_Duration.Enabled     = false;
                rcmb_DurationType.Enabled = false;

                Rm_Period_page.SelectedIndex = 1;
                btn_GeneratePeriods.Visible  = false;
                btn_Save.Visible             = false;
                //code for security
                if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
                {
                    btn_Edit.Visible = false;
                }

                else
                {
                    btn_Edit.Visible = true;
                }

                _obj_Smhr_Prddtl.OPERATION        = operation.Select;
                _obj_Smhr_Prddtl.PRDDTL_PERIOD_ID = Convert.ToInt32(Convert.ToString(e.CommandArgument));

                DataTable dttemp = BLL.get_PeriodDetails_Calendar(_obj_Smhr_Prddtl);

                ViewState["Rg_PeriodDetails"] = dttemp;
                Rg_PeriodDetails.DataSource   = dttemp;
                Rg_PeriodDetails.DataBind();
            }
            else
            {
                BLL.ShowMessage(this, "The End Date for the Period Define has been completed");
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodCalender", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }