public static bool UpdateMaterialType(ATTMaterialType objMT, Previlege pobj) { string UpdateSQL; UpdateSQL = "SP_EDIT_MATERIAL_TYPE"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Material Type."); } OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam(":p_MATERIAL_ID", objMT.MaterialID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_MATERIAL_TYPE_NAME", objMT.MaterialTypeName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_MATERIAL_DESCRIPTION", objMT.MaterialDescription, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw (ex); } finally { GetConn.CloseDbConn(); } }
public static bool UpdateMaterialType(ATTMaterialType objMT, Previlege pobj) { try { DLLMaterialType.UpdateMaterialType(objMT, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static ObjectValidation Validate(ATTMaterialType objMT) { ObjectValidation OV = new ObjectValidation(); if (objMT.MaterialTypeName == "") { OV.IsValid = false; OV.ErrorMessage = "Material Type cannot be blank."; return(OV); } return(OV); }
protected void lstMaterialType_SelectedIndexChanged(object sender, EventArgs e) { List <ATTMaterialType> lst = (List <ATTMaterialType>)Session["MaterialTypeList"]; ATTMaterialType MaterialType = lst.Find( delegate(ATTMaterialType MT) { return(MT.MaterialID == int.Parse(this.lstMaterialType.SelectedValue)); } ); this.txtMaterialTypeName_rqd.Text = MaterialType.MaterialTypeName; this.txtMaterialTypeDescription.Text = MaterialType.MaterialDescription; this.lblStatus.Text = ""; }
public static List <ATTMaterialType> GetMaterialType() { List <ATTMaterialType> MaterialTypeLST = new List <ATTMaterialType>(); foreach (DataRow row in DLLMaterialType.GetMaterialTypeTable().Rows) { ATTMaterialType MT = new ATTMaterialType(int.Parse(row["MT_ID"].ToString()), row["MT_NAME"].ToString(), "empty", row["DESCRIPTION"].ToString() ); MaterialTypeLST.Add(MT); } return(MaterialTypeLST); }
protected void btnAdd_Click(object sender, EventArgs e) { ATTMaterialType ObjMT; if (lstMaterialType.SelectedIndex == -1) { ObjMT = new ATTMaterialType(0, txtMaterialTypeName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtMaterialTypeDescription.Text); } else { ObjMT = new ATTMaterialType(int.Parse(lstMaterialType.SelectedValue), txtMaterialTypeName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtMaterialTypeDescription.Text); } ObjectValidation OV = BLLMaterialType.Validate(ObjMT); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTMaterialType> ltMaterialType = (List <ATTMaterialType>)Session["MaterialTypeList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (lstMaterialType.SelectedIndex == -1) { if (user.MenuList["4,3,1"] == null || user.MenuList["4,3,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Material Type."; return; } Previlege pobj = new Previlege(user.UserName, "4,3,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); if (BLLMaterialType.AddMaterialType(ObjMT, pobj)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); ltMaterialType.Add(ObjMT); lblStatus.Text = "New Record Added Successfully !!!"; } } else { List <ATTMaterialType> lst = (List <ATTMaterialType>)Session["MaterialTypeList"]; ATTMaterialType MaterialType = lst.Find( delegate(ATTMaterialType MT) { return(MT.MaterialID == int.Parse(this.lstMaterialType.SelectedValue)); } ); if ((txtMaterialTypeName_rqd.Text == MaterialType.MaterialTypeName) && (txtMaterialTypeDescription.Text == MaterialType.MaterialDescription)) { lblStatus.Text = "Please Change Data to Update !!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); } else { if (user.MenuList["4,3,1"] == null || user.MenuList[Session["List_Menuname"].ToString()].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Material Type."; return; } Previlege pobj = new Previlege(user.UserName, "4,3,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); if (BLLMaterialType.UpdateMaterialType(ObjMT, pobj)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); ltMaterialType[this.lstMaterialType.SelectedIndex] = ObjMT; lblStatus.Text = "Existing Record Updated Successfully !!!"; } } } this.lstMaterialType.DataSource = ltMaterialType; this.lstMaterialType.DataTextField = "MaterialTypeName"; this.lstMaterialType.DataValueField = "MaterialID"; this.lstMaterialType.DataBind(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); this.lblStatus.Text = ex.Message; } }