protected void btnSave_Click(object sender, EventArgs e) { InsTransferFunds _obj_InsTransferFunds = new InsTransferFunds(); try { switch (((Button)sender).ID.ToUpper()) { case "BTNUPDATE": if (rtxt_amounttransfer.Text == string.Empty) { BLL.ShowMessage(this, "Please enter Amount to Transfer"); return; } _obj_InsTransferFunds.TransferFundsAmount = Convert.ToInt32(rtxt_amounttransfer.Value); _obj_InsTransferFunds.TransferFundsPayItemID = Convert.ToInt32(rcmb_payitem.SelectedValue); _obj_InsTransferFunds.TransferFundsModifiedDate = Convert.ToDateTime(DateTime.Now); _obj_InsTransferFunds.TransferFundsModifiedBy = Convert.ToInt32(Session["EMP_ID"]); _obj_InsTransferFunds.TransferFundsID = Convert.ToInt32(ViewState["TransferFundsID"]); _obj_InsTransferFunds.OPERATION = operation.Update; if (BLL.set_InsTransferFunds(_obj_InsTransferFunds)) { BLL.ShowMessage(this, "Information Updated Successfully"); } else { BLL.ShowMessage(this, "Information Not Updated"); } rtxt_amounttransfer.Text = string.Empty; rm_MR_Page.SelectedIndex = 0; LoadGrid(); RG_transferfunds.DataBind(); break; case "BTNSAVE": //To validate BusinessUnit //if (BUFilter1.BusinessUnitID <= 0) //{ // BLL.ShowMessage(this, "Please select Business Unit"); // return; //} // if (BUFilter1.EmployeeID <= 0) //{ // BLL.ShowMessage(this, "Please select an Employee"); // return; //} if (rtxt_amounttransfer.Text == string.Empty) { BLL.ShowMessage(this, "Please enter Amount to Transfer"); return; } _obj_InsTransferFunds.TransferFundsCreatedBy = Convert.ToInt32(Session["EMP_ID"]); _obj_InsTransferFunds.TransferFundsOrgID = Convert.ToInt32(Session["ORG_ID"]); _obj_InsTransferFunds.TransferFundsBUID = Convert.ToInt32(BUFilter1.BusinessUnitID); _obj_InsTransferFunds.TransferFundsAmount = Convert.ToInt32(rtxt_amounttransfer.Value); _obj_InsTransferFunds.TransferFundsPayItemID = Convert.ToInt32(rcmb_payitem.SelectedValue); _obj_InsTransferFunds.TransferFundsCreatedDate = DateTime.Now; _obj_InsTransferFunds.TransferFundsEmpID = Convert.ToInt32(BUFilter1.EmployeeID); _obj_InsTransferFunds.OPERATION = operation.Insert; if (BLL.set_InsTransferFunds(_obj_InsTransferFunds)) { BLL.ShowMessage(this, "Information Saved Successfully"); } else { BLL.ShowMessage(this, "Information Not Saved"); } rtxt_amounttransfer.Text = string.Empty; rm_MR_Page.SelectedIndex = 0; LoadGrid(); RG_transferfunds.DataBind(); break; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InsuranceTransferFunds", 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("Insurance Transfer Amount"); 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_transferfunds.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; btnSave.Visible = false; btnUpdate.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); } LoadGrid(); //To populate grid //LoadPayItems(); RG_transferfunds.DataBind(); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InsuranceTransferFunds", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }