public JsonResult RemoveIssueDetail(int id) { var item = InventoryIssueDetail.Find(id); using (var scope = new TransactionScope()) { item.DeleteAndFlush(); } return(Json(new { id = id, result = true })); }
public JsonResult EditIssueDetailQuantity(int id, decimal value) { var detail = InventoryIssueDetail.Find(id); if (value >= 0) { detail.Quantity = value; using (var scope = new TransactionScope()) { detail.UpdateAndFlush(); } } return(Json(new { id = id, value = detail.Quantity })); }
public JsonResult AddIssueDetail(int movement, int product) { var p = Product.Find(product); var item = new InventoryIssueDetail { Issue = InventoryIssue.Find(movement), Product = p, ProductCode = p.Code, ProductName = p.Name, Quantity = 1 }; using (var scope = new TransactionScope()) { item.CreateAndFlush(); } return(Json(new { id = item.Id })); }
public JsonResult AddIssueDetail(int movement, int product) { var p = Product.Find (product); var item = new InventoryIssueDetail { Issue = InventoryIssue.Find (movement), Product = p, ProductCode = p.Code, ProductName = p.Name, Quantity = 1 }; using (var scope = new TransactionScope ()) { item.CreateAndFlush (); } return Json (new { id = item.Id }); }
public ActionResult GetIssueItem(int id) { return(PartialView("Issues/_DetailEditView", InventoryIssueDetail.Find(id))); }
public ActionResult ConfirmReturn(int id) { var item = SupplierReturn.Find (id); var qry = from x in item.Details where x.Order.Id == id group x by x.Warehouse into g select new { Warehouse = g.Key, Details = g.ToList () }; var dt = DateTime.Now; var employee = CurrentUser.Employee; using (var scope = new TransactionScope ()) { foreach (var x in qry) { var master = new InventoryIssue { Return = item, Warehouse = x.Warehouse, CreationTime = dt, ModificationTime = dt, Creator = employee, Updater = employee, Comment = string.Format (Resources.Message_SupplierReturn, item.Supplier.Name, item.PurchaseOrder.Id, item.Id) }; master.Create (); foreach (var y in x.Details) { var detail = new InventoryIssueDetail { Issue = master, Product = y.Product, Quantity = y.Quantity, ProductCode = y.ProductCode, ProductName = y.ProductName }; detail.Create (); } } item.IsCompleted = true; item.UpdateAndFlush (); } return RedirectToAction ("Index"); }