public IActionResult ManageInventory() { InventoryTransactionViewModel invVModel = new InventoryTransactionViewModel(); invVModel.ProductList = pService.FindProducts(); return(View("InventorySummaryUpdate", invVModel)); }
public IActionResult InventoryTransactionApproval([FromRoute] int id) { InventoryTransactionViewModel itVModel = new InventoryTransactionViewModel(); emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee; itVModel.employee = emp; itVModel.it = itService.FindInventoryTransaction(id); return(View("InventoryTransactionApprove", itVModel)); }
public async Task <IActionResult> CreateInventoryTransactionAsync([FromBody] InventoryTransactionViewModel value) { var response = new SingleModelResponse <InventoryTransactionViewModel>() as ISingleModelResponse <InventoryTransactionViewModel>; try { var entity = await Task.Run(() => { return(_RESTfulAPI_Repository.AddInventoryTransaction(value.ToEntity())); }); if (response.DidError == false) { response.Model = entity.ToViewModel(); } } catch (Exception ex) { string webRoot = _hostingEnvironment.WebRootPath; string errorGuid = String.Format(Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 16)); HttpContext.Session.SetString("ErrorGuid", errorGuid); ViewBag.ErrorGuid = HttpContext.Session.GetString("ErrorGuid"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { using (StreamWriter w = new StreamWriter(webRoot + "\\log.txt", append: true)) { Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid); } } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { using (StreamWriter w = new StreamWriter(webRoot + "/log.txt", append: true)) { Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid); } } response.DidError = true; //response.ErrorMessage = ex.ToString(); return(this.Json(new { timestamp = DateTime.Now, errorGuid = ViewBag.ErrorGuid, status = HttpStatusCode.InternalServerError, info = "Error logged in log file." })); } response.Info = "Client " + " " + HttpContext.Connection.RemoteIpAddress.ToString(); return(response.ToHttpResponse()); }
public IActionResult Save([FromBody] InventoryTransactionViewModel itVModel) { bool status = invtransService.CreateTransactionsManual2(itVModel.ProductList, itVModel.invQuantityTransList, itVModel.employee, itVModel.comments); if (status is true) { return(new JsonResult(new { success = "Success" })); } else { return(new JsonResult(new { success = "Failure" })); } }
public IActionResult RejectInventoryTransaction([FromBody] InventoryTransactionViewModel itVModel) { bool status = itService.RejectInventoryApproval(itVModel.it, itVModel.employee); if (status) { return(new JsonResult(new { success = "Success" })); } else { return(new JsonResult(new { success = "Failure" })); } }
public IActionResult UpdateInventoryLevels([FromBody] InventoryTransactionViewModel itVModel) { //bool status = invtransService.UpdateInventoryLevels(itVModel.ProductList, itVModel.invQuantityTransList, itVModel.employee); bool status = true; if (status is true) { return(new JsonResult(new { success = "Success" })); } else { return(new JsonResult(new { success = "Failure" })); } }
public IActionResult ListInventoryTransactionSummary() { emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee; InventoryTransactionViewModel itVModel = new InventoryTransactionViewModel(); itVModel.invTransList = invtransService.ListInventoryTransaction(); if (emp.EmployeeType.EmployeeTypeName == "Store Supervisor") { itVModel.invPendApprList = invtransService.ListITWithPendingApprovalLessThan250(); } else { itVModel.invPendApprList = invtransService.ListITWithPendingApprovalMoreThanOrEqual250(); } itVModel.employee = emp; return(View("InventoryTransactionSummary", itVModel)); }
/// <summary> /// /// </summary> /// <param name="viewModel"></param> /// <returns></returns> public static InventoryTransaction ToEntity(this InventoryTransactionViewModel viewModel) { return(viewModel == null ? null : new InventoryTransaction { Id = viewModel.Id, Transaction_Type = viewModel.Transaction_Type, Transaction_Created_Date = viewModel.Transaction_Created_Date, Transaction_Modified_Date = viewModel.Transaction_Modified_Date, Product_Id = viewModel.Product_Id, Quantity = viewModel.Quantity, Purchase_Order_Id = viewModel.Purchase_Order_Id, Customer_Order_Id = viewModel.Customer_Order_Id, Comments = viewModel.Comments // //RowGuid = viewModel.RowGuid, //ModifiedDate = viewModel.ModifiedDate }); }
public IActionResult CreateInventoryTransactions() { InventoryTransactionViewModel itVModel = new InventoryTransactionViewModel(); int idCheck = (int)HttpContext.Session.GetInt32("id"); if (HttpContext.Session.GetInt32("id") != null) { emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee; if (emp != null) { itVModel.employee = emp; } } List <Product> products = pService.FindProducts(); itVModel.ProductList = products; return(View("InventoryTransaction", itVModel)); }
public async Task <IActionResult> UpdateInventoryTransactionAsync(Int32 id, [FromBody] InventoryTransactionViewModel value) { var response = new SingleModelResponse <InventoryTransactionViewModel>() as ISingleModelResponse <InventoryTransactionViewModel>; try { var entity = await Task.Run(() => { return(_RESTfulAPI_Repository.UpdateInventoryTransaction(id, value.ToEntity())); }); response.Model = entity.ToViewModel(); response.Info = "The record was updated successfully"; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }