protected void lnk_Delete_Command(object sender, CommandEventArgs e) { try { _obj_Smhr_Holiday = new SMHR_HOLIDAY(); _obj_Smhr_Holiday.HOLMST_ID = Convert.ToInt32(Convert.ToString(e.CommandArgument)); lbl_HID = Convert.ToString(e.CommandArgument); DataTable dt = new DataTable(); _obj_Smhr_Holiday.OPERATION = operation.Delete; if (BLL.set_HolidayMaster(_obj_Smhr_Holiday)) { BLL.ShowMessage(this, "Row deleted Successfully"); } else { BLL.ShowMessage(this, "Row Could Not be Deleted"); } LoadMainGrid(); Rg_HolidayCalendar.DataBind(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_HolidayCalendar", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { //code for security privilage 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("Holiday Calender");//HOLIDAY"); 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 } } else { smhr_UNAUTHORIZED _obj_smhr_unauthorized = new smhr_UNAUTHORIZED(); _obj_smhr_unauthorized.UNAUTHORIZED_USERID = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_FORMID = Convert.ToInt32(ViewState["FORMS_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_MODULEID = Convert.ToInt32(ViewState["MODULE_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_ACCESSDATE = Convert.ToDateTime(DateTime.Now.ToString()); SMHR.BLL.UnAuthorized_Log(_obj_smhr_unauthorized); Response.Redirect("~/frm_UnAuthorized.aspx", false); } if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2) { Rg_HolidayCalendar.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; btn_Save.Visible = false; btn_Edit.Visible = false; } else if (Convert.ToInt32(Session["WRITEFACILITY"]) == 3) { smhr_UNAUTHORIZED _obj_smhr_unauthorized = new smhr_UNAUTHORIZED(); _obj_smhr_unauthorized.UNAUTHORIZED_USERID = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_FORMID = Convert.ToInt32(ViewState["FORMS_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_MODULEID = Convert.ToInt32(ViewState["MODULE_ID"]); _obj_smhr_unauthorized.UNAUTHORIZED_ACCESSDATE = Convert.ToDateTime(DateTime.Now.ToString()); SMHR.BLL.UnAuthorized_Log(_obj_smhr_unauthorized); Response.Redirect("~/frm_UnAuthorized.aspx", false); } LoadMainGrid(); Rg_HolidayCalendar.DataBind(); if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2) { for (int i = 0; i < Rg_HolidayCalendar.Items.Count; i++) { LinkButton lnkdel = new LinkButton(); lnkdel = (LinkButton)Rg_HolidayCalendar.Items[i].FindControl("lnk_Delete") as LinkButton; lnkdel.Visible = false; } } Page.Validate(); if (Request.QueryString["POP"] != null) { ((HtmlTableRow)Master.FindControl("M_Header")).Style.Add("display", "none"); ((HtmlTableRow)Master.FindControl("M_Footer")).Style.Add("display", "none"); ((RadMenu)Master.FindControl("MainMenu")).Style.Add("display", "none"); ((RadComboBox)Master.FindControl("cmbCulture")).Style.Add("display", "none"); ((LinkButton)Master.FindControl("Lnk_LogOut")).Style.Add("display", "none"); ((LinkButton)Master.FindControl("lnk_Home")).Style.Add("display", "none"); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_HolidayCalendar", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Save_Click(object sender, EventArgs e) { try { _obj_Smhr_Holiday = new SMHR_HOLIDAY(); _obj_Smhr_Holiday.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"].ToString()); _obj_Smhr_Holiday.HOLMST_BUSINESSUNITID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_Smhr_Holiday.HOLMST_CODE = Convert.ToString(rtxt_HCCode.Text); if (_obj_Smhr_Holiday.HOLMST_CODE.Contains("'")) { _obj_Smhr_Holiday.HOLMST_CODE = _obj_Smhr_Holiday.HOLMST_CODE.Replace("'", "''"); } _obj_Smhr_Holiday.HOLMST_DESCRIPTION = Convert.ToString(rtxt_HCDesc.Text); if (_obj_Smhr_Holiday.HOLMST_DESCRIPTION.Contains("'")) { _obj_Smhr_Holiday.HOLMST_DESCRIPTION = _obj_Smhr_Holiday.HOLMST_DESCRIPTION.Replace("'", "''"); } _obj_Smhr_Holiday.HOLMST_DATE = Convert.ToDateTime(rdtp_HCDATE.SelectedDate); _obj_Smhr_Holiday.HOLMST_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_Holiday.HOLMST_CREATEDDATE = DateTime.Now; _obj_Smhr_Holiday.HOLMST_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_Holiday.HOLMST_LASTMDFDATE = DateTime.Now; switch (((Button)sender).ID.ToUpper()) { case "BTN_SAVE": _obj_Smhr_Holiday.OPERATION = operation.Check; if (Convert.ToString(BLL.get_HolidayMaster(_obj_Smhr_Holiday).Rows[0][0]) != "0") { BLL.ShowMessage(this, "This Holiday Name Is Already Exists"); rtxt_HCCode.Text = String.Empty; return; } _obj_Smhr_Holiday.OPERATION = operation.Insert; if (BLL.set_HolidayMaster(_obj_Smhr_Holiday)) { BLL.ShowMessage(this, "Information Saved Successfully"); Rm_HolidayCalendar_page.SelectedIndex = 0; LoadMainGrid(); Rg_HolidayCalendar.DataBind(); } else { BLL.ShowMessage(this, "Information Not Saved"); } break; case "BTN_EDIT": _obj_Smhr_Holiday.HOLMST_ID = Convert.ToInt32(lbl_HID); _obj_Smhr_Holiday.OPERATION = operation.Check; if (Convert.ToString(BLL.get_HolidayMaster(_obj_Smhr_Holiday).Rows[0][0]) != "1") { BLL.ShowMessage(this, "This Holiday Name Is Already Exists"); rtxt_HCCode.Text = String.Empty; return; } _obj_Smhr_Holiday.OPERATION = operation.Update; if (BLL.set_HolidayMaster(_obj_Smhr_Holiday)) { BLL.ShowMessage(this, "Information Updated Successfully"); Rm_HolidayCalendar_page.SelectedIndex = 0; LoadMainGrid(); Rg_HolidayCalendar.DataBind(); } else { BLL.ShowMessage(this, "Information Not Saved"); } break; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_HolidayCalendar", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }