public Notify Update(POS_DISPLAY_STOCK DisplayStockModel) { try { objNotify.RowEffected = _objDALDisplayStock.UpdateDisplayStock(DisplayStockModel); if (objNotify.RowEffected > 0) { objNotify.NotifyMessage = "Record Updated Successfully"; } else { objNotify.NotifyMessage = "Display Stock Not Updated"; } return(objNotify); } catch (Exception ex) { if (ex is DALException) { throw ex; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); } throw new BALException(ex.Message.ToString()); } }
public string GetMaxCode() { string code = string.Empty; int maxCode = 0; try { _objDisplayStockEntity = _dbContext.POS_DISPLAY_STOCK.OrderByDescending(x => x.DSTOCK_ID).FirstOrDefault(); if (_objDisplayStockEntity == null) { code = "0001"; } else { maxCode = Formatter.SetValidValueToInt(_objDisplayStockEntity.DSTOCK_ID) + 1; code = maxCode.ToString().PadLeft(4, '0'); } return(code); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new DALException(ex.Message.ToString()); } }
public POS_DISPLAY_STOCK GetById(long?id) { try { _objDisplayStockEntity = _dbContext.POS_DISPLAY_STOCK.Find(id); return(_objDisplayStockEntity); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new DALException(ex.Message.ToString()); } }
public ActionResult Edit(POS_DISPLAY_STOCK POS_DISPLAY_STOCK) { try { if (Session[SessionVariables.Session_UserInfo] != null) { POS_DISPLAY_STOCK.MODIFIEDBY = SessionHandling.UserInformation.USERNAME; POS_DISPLAY_STOCK.MODIFIEDWHEN = DateTime.Now; if (ModelState.IsValid) { objNotify = _objBALDisplayStock.Update(POS_DISPLAY_STOCK); if (objNotify.RowEffected > 0) { ShowAlert(AlertType.Success, objNotify.NotifyMessage); return(RedirectToAction("Index")); } else { ShowAlert(AlertType.Error, objNotify.NotifyMessage); } } else { return(View(POS_DISPLAY_STOCK)); } return(View(POS_DISPLAY_STOCK)); } else { return(RedirectToAction("Login", "Home")); } } catch (Exception ex) { error.Breadcrum = "Home > Inventory Management > DisplayStock > Edit"; if (ex is BALException) { error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer"; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.UI, ExceptionType.Error); error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer"; } return(RedirectToAction("ShowErrorPage", "Master", error)); } }
public int DeleteDisplayStock(long id) { int rowAffected = 0; try { _objDisplayStockEntity = _dbContext.POS_DISPLAY_STOCK.Find(id); _dbContext.POS_DISPLAY_STOCK.Remove(_objDisplayStockEntity); rowAffected = _dbContext.SaveChanges(); return(rowAffected); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new DALException(ex.Message.ToString()); } }
public POS_DISPLAY_STOCK GetById(long?id) { try { _objDisplayStockEntity = _objDALDisplayStock.GetById(id); return(_objDisplayStockEntity); } catch (Exception ex) { if (ex is DALException) { throw ex; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); } throw new BALException(ex.Message.ToString()); } }
// GET: /DisplayStock/Details/5 public ActionResult Details(long id) { try { if (Session[SessionVariables.Session_UserInfo] != null) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } POS_DISPLAY_STOCK POS_DISPLAY_STOCK = _objBALDisplayStock.GetById(id); if (POS_DISPLAY_STOCK == null) { return(HttpNotFound()); } return(View(POS_DISPLAY_STOCK)); } else { return(RedirectToAction("Login", "Home")); } } catch (Exception ex) { error.Breadcrum = "Home > Inventory Management > DisplayStock > Detail"; if (ex is BALException) { error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer"; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.UI, ExceptionType.Error); error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer"; } return(RedirectToAction("ShowErrorPage", "Master", error)); } }
public int CreateDisplayStock(POS_DISPLAY_STOCK DisplayStockModel) { int rowAffected = 0; POS_DISPLAY_STOCK _objDisplayStockEntity = new POS_DISPLAY_STOCK(); try { _objDisplayStockEntity.DSTOCK_CODE = GetMaxCode(); _objDisplayStockEntity.BRANCH_ID = DisplayStockModel.BRANCH_ID; _objDisplayStockEntity.SALE_CODE = DisplayStockModel.SALE_CODE; _objDisplayStockEntity.DATE = DisplayStockModel.DATE; _objDisplayStockEntity.PRODUCT_ID = DisplayStockModel.PRODUCT_ID; _objDisplayStockEntity.QUANTITY_IN = DisplayStockModel.QUANTITY_IN; _objDisplayStockEntity.QUANTITY_OUT = DisplayStockModel.QUANTITY_OUT; _objDisplayStockEntity.STOCK_TYPE = DisplayStockModel.STOCK_TYPE; _objDisplayStockEntity.UNIT_PRICE = DisplayStockModel.UNIT_PRICE; _objDisplayStockEntity.TOTAL_PRICE = DisplayStockModel.TOTAL_PRICE; _objDisplayStockEntity.WV_SHIPPMENT_CODE = DisplayStockModel.WV_SHIPPMENT_CODE; _objDisplayStockEntity.SHIPPMENT_FROM = DisplayStockModel.SHIPPMENT_FROM; _objDisplayStockEntity.WSTOCK_CODE = DisplayStockModel.WSTOCK_CODE; _objDisplayStockEntity.ISMANUAL_ENTRY = DisplayStockModel.ISMANUAL_ENTRY; _objDisplayStockEntity.ISPOSTED_FLAG = false; _objDisplayStockEntity.CREATEDBY = DisplayStockModel.CREATEDBY; _objDisplayStockEntity.CREATEDWHEN = DisplayStockModel.CREATEDWHEN; _dbContext.POS_DISPLAY_STOCK.Add(_objDisplayStockEntity); rowAffected = _dbContext.SaveChanges(); return(rowAffected); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new DALException(ex.Message.ToString()); } }
public long GetMaxId() { long id = 0; try { _objDisplayStockEntity = _dbContext.POS_DISPLAY_STOCK.OrderByDescending(x => x.DSTOCK_ID).FirstOrDefault(); if (_objDisplayStockEntity.DSTOCK_ID.ToString() == null) { id = 1; } else { id = _objDisplayStockEntity.DSTOCK_ID + 1; } return(id); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new DALException(ex.Message.ToString()); } }
public ActionResult GetStockDetail(long id) { POS_DISPLAY_STOCK entityDisplayStock = new POS_DISPLAY_STOCK(); return(PartialView("_StockDetail", entityDisplayStock)); }