public ActionResult ConfirmInventoryCheckResult(List <InventoryCheckViewModel> discrepancylist) { HttpContext.Application.Lock(); List <InventoryCheckViewModel> stockchecklist = HttpContext.Application["InventoryChecklist"] as List <InventoryCheckViewModel>; HttpContext.Application.UnLock(); foreach (var item in discrepancylist) { InventoryCheckViewModel vm = stockchecklist.Find(x => x.ItemCode == item.ItemCode); vm.Remarks = item.Remarks; } HttpContext.Application.Lock(); HttpContext.Application["InventoryChecklist"] = stockchecklist; HttpContext.Application.UnLock(); string requesterID = HttpContext.User.Identity.Name; using (TransactionScope ts = new TransactionScope()) { try { try { invetoryCheckService.SubmitAdjustmentVoucherForInventoryCheckDiscrepancy(stockchecklist, requesterID); } catch (EmailException e) { TempData["WarningMessage"] = "Failure to send email notification. Kindly contact IT personnel."; } invetoryCheckService.SaveInventoryCheckResult(stockchecklist); HttpContext.Application.Lock(); HttpContext.Application["InventoryChecklist"] = null; HttpContext.Application.UnLock(); ts.Complete(); TempData["SuccessMessage"] = "Stock check result has been submitted."; return(RedirectToAction("Index")); } catch (Exception e1) { TempData["ErrorMessage"] = "Error when submitting adjustment voucher"; } } return(RedirectToAction("ProcessInventoryCheck")); }
public void SaveTemporaryValue(List <InventoryCheckViewModel> checklist) { if (checklist != null || checklist.Count != 0) { HttpContext.Application.Lock(); List <InventoryCheckViewModel> stockchecklist = HttpContext.Application["InventoryChecklist"] as List <InventoryCheckViewModel>; HttpContext.Application.UnLock(); foreach (InventoryCheckViewModel item in checklist) { InventoryCheckViewModel vm = stockchecklist.Find(x => x.ItemCode == item.ItemCode); vm.ActualQuantity = item.ActualQuantity; } HttpContext.Application.Lock(); HttpContext.Application["InventoryChecklist"] = stockchecklist; HttpContext.Application.UnLock(); } }
private InventoryCheckViewModel ConvertToInventoryCheckViewModel(Inventory_Status_Record record) { Stationery s = stationeryService.FindStationeryByItemCode(record.itemCode); InventoryCheckViewModel vm = new InventoryCheckViewModel(); vm.ActualQuantity = record.discrepancyQty + record.onHandQty; vm.CategoryID = s.categoryID; vm.CategoryName = s.Category.categoryName; vm.Discrepancy = record.discrepancyQty; vm.ItemCode = record.itemCode; vm.Location = s.location; vm.Remarks = record.remarks; vm.StationeryDescription = s.description; vm.StockQuantity = record.onHandQty; vm.UOM = s.unitOfMeasure; vm.StockCheckDate = record.date; return(vm); }
public List <InventoryCheckViewModel> GetInventoryChecklistBasedOnCategory(int[] categoryID) { List <Stationery> stationeries = stationeryService.GetStationeriesBasedOnCategoryID(categoryID); List <InventoryCheckViewModel> vmList = new List <InventoryCheckViewModel>(); foreach (var s in stationeries) { InventoryCheckViewModel vm = new InventoryCheckViewModel(); vm.CategoryName = s.Category.categoryName; vm.CategoryID = s.categoryID; vm.StationeryDescription = s.description; vm.ItemCode = s.itemCode; vm.Location = s.location; vm.StockQuantity = s.stockQty; vm.UOM = s.unitOfMeasure; vm.ActualQuantity = s.stockQty; vm.StockCheckDate = DateTime.Today; vmList.Add(vm); } return(vmList); }