protected void imgbtnfrDelete_Click(object sender, ImageClickEventArgs e) { cmdMode = CommandMode.D; objItemUnit = new Store.ItemUnit.BusinessObject.ItemUnit(); oblItemUnit = new Store.ItemUnit.BusinessLogic.ItemUnit(); try { ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; objItemUnit.UnitID = Convert.ToInt32(dgvItemUnit.DataKeys[gvrow.RowIndex].Value.ToString()); objItemUnit.UnitName = ""; //objItemUnit.CategoryID = 1; objItemUnit.CreatedBy = 1; objMessageInfo = oblItemUnit.ManageItemMaster(objItemUnit, cmdMode); BindItemUnit(); updateItemUnitBdInfo.Update(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('" + objMessageInfo.TranMessage + "')", true); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); } finally { objItemUnit = null; //objMessageInfo = null; oblItemUnit = null; } }
//void BindCategory() //{ // oblCategory = new Store.Category.BusinessLogic.Category(); // try // { // obCategoryList = oblCategory.GetAllCategoryList(0, 0, ""); // if (obCategoryList != null) // { // ddlCategory.DataSource = obCategoryList; // ddlCategory.DataTextField = "CategoryName"; // ddlCategory.DataValueField = "CategoryID"; // ddlCategory.DataBind(); // ddlCategory.Items.Insert(0, "<--Select Category-->"); // } // else // { // ddlCategory.DataSource = null; // ddlCategory.DataBind(); // } // } // catch (Exception ex) // { // Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); // } // finally // { // oblCategory = null; // obCategoryList = null; // } //} void ManageItemUnit() { objItemUnit = new Store.ItemUnit.BusinessObject.ItemUnit(); oblItemUnit = new Store.ItemUnit.BusinessLogic.ItemUnit(); try { if (cmdMode == Store.Common.CommandMode.M) { objItemUnit.UnitID = Convert.ToInt32(txtUnitId.Text); //objItemUnit.ModifiedBy = Convert.ToInt32(Session["UserId"]); } else { objItemUnit.UnitID = 0; //objItemUnit.CreatedBy = Convert.ToInt32(Session["UserId"]); } objItemUnit.UnitName = Convert.ToString(txtUnitName.Text); //objItemUnit.CategoryID = Convert.ToInt32(ddlCategory.SelectedItem.Value); objMessageInfo = oblItemUnit.ManageItemMaster(objItemUnit, cmdMode); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); } finally { objItemUnit = null; //objMessageInfo = null; oblItemUnit = null; } }
public Store.Common.MessageInfo ManageItemMaster(Store.ItemUnit.BusinessObject.ItemUnit objItemUnit, CommandMode cmdMode) { try { return(odlItemUnit.ManageItemUnit(objItemUnit, cmdMode)); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); return(null); } }
public Store.Common.MessageInfo ManageItemUnit(Store.ItemUnit.BusinessObject.ItemUnit objItemUnit, CommandMode cmdMode) { string SQL = ""; ParameterList param = new ParameterList(); DataTableReader dr; Store.Common.MessageInfo objMessageInfo = null; try { SQL = "USP_ManageItemMeasurementUnit"; param.Add(new SQLParameter("@UnitID", objItemUnit.UnitID)); param.Add(new SQLParameter("@UnitName", objItemUnit.UnitName)); //param.Add(new SQLParameter("@CategoryID", objItemUnit.CategoryID)); if (cmdMode == CommandMode.N) { param.Add(new SQLParameter("@UserId", objItemUnit.CreatedBy)); } else { param.Add(new SQLParameter("@UserId", objItemUnit.ModifiedBy)); } param.Add(new SQLParameter("@ReferenceID", objItemUnit.ReferenceID)); param.Add(new SQLParameter("@CMDMode", cmdMode)); dr = ExecuteQuery.ExecuteReader(SQL, param); if (dr.Read()) { objMessageInfo = new Store.Common.MessageInfo(); objMessageInfo.ErrorCode = Convert.ToInt32(dr["ErrorCode"]); objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]); objMessageInfo.TranID = Convert.ToInt32(dr["TranID"]); objMessageInfo.TranCode = Convert.ToString(dr["TranCode"]); objMessageInfo.TranMessage = Convert.ToString(dr["TranMessage"]); } } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); } return(objMessageInfo); }
public Store.ItemUnit.BusinessObject.ItemUnit GetAllItemUnit(int UnitID, int Flag, string FlagValue) { Store.ItemUnit.BusinessObject.ItemUnit objItemUnit = null; string SQL = string.Empty; ParameterList paramList = new ParameterList(); DataTableReader dr; try { SQL = "proc_UnitName"; paramList.Add(new SQLParameter("@UnitID", UnitID)); paramList.Add(new SQLParameter("@Flag", Flag)); paramList.Add(new SQLParameter("@FlagValue", FlagValue)); dr = ExecuteQuery.ExecuteReader(SQL, paramList); while (dr.Read()) { objItemUnit = new BusinessObject.ItemUnit(); if (dr.IsDBNull(dr.GetOrdinal("UnitID")) == false) { objItemUnit.UnitID = dr.GetInt32(dr.GetOrdinal("UnitID")); } if (dr.IsDBNull(dr.GetOrdinal("UnitName")) == false) { objItemUnit.UnitName = dr.GetString(dr.GetOrdinal("UnitName")); } //if (dr.IsDBNull(dr.GetOrdinal("CategoryID")) == false) //{ // objItemUnit.CategoryID = dr.GetInt32(dr.GetOrdinal("CategoryID")); //} //if (dr.IsDBNull(dr.GetOrdinal("CategoryName")) == false) //{ // objItemUnit.CategoryName = dr.GetString(dr.GetOrdinal("CategoryName")); //} if (dr.IsDBNull(dr.GetOrdinal("CreatedBy")) == false) { objItemUnit.CreatedBy = dr.GetInt32(dr.GetOrdinal("CreatedBy")); } if (dr.IsDBNull(dr.GetOrdinal("CreatedOn")) == false) { objItemUnit.CreatedOn = dr.GetDateTime(dr.GetOrdinal("CreatedOn")); } if (dr.IsDBNull(dr.GetOrdinal("ModifiedBy")) == false) { objItemUnit.ModifiedBy = dr.GetInt32(dr.GetOrdinal("ModifiedBy")); } if (dr.IsDBNull(dr.GetOrdinal("ModifiedOn")) == false) { objItemUnit.ModifiedOn = dr.GetDateTime(dr.GetOrdinal("ModifiedOn")); } if (dr.IsDBNull(dr.GetOrdinal("ReferenceID")) == false) { objItemUnit.ReferenceID = dr.GetInt32(dr.GetOrdinal("ReferenceID")); } dr.Close(); } } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemUnit).FullName, 1); } return(objItemUnit); }