protected void btnSubmit_OnClick(object sender, EventArgs e) { int res = 0; var oMatType = new TMSLibrary.MaterialType(); oMatType.MaterialTypeName = txtMaterialTypeName.Text; if (_matTypeId == 0) { res = MasterDataMethods.AddMaterialType(oMatType); } else if (_matTypeId > 0) { oMatType.MaterialTypeID = _matTypeId; res = MasterDataMethods.UpdateMaterialType(oMatType); } if (res > 0) { ClearInputs(Page.Controls); FillGrid(); _matTypeId = 0; ValidatePopup("Operation Successfull"); } else { ValidatePopup("Please Try Again"); } }
/// <summary> /// Adds a material type. /// </summary> /// <param name="oMatType"></param> /// <returns></returns> public static int AddMaterialType(MaterialType oMatType) { return TMSDataLibrary.MasterData.AddMaterialType(oMatType.MaterialTypeName); }
/// <summary> /// Updates a material type. /// </summary> /// <param name="oMatType"></param> /// <returns></returns> public static int UpdateMaterialType(MaterialType oMatType) { return TMSDataLibrary.MasterData.UpdateMaterialType(oMatType.MaterialTypeID, oMatType.MaterialTypeName); }
/// <summary> /// Get Materialtype list /// </summary> /// <returns></returns> public static List<MaterialType> GetAllMaterialtype() { List<MaterialType> materialTypelist = new List<MaterialType>(); DataTable dt = TMSDataLibrary.MasterData.GetMaterialType(); if (dt.Rows.Count > 0) { int count = dt.Rows.Count; for (int i = 0; i < count; i++) { MaterialType _materialtype = new MaterialType(); _materialtype.MaterialTypeID = Convert.ToInt32(dt.Rows[i][CONSTS.MaterialtypeColumnIndex.MaterialtypeId]); _materialtype.MaterialTypeName = (dt.Rows[i][CONSTS.MaterialtypeColumnIndex.MaterialtypeName]).ToString(); materialTypelist.Add(_materialtype); } } return materialTypelist; }