public JsonResult RemoveTransferDetail(int id) { var item = InventoryTransferDetail.Find(id); using (var scope = new TransactionScope()) { item.DeleteAndFlush(); } return(Json(new { id = id, result = true })); }
public ActionResult AddTransferItems(int id, string value) { var entity = InventoryTransfer.Find(id); SalesOrder sales_order = null; int sales_order_id = 0; int count = 0; if (entity.IsCompleted || entity.IsCancelled) { Response.StatusCode = 400; return(Content(Resources.ItemAlreadyCompletedOrCancelled)); } if (int.TryParse(value, out sales_order_id)) { sales_order = SalesOrder.TryFind(sales_order_id); } if (sales_order == null) { Response.StatusCode = 400; return(Content(Resources.SalesOrderNotFound)); } using (var scope = new TransactionScope()) { foreach (var x in sales_order.Details) { if (!x.Product.IsStockable) { continue; } var item = new InventoryTransferDetail { Transfer = entity, Product = x.Product, ProductCode = x.ProductCode, ProductName = x.ProductName, Quantity = x.Quantity, }; item.Create(); count++; } } return(Json(new { id = id, value = string.Empty, itemsChanged = count })); }
public JsonResult EditTransferDetailQuantity(int id, decimal value) { var detail = InventoryTransferDetail.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 AddTransferDetail(int movement, int product) { var p = Product.Find(product); var item = new InventoryTransferDetail { Transfer = InventoryTransfer.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 GetTransferItem(int id) { return(PartialView("Transfers/_DetailEditView", InventoryTransferDetail.Find(id))); }
public ActionResult AddTransferItems(int id, string value) { var entity = InventoryTransfer.Find (id); SalesOrder sales_order = null; int sales_order_id = 0; int count = 0; if (entity.IsCompleted || entity.IsCancelled) { Response.StatusCode = 400; return Content (Resources.ItemAlreadyCompletedOrCancelled); } if (int.TryParse (value, out sales_order_id)) { sales_order = SalesOrder.TryFind (sales_order_id); } if (sales_order == null) { Response.StatusCode = 400; return Content (Resources.SalesOrderNotFound); } using (var scope = new TransactionScope ()) { foreach (var x in sales_order.Details) { if (!x.Product.IsStockable) continue; var item = new InventoryTransferDetail { Transfer = entity, Product = x.Product, ProductCode = x.ProductCode, ProductName = x.ProductName, Quantity = x.Quantity, }; item.Create (); count++; } } return Json (new { id = id, value = string.Empty, itemsChanged = count }); }
public JsonResult AddTransferDetail(int movement, int product) { var p = Product.Find (product); var item = new InventoryTransferDetail { Transfer = InventoryTransfer.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 }); }