Esempio n. 1
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_Rec_Assessments = new RECRUITMENT_ASSESSMENTS();
            _obj_Rec_Assessments.ASSESSMENT_NAME = Convert.ToString(rtxt_Name.Text.Replace("'", "''"));
            _obj_Rec_Assessments.ASSESSMENT_DESC = Convert.ToString(rtxt_Desc.Text.Replace("'", "''"));
            _obj_Rec_Assessments.ASSESSMENT_TYPE = Convert.ToInt32(rcmb_Type.SelectedItem.Value);
            //_obj_Rec_Assessments.ASSESSMENT_APPLICABLEFOR = Convert.ToString(rcmb_ApplicableFor.SelectedItem.Text);
            _obj_Rec_Assessments.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_Rec_Assessments.CREATEDBY       = Convert.ToInt32(Session["USER_ID"]);
            _obj_Rec_Assessments.LASTMDFBY       = Convert.ToInt32(Session["USER_ID"]);
            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_UPDATE":
                _obj_Rec_Assessments.MODE = 5;
                if (Convert.ToString(Recruitment_BLL.get_Assessments(_obj_Rec_Assessments).Rows[0]["COUNT"]) != "1")
                {
                    BLL.ShowMessage(this, "Asset Name already exist for this type.");
                    return;
                }
                _obj_Rec_Assessments.MODE          = 2;
                _obj_Rec_Assessments.ASSESSMENT_ID = Convert.ToInt32(lbl_ID.Text);
                if (Recruitment_BLL.set_Assessments(_obj_Rec_Assessments))
                {
                    BLL.ShowMessage(this, "Information Updated Successfully.");
                }
                break;

            case "BTN_SAVE":
                _obj_Rec_Assessments.MODE = 5;
                if (Convert.ToString(Recruitment_BLL.get_Assessments(_obj_Rec_Assessments).Rows[0]["COUNT"]) != "0")
                {
                    BLL.ShowMessage(this, "Asset Name already exist for this type.");
                    return;
                }
                _obj_Rec_Assessments.MODE = 1;
                if (Recruitment_BLL.set_Assessments(_obj_Rec_Assessments))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully.");
                }
                break;
            }
            RMP_AssessmentType.SelectedIndex = 0;
            LoadGrid();
            return;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_AssessmentType", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }