public dynamic Delete(PurchaseReceival model) { try { if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.PurchaseReceival, Core.Constants.Constant.MenuGroupName.Transaction)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Delete Record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } var data = _purchaseReceivalService.GetObjectById(model.Id); model = _purchaseReceivalService.SoftDeleteObject(data, _purchaseReceivalDetailService); } catch (Exception ex) { LOG.Error("Delete Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public dynamic Delete(PurchaseReceival model) { try { var data = _purchaseReceivalService.GetObjectById(model.Id); model = _purchaseReceivalService.SoftDeleteObject(data, _purchaseReceivalDetailService); } catch (Exception ex) { LOG.Error("Delete Failed", ex); model.Errors.Add("Generic", "Error : " + ex); } return(Json(new { model.Errors })); }
void purchasereceival_validation() { it["validates_all_variables"] = () => { contact.Errors.Count().should_be(0); item_batiktulis.Errors.Count().should_be(0); item_busway.Errors.Count().should_be(0); item_botolaqua.Errors.Count().should_be(0); purchaseOrder1.Errors.Count().should_be(0); purchaseOrder2.Errors.Count().should_be(0); }; it["validates the item pending receival"] = () => { item_batiktulis.PendingReceival.should_be(purchaseOrderDetail_batiktulis_so1.Quantity + purchaseOrderDetail_batiktulis_so2.Quantity); item_busway.PendingReceival.should_be(purchaseOrderDetail_busway_so1.Quantity + purchaseOrderDetail_busway_so2.Quantity); item_botolaqua.PendingReceival.should_be(purchaseOrderDetail_botolaqua_so1.Quantity + purchaseOrderDetail_botolaqua_so2.Quantity); }; context["when confirming purchase receival"] = () => { before = () => { purchaseReceival1 = _purchaseReceivalService.CreateObject(warehouse.Id, purchaseOrder1.Id, new DateTime(2000, 1, 1), _purchaseOrderService, _warehouseService); purchaseReceival2 = _purchaseReceivalService.CreateObject(warehouse.Id, purchaseOrder2.Id, new DateTime(2014, 5, 5), _purchaseOrderService, _warehouseService); purchaseReceival3 = _purchaseReceivalService.CreateObject(warehouse.Id, purchaseOrder1.Id, new DateTime(2014, 5, 5), _purchaseOrderService, _warehouseService); purchaseReceivalDetail_batiktulis_do1 = _purchaseReceivalDetailService.CreateObject(purchaseReceival1.Id, item_batiktulis.Id, 400, purchaseOrderDetail_batiktulis_so1.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_busway_do1 = _purchaseReceivalDetailService.CreateObject(purchaseReceival1.Id, item_busway.Id, 91, purchaseOrderDetail_busway_so1.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_botolaqua_do1 = _purchaseReceivalDetailService.CreateObject(purchaseReceival1.Id, item_botolaqua.Id, 2000, purchaseOrderDetail_botolaqua_so1.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_batiktulis_do2b = _purchaseReceivalDetailService.CreateObject(purchaseReceival2.Id, item_batiktulis.Id, 40, purchaseOrderDetail_batiktulis_so2.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_busway_do2 = _purchaseReceivalDetailService.CreateObject(purchaseReceival2.Id, item_busway.Id, 3, purchaseOrderDetail_busway_so2.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_botolaqua_do2 = _purchaseReceivalDetailService.CreateObject(purchaseReceival2.Id, item_botolaqua.Id, 340, purchaseOrderDetail_botolaqua_so2.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceivalDetail_batiktulis_do2a = _purchaseReceivalDetailService.CreateObject(purchaseReceival3.Id, item_batiktulis.Id, 100, purchaseOrderDetail_batiktulis_so1.Id, _purchaseReceivalService, _purchaseOrderDetailService, _purchaseOrderService, _itemService); purchaseReceival1 = _purchaseReceivalService.ConfirmObject(purchaseReceival1, DateTime.Today, _purchaseReceivalDetailService, _purchaseOrderService, _purchaseOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); purchaseReceival2 = _purchaseReceivalService.ConfirmObject(purchaseReceival2, DateTime.Today, _purchaseReceivalDetailService, _purchaseOrderService, _purchaseOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); purchaseReceival3 = _purchaseReceivalService.ConfirmObject(purchaseReceival3, DateTime.Today, _purchaseReceivalDetailService, _purchaseOrderService, _purchaseOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); }; it["validates_purchasereceivals"] = () => { purchaseReceival1.Errors.Count().should_be(0); purchaseReceival2.Errors.Count().should_be(0); }; it["deletes confirmed purchase receival"] = () => { purchaseReceival1 = _purchaseReceivalService.SoftDeleteObject(purchaseReceival1, _purchaseReceivalDetailService); purchaseReceival1.Errors.Count().should_not_be(0); }; it["unconfirm purchase receival"] = () => { purchaseReceival1 = _purchaseReceivalService.UnconfirmObject(purchaseReceival1, _purchaseReceivalDetailService, _purchaseInvoiceService, _purchaseInvoiceDetailService, _purchaseOrderService, _purchaseOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); purchaseReceival1.Errors.Count().should_be(0); }; it["validates item pending receival"] = () => { item_batiktulis.PendingReceival.should_be(0); item_busway.PendingReceival.should_be(0); item_botolaqua.PendingReceival.should_be(0); }; }; }