protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty((string)Session["CompanyId"]) && string.IsNullOrEmpty((string)Session["Username"])) { Response.Redirect("~/Default.aspx", false); } else { if (!IsPostBack) { DataTable dtRights = CommonClasses.Execute("select UR_RIGHTS from USER_RIGHT where UR_IS_DELETE=0 AND UR_UM_CODE='" + Convert.ToInt32(Session["UserCode"]) + "' and UR_SM_CODE='88'"); right = dtRights.Rows.Count == 0 ? "0000000" : dtRights.Rows[0][0].ToString(); try { if (Request.QueryString[0].Equals("VIEW")) { BL_ProcessMaster = new ProcessMaster_BL(); mlCode = Convert.ToInt32(Request.QueryString[1].ToString()); ViewRec("VIEW"); } else if (Request.QueryString[0].Equals("MODIFY")) { BL_ProcessMaster = new ProcessMaster_BL(); mlCode = Convert.ToInt32(Request.QueryString[1].ToString()); ViewRec("MOD"); } txtProcessName.Focus(); } catch (Exception ex) { CommonClasses.SendError("Process Master", "PageLoad", ex.Message); } } } }
protected void dgProcessMaster_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete")) { if (!ModifyLog(((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblProcess_CODE"))).Text)) { BL_ProcessMaster = new ProcessMaster_BL(); string Process_CODE = ((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblProcess_CODE"))).Text; string Process_NAME = ((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblProcess_NAME"))).Text; BL_ProcessMaster.PROCESS_CODE = Convert.ToInt32(Process_CODE); if (CommonClasses.CheckUsedInTran("SHADE_MASTER,SHADE_DETAIL", "SHM_PROCESS_CODE", "AND SHADE_MASTER.ES_DELETE=0 and SHM_CODE=SHD_SHM_CODE", Process_CODE)) { //ShowMessage("#Avisos", "You cant delete this record it has used in State Master", CommonClasses.MSG_Warning); PanelMsg.Visible = true; lblmsg.Text = "You cant delete this record it has used in Shade Creation"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); } else { bool flag = BL_ProcessMaster.Delete(); if (flag == true) { CommonClasses.WriteLog("Process Master", "Delete", "Process Master", Process_NAME, Convert.ToInt32(Process_CODE), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); //ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro); PanelMsg.Visible = true; lblmsg.Text = "Record Deleted Successfully"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); } } } LoadProcess(); } else { PanelMsg.Visible = true; lblmsg.Text = "You Have No Rights To Delete"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro); return; } } catch (Exception Ex) { CommonClasses.SendError("Process Master", "dgProcessMaster_RowDeleting", Ex.Message); } }
private void LoadProcess() { try { BL_ProcessMaster = new ProcessMaster_BL(); BL_ProcessMaster.PROCESS_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]); BL_ProcessMaster.FillGrid(dgProcessMaster); } catch (Exception Ex) { CommonClasses.SendError("Process Master", "LoadProcess", Ex.Message); } }
private void ViewRec(string str) { try { BL_ProcessMaster = new ProcessMaster_BL(mlCode); DataTable dt = new DataTable(); BL_ProcessMaster.GetInfo(); GetValues(str); if (str == "MOD") { CommonClasses.SetModifyLock("Process_MASTER", "MODIFY", "Process_CODE", mlCode); } } catch (Exception Ex) { CommonClasses.SendError("Process Master", "ViewRec", Ex.Message); } }
bool SaveRec() { bool result = false; try { string StrReplaceSctorName = txtProcessName.Text; StrReplaceSctorName = StrReplaceSctorName.Replace("'", "''"); if (Request.QueryString[0].Equals("INSERT")) { BL_ProcessMaster = new ProcessMaster_BL(); if (Setvalues()) { if (BL_ProcessMaster.Save()) { string Code = CommonClasses.GetMaxId("Select Max(Process_CODE) from Process_MASTER"); CommonClasses.WriteLog("Process Master", "Save", "Process Master", BL_ProcessMaster.PROCESS_NAME, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Admin/View/ViewProcessMaster.aspx", false); } else { if (BL_ProcessMaster.Msg != "") { //ShowMessage("#Avisos", BL_ProcessMaster.Msg.ToString(), CommonClasses.MSG_Warning); lblmsg.Text = "Record Already Exists"; PanelMsg.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert1();", true); BL_ProcessMaster.Msg = ""; } txtProcessName.Focus(); } } } else if (Request.QueryString[0].Equals("MODIFY")) { BL_ProcessMaster = new ProcessMaster_BL(mlCode); if (Setvalues()) { if (BL_ProcessMaster.Update()) { CommonClasses.RemoveModifyLock("Process_MASTER", "MODIFY", "Process_CODE", mlCode); CommonClasses.WriteLog("Process Master", "Update", "Process Master", BL_ProcessMaster.PROCESS_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Admin/View/ViewProcessMaster.aspx", false); } else { if (BL_ProcessMaster.Msg != "") { ShowMessage("#Avisos", BL_ProcessMaster.Msg.ToString(), CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); BL_ProcessMaster.Msg = ""; } txtProcessName.Focus(); } } } } catch (Exception ex) { CommonClasses.SendError("Process Master", "SaveRec", ex.Message); } return(result); }