protected void loadgrid()
    {
        try
        {
            _obj_idp                     = new pms_IDPSCREEN();
            _obj_idp.IDP_MODE            = 11;
            _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_idp.LOGIN_ID            = Convert.ToInt32(Session["USER_ID"]);
            DataTable dt = Pms_Bll.get_idp(_obj_idp);
            if (dt.Rows.Count != 0)
            {
                RG_VALUESform.DataSource = dt;
                RG_VALUESform.DataBind();
            }
            else
            {
                DataTable dt1 = new DataTable();
                RG_VALUESform.DataSource = dt1;
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Valuesform", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void lnk_Edit_Commnad(object sender, CommandEventArgs e)
    {
        try
        {
            clearfields();
            LoadCombos();
            _obj_idp                     = new pms_IDPSCREEN();
            _obj_idp.IDP_MODE            = 5;
            _obj_idp.IDP_ID              = Convert.ToInt32(e.CommandArgument);
            _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable DT = Pms_Bll.get_idp(_obj_idp);
            if (DT.Rows.Count != 0)
            {
                lbl_id.Text            = Convert.ToString(DT.Rows[0]["IDP_ID"]);
                txt_valname.Text       = Pms_Bll.ReplaceQuote(Convert.ToString(DT.Rows[0]["IDP_NAME"]));
                txt_description.Text   = Pms_Bll.ReplaceQuote(Convert.ToString(DT.Rows[0]["IDP_DESCRIPTION"]));
                rcmb_BUI.SelectedIndex = rcmb_BUI.Items.FindItemIndexByValue(Convert.ToString(DT.Rows[0]["IDP_BU_ID"]));
                if (Convert.ToInt32(DT.Rows[0]["IDP_STATUS"]) == 0)
                {
                    chkbx_status.Checked = true;
                }
                else if (Convert.ToInt32(DT.Rows[0]["IDP_STATUS"]) == 1)
                {
                    chkbx_status.Checked = false;
                }
                RM_VALUESform.SelectedIndex = 1;
                btn_SAVE.Visible            = true;
                btn_SAVE.Visible            = false;
                btn_Update.Visible          = true;
                txt_description.Enabled     = true;
                txt_valname.Enabled         = false;
                //rtxt_KRAID.Enabled = false;
                //txt_Measure.Enabled = true;
                rcmb_BUI.Enabled     = false;
                lbl_status.Visible   = true;
                cln_status.Visible   = true;
                chkbx_status.Visible = true;

                if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
                {
                    btn_Update.Visible = false;
                }

                else
                {
                    btn_Update.Visible = true;
                }
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Valuesform", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    /// <summary>
    /// Here Update the Record..
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_UPDATE_Click(object sender, EventArgs e)
    {
        try
        {
            if (txt_Comments.Text.Length > 1000)
            {
                BLL.ShowMessage(this, "Comments length should be Less Than 1000.");
                return;
            }
            if (txt_Description.Text.Length > 1000)
            {
                BLL.ShowMessage(this, "Description length should be Less Than 1000.");
                return;
            }
            _obj_idp                 = new pms_IDPSCREEN();
            _obj_idp.IDP_ID          = Convert.ToInt32(lbl_id.Text);
            _obj_idp.IDP_EMP_ID      = Convert.ToInt32(RCB_EmployeeName.SelectedValue);
            _obj_idp.IDP_NAME        = Pms_Bll.ReplaceQuote(Convert.ToString(txt_IDP.Text));
            _obj_idp.IDP_DESCRIPTION = Pms_Bll.ReplaceQuote(Convert.ToString(txt_Description.Text));

            //_obj_idp.IDP_EMP_ID = 6;
            _obj_idp.IDP_STARTDATE = RDP_StartDate.SelectedDate.Value;
            //_obj_idp.IDP_ENDDATE = RDP_EndDate.SelectedDate.Value;
            _obj_idp.IDP_COMMENTS = Convert.ToString(txt_Comments.Text.Replace("'", "''"));
            _obj_idp.LASTMDFBY    = Convert.ToInt32(Session["user_id"]);
            _obj_idp.LASTMDFDATE  = DateTime.Now;
            _obj_idp.IDP_MODE     = 5;
            //_obj_idp.IDP_APPRAISALCYCLE = Convert.ToInt32(rcm_apprcycle.SelectedItem.Value);

            bool status = Pms_Bll.set_idp(_obj_idp);
            if (status == true)
            {
                Pms_Bll.ShowMessage(this, "IDP Updated Succesfully");
                loadgrid();

                RG_Idpform.DataBind();
                btn_SAVE.Visible         = false;
                RM_Idpform.SelectedIndex = 0;
                RP_Idpform.Visible       = true;
                RP_Idpform2.Visible      = false;
            }
            else
            {
                Pms_Bll.ShowMessage(this, "Unable to Update the record,Execption Occured");
                return;
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_idp", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_idp                 = new pms_IDPSCREEN();
            _obj_idp.IDP_ID          = Convert.ToInt32(lbl_id.Text);
            _obj_idp.IDP_NAME        = Pms_Bll.ReplaceQuote(Convert.ToString(txt_valname.Text));
            _obj_idp.IDP_DESCRIPTION = Pms_Bll.ReplaceQuote(Convert.ToString(txt_description.Text));
            _obj_idp.IDP_BU_ID       = Convert.ToInt32(rcmb_BUI.SelectedValue);
            //_obj_cmp.KRA_MEASURE = Convert.ToString(txt_Measure.Text.Replace("'", "''"));
            _obj_idp.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_idp.LASTMDFDATE = DateTime.Now;
            _obj_idp.IDP_MODE    = 5;
            if (chkbx_status.Checked == true)
            {
                _obj_idp.IDP_STATUS = 0;
            }
            else if (chkbx_status.Checked == false)
            {
                _obj_idp.IDP_STATUS = 1;
            }
            //_obj_cmp.KRA_KRAID = Pms_Bll.ReplaceQuote(Convert.ToString(rtxt_KRAID.Text));
            //_obj_kra.KRA_WEIGHTAGE = Convert.ToInt32(RNT_KraWeightage.Value);

            bool status = Pms_Bll.set_idp(_obj_idp);
            if (status == true)
            {
                Pms_Bll.ShowMessage(this, "Value Updated Successfully");
                loadgrid();
                btn_Update.Visible          = true;
                RM_VALUESform.SelectedIndex = 0;
            }
            else
            {
                Pms_Bll.ShowMessage(this, "Unable to Update the record,Execption Occured");
                return;
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Valuesform", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Exemple #5
0
    protected void RG_Idpform_NeedDataSource1(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        try
        {
            _obj_idp                     = new pms_IDPSCREEN();
            _obj_idp.IDP_EMP_ID          = Convert.ToInt32(Session["EMP_ID"]);
            _obj_idp.IDP_MODE            = 3;
            _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["org_id"]);
            DataTable dt = Pms_Bll.get_idp(_obj_idp);
            if (dt.Rows.Count != 0)
            {
                RG_Idpform.DataSource = dt;
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmployeeIDP", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void btn_SAVE_Click1(object sender, EventArgs e)
    {
        try
        {
            string s = Convert.ToString(txt_description.Text);
            if (s.Length > 1000)
            {
                Pms_Bll.ShowMessage(this, "Description Cannot Greater Than 1000 Characters");
                return;
            }


            _obj_idp                     = new pms_IDPSCREEN();
            _obj_idp.IDP_MODE            = 10;
            _obj_idp.IDP_NAME            = Pms_Bll.ReplaceQuote(Convert.ToString(txt_valname.Text));
            _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable dt = Pms_Bll.get_idp(_obj_idp);
            if (Convert.ToInt32(dt.Rows[0]["Count"]) != 0)
            {
                Pms_Bll.ShowMessage(this, "Value Already Exist");
                return;
            }
            else
            {
                _obj_idp.IDP_MODE            = 4;
                _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                _obj_idp.IDP_BU_ID           = Convert.ToInt32(rcmb_BUI.SelectedValue);
                _obj_idp.IDP_NAME            = Pms_Bll.ReplaceQuote(Convert.ToString(txt_valname.Text));
                _obj_idp.IDP_DESCRIPTION     = Pms_Bll.ReplaceQuote(Convert.ToString(txt_description.Text));
                //_obj_idp.IDP_STATUS = 1;
                if (chkbx_status.Checked)
                {
                    _obj_idp.IDP_STATUS = 0;
                }
                else
                {
                    _obj_idp.IDP_STATUS = 1;
                }
                _obj_idp.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
                _obj_idp.LASTMDFDATE = DateTime.Now;
                _obj_idp.CREATEDBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
                _obj_idp.CREATEDDATE = DateTime.Now;

                bool status = Pms_Bll.set_idp(_obj_idp);
                if (status == true)
                {
                    Pms_Bll.ShowMessage(this, "Value Inserted Successfully");
                    loadgrid();
                    clearfields();
                    RM_VALUESform.SelectedIndex = 0;
                    return;
                }
                else
                {
                    Pms_Bll.ShowMessage(this, "Unable to Update the record, Execption Occured");
                    return;
                }
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Valuesform", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    /// <summary>
    /// Here Edit a Particular Record..
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Edit_Commnad(object sender, CommandEventArgs e)
    {
        try
        {
            clearfields();
            _obj_idp          = new pms_IDPSCREEN();
            _obj_idp.IDP_MODE = 2;
            _obj_idp.IDP_ID   = Convert.ToInt32(e.CommandArgument);
            DataTable DT = Pms_Bll.get_idp(_obj_idp);
            if (DT.Rows.Count != 0)
            {
                lbl_id.Text                  = Convert.ToString(DT.Rows[0]["IDP_ID"]);
                Session["empid1"]            = (DT.Rows[0]["IDP_EMP_ID"]);
                _obj_idp                     = new pms_IDPSCREEN();
                _obj_idp.IDP_MODE            = 6;
                _obj_idp.IDP_EMP_ID          = Convert.ToInt32(Convert.ToString(DT.Rows[0]["IDP_EMP_ID"]));
                _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                DataTable dt_Bus = Pms_Bll.get_idp(_obj_idp);
                loadBusinessUnit();

                if (dt_Bus.Rows.Count != 0)
                {
                    RCB_BusinessUnit.SelectedIndex = RCB_BusinessUnit.Items.FindItemIndexByValue(Convert.ToString(dt_Bus.Rows[0]["EMP_BUSINESSUNIT_ID"]));
                }
                //LoadEmployees();

                _obj_Pms_EmpSetup = new PMS_EMPSETUP();

                _obj_PMS_getemployee = new PMS_GETEMPLOYEE();

                if ((Convert.ToString(Session["EMP_TYPE"])) == "5")
                {
                    _obj_PMS_getemployee.EMP_ID = Convert.ToInt32(Session["EMP_ID"]);
                }
                else
                {
                    _obj_PMS_getemployee.EMP_ID = Convert.ToInt32(Session["EMP_ID"]);
                }

                _obj_PMS_getemployee.LASTMDFBY = Convert.ToInt32(Session["ORG_ID"]);
                _obj_PMS_getemployee.BU_ID     = Convert.ToInt32(RCB_BusinessUnit.SelectedItem.Value);
                _obj_PMS_getemployee.Mode      = 5;
                DataTable dtbuid = Pms_Bll.get_RMEmployees(_obj_PMS_getemployee);



                if (dtbuid.Rows.Count != 0)
                {
                    RCB_EmployeeName.DataSource     = dtbuid;
                    RCB_EmployeeName.DataTextField  = "employee";
                    RCB_EmployeeName.DataValueField = "EMPID";
                    RCB_EmployeeName.DataBind();
                    RCB_EmployeeName.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0"));
                    //RCB_BusinessUnit.Visible = false;
                    //lbl_BusinessUnit.Visible = false;
                }
                else
                {
                    DataTable dt1 = new DataTable();

                    RCB_EmployeeName.DataSource = dt1;
                    RCB_EmployeeName.DataBind();
                    //lbl_BusinessUnit.Visible = false;
                    //RCB_BusinessUnit.Visible = false;
                }
                RCB_EmployeeName.SelectedIndex = RCB_EmployeeName.Items.FindItemIndexByValue(Convert.ToString(DT.Rows[0]["IDP_EMP_ID"]));
                //LoadAppraisalCycle1();
                //rcm_apprcycle.SelectedIndex = rcm_apprcycle.Items.FindItemIndexByValue(Convert.ToString(DT.Rows[0]["IDP_APPRAISALCYCLE"]));
                txt_IDP.Text               = Pms_Bll.ReplaceQuote(Convert.ToString(DT.Rows[0]["IDP_NAME"]));
                txt_Description.Text       = Pms_Bll.ReplaceQuote(Convert.ToString(DT.Rows[0]["IDP_DESCRIPTION"]));
                RDP_StartDate.SelectedDate = Convert.ToDateTime(DT.Rows[0]["IDP_STARTDATE"]);
                //RDP_EndDate.SelectedDate = Convert.ToDateTime(DT.Rows[0]["IDP_ENDDATE"]);
                txt_Comments.Text = Convert.ToString(DT.Rows[0]["IDP_COMMENTS"]);
                if (DT.Rows[0]["IDP_STATUS"] != System.DBNull.Value)
                {
                    if (Convert.ToString(DT.Rows[0]["IDP_STATUS"]).Trim() == "Active")
                    {
                        rcmb_status.SelectedValue = "1";
                    }
                    else
                    {
                        rcmb_status.SelectedValue = "0";
                    }
                }
                else
                {
                    rcmb_status.SelectedValue = "0";
                }
                RM_Idpform.SelectedIndex = 1;
                RP_Idpform.Visible       = false;
                RP_Idpform2.Visible      = true;
                btn_SAVE.Visible         = false;
                btn_UPDATE.Visible       = true;
                RCB_BusinessUnit.Enabled = false;
                RCB_EmployeeName.Enabled = false;
                txt_IDP.Enabled          = false;
                //lbl_BusinessUnit.Visible = false;
                //RCB_BusinessUnit.Visible = false;
                txt_Comments.Enabled  = true;
                RDP_StartDate.Enabled = false;
                //RDP_EndDate.Enabled = true;
                //rcm_apprcycle.Enabled = false;
                if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
                {
                    btn_UPDATE.Visible = false;
                }
                else
                {
                    btn_UPDATE.Visible = true;
                    if (rcmb_status.SelectedValue == "0")
                    {
                        BLL.ShowMessage(this, "IDP is Inactive.You can not Update the record.");
                        btn_UPDATE.Visible = false;
                    }
                }
            }

            else
            {
            }
        }

        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_idp", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    /// <summary>
    /// Here Insert a Record..
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SAVE_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_idp                     = new pms_IDPSCREEN();
            _obj_idp.IDP_MODE            = 7;
            _obj_idp.IDP_NAME            = Pms_Bll.ReplaceQuote(Convert.ToString(txt_IDP.Text));
            _obj_idp.IDP_EMP_ID          = Convert.ToInt32(RCB_EmployeeName.SelectedItem.Value);
            _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable dt = Pms_Bll.get_idp(_obj_idp);
            if (dt.Rows.Count != 0)
            {
                Pms_Bll.ShowMessage(this, "IDP Already Exist");
                return;
            }
            else
            {
                //COMMENTED ON 11.01.2012
                //if (Convert.ToDateTime(Convert.ToDateTime(RDP_StartDate.SelectedDate).ToShortDateString()) < Convert.ToDateTime(DateTime.Now.Date))
                //{
                //    RDP_StartDate.Clear();
                //    //RDP_EndDate.Clear();
                //    Pms_Bll.ShowMessage(this, "StartDate Should Be Greater Than Current Date");
                //    return;
                //}

                //COMMENTED ON 23.12.2011
                //PMS_Appraisalcycle _obj_Pms_Appraisalcycle = new PMS_Appraisalcycle();
                ////_obj_Pms_Appraisalcycle.MODE = 11;
                ////_obj_Pms_Appraisalcycle.APPRCYCLE_ID = Convert.ToInt32(Session["EMP_ID"]);//where i am passing employee to get bunit
                ////_obj_Pms_Appraisalcycle.APPRCYCLE_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
                ////DataTable dtem = Pms_Bll.get_Appraisalcycle(_obj_Pms_Appraisalcycle);


                //_obj_Pms_Appraisalcycle.MODE = 7;
                ////if (dtem.Rows.Count != 0)
                ////{
                //    _obj_Pms_Appraisalcycle.APPRCYCLE_BU_ID = Convert.ToInt32(RCB_BusinessUnit.SelectedItem.Value);
                ////}
                ////else
                ////{
                ////    _obj_Pms_Appraisalcycle.APPRCYCLE_BU_ID = 0;
                ////}


                //_obj_Pms_Appraisalcycle.APPRCYCLE_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
                //DataTable dt22 = Pms_Bll.get_Appraisalcycle(_obj_Pms_Appraisalcycle);



                //    DateTime dt_st = Convert.ToDateTime(dt22.Rows[0]["APPCYCLE_STARTDATE"]);
                //    DateTime dt_et = Convert.ToDateTime(dt22.Rows[0]["APPCYCLE_ENDDATE"]);


                //    if ((RDP_StartDate.SelectedDate.Value > dt_et) || (RDP_StartDate.SelectedDate.Value < dt_st))
                //    {
                //        BLL.ShowMessage(this, "Date Should Validate With Appraisal Cycle Date");
                //        return;
                //    }
                //    if ((RDP_EndDate.SelectedDate.Value > dt_et) || (RDP_EndDate.SelectedDate.Value < dt_st))
                //    {
                //        BLL.ShowMessage(this, "Date Should Validate With Appraisal Cycle Date");
                //        return;
                //    }

                if (txt_Comments.Text.Length > 1000)
                {
                    BLL.ShowMessage(this, "Comments length should be Less Than 1000.");
                    return;
                }
                if (txt_IDP.Text.Length > 1000)
                {
                    BLL.ShowMessage(this, "IDP length should be Less Than 1000.");
                    return;
                }
                if (txt_Description.Text.Length > 1000)
                {
                    BLL.ShowMessage(this, "Description length should be Less Than 1000.");
                    return;
                }
                _obj_idp          = new pms_IDPSCREEN();
                _obj_idp.IDP_MODE = 4;

                _obj_idp.IDP_EMP_ID      = Convert.ToInt32(RCB_EmployeeName.SelectedValue);
                _obj_idp.IDP_NAME        = Pms_Bll.ReplaceQuote(Convert.ToString(txt_IDP.Text));
                _obj_idp.IDP_DESCRIPTION = Pms_Bll.ReplaceQuote(Convert.ToString(txt_Description.Text));
                _obj_idp.IDP_STARTDATE   = RDP_StartDate.SelectedDate.Value;
                //_obj_idp.IDP_ENDDATE = RDP_EndDate.SelectedDate.Value;
                _obj_idp.LASTMDFBY   = Convert.ToInt32(Session["user_id"]);
                _obj_idp.LASTMDFDATE = DateTime.Now;
                _obj_idp.CREATEDBY   = Convert.ToInt32(Session["user_id"]);// ### Need to Get the Session
                _obj_idp.CREATEDDATE = DateTime.Now;
                //_obj_idp.IDP_APPRAISALCYCLE = Convert.ToInt32(rcm_apprcycle.SelectedItem.Value);
                _obj_idp.IDP_COMMENTS        = Convert.ToString(txt_Comments.Text.Replace("'", "''"));
                _obj_idp.IDP_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                _obj_idp.IDP_STATUS          = Convert.ToInt32(rcmb_status.SelectedItem.Text);
                bool status = Pms_Bll.set_idp(_obj_idp);
                if (status == true)
                {
                    Pms_Bll.ShowMessage(this, "IDP Inserted Succesfully");
                    loadgrid();
                    RG_Idpform.DataBind();
                    clearfields();



                    RM_Idpform.SelectedIndex = 0;
                    RP_Idpform.Visible       = true;
                    RP_Idpform2.Visible      = false;
                    return;
                }
            }
        }

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