/// <summary> /// Here loadgrid() method for load a grid... /// </summary> protected void loadgrid() { 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; RG_Idpform.DataBind(); } else { DataTable dt1 = new DataTable(); RG_Idpform.DataSource = dt1; RG_Idpform.DataBind(); } } 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"); } }
/// <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"); } }
/// <summary> /// Here Page_Load Method...For Load a Page.. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { Session.Remove("WRITEFACILITY"); SMHR_LOGININFO _obj_Smhr_LoginInfo = new SMHR_LOGININFO(); _obj_Smhr_LoginInfo.OPERATION = operation.Empty1; _obj_Smhr_LoginInfo.LOGIN_USERNAME = Convert.ToString(Session["USERNAME"]).Trim(); _obj_Smhr_LoginInfo.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_Smhr_LoginInfo.LOGIN_PASS_CODE = Convert.ToString("IDP"); DataTable dtformdtls = BLL.get_LoginInfo(_obj_Smhr_LoginInfo); if (dtformdtls.Rows.Count != 0) { if ((Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_READ"]) == true) && (Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_WRITE"]) == true)) { Session["WRITEFACILITY"] = 1;//WHICH MEANS READ AND WRITE } else if ((Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_READ"]) == true) && (Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_WRITE"]) == false)) { Session["WRITEFACILITY"] = 2;//WHICH MEANS READ NO WRITE } else if ((Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_READ"]) == false) && (Convert.ToBoolean(dtformdtls.Rows[0]["TYPSEC_WRITE"]) == false)) { Session["WRITEFACILITY"] = 3;//WHICH MEANS NO READ AND NO WRITE } } if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2) { RG_Idpform.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; } clearfields(); loadgrid(); RG_Idpform.DataBind(); RM_Idpform.SelectedIndex = 0; RP_Idpform.Visible = true; RP_Idpform2.Visible = false; } Page.Validate(); //RDP_StartDate.MinDate = DateTime.Now; //RDP_EndDate.MinDate = DateTime.Now; } 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"); } }