Пример #1
0
 public RetailPurchaseInvoiceDetail SoftDeleteObject(RetailPurchaseInvoiceDetail retailPurchaseInvoiceDetail, IRetailPurchaseInvoiceService _retailPurchaseInvoiceService)
 {
     if (_validator.ValidDeleteObject(retailPurchaseInvoiceDetail, _retailPurchaseInvoiceService))
     {
         RetailPurchaseInvoice retailPurchaseInvoice = _retailPurchaseInvoiceService.GetObjectById(retailPurchaseInvoiceDetail.RetailPurchaseInvoiceId);
         _repository.SoftDeleteObject(retailPurchaseInvoiceDetail);
         retailPurchaseInvoice.Total = CalculateTotal(retailPurchaseInvoice.Id);
         _retailPurchaseInvoiceService.GetRepository().Update(retailPurchaseInvoice);
     }
     return(retailPurchaseInvoiceDetail);
 }
Пример #2
0
 public RetailPurchaseInvoiceDetail UpdateObject(RetailPurchaseInvoiceDetail retailPurchaseInvoiceDetail, IRetailPurchaseInvoiceService _retailPurchaseInvoiceService,
                                                 IItemService _itemService, IWarehouseItemService _warehouseItemService, IPriceMutationService _priceMutationService)
 {
     if (_validator.ValidUpdateObject(retailPurchaseInvoiceDetail, _retailPurchaseInvoiceService, this, _itemService, _warehouseItemService))
     {
         Item                  item                  = _itemService.GetObjectById(retailPurchaseInvoiceDetail.ItemId);
         PriceMutation         priceMutation         = _priceMutationService.GetObjectById(item.PriceMutationId);
         RetailPurchaseInvoice retailPurchaseInvoice = _retailPurchaseInvoiceService.GetObjectById(retailPurchaseInvoiceDetail.RetailPurchaseInvoiceId);
         retailPurchaseInvoiceDetail.PriceMutationId = item.PriceMutationId;
         retailPurchaseInvoiceDetail.Amount          = priceMutation.Amount * retailPurchaseInvoiceDetail.Quantity;
         retailPurchaseInvoiceDetail = _repository.UpdateObject(retailPurchaseInvoiceDetail);
         retailPurchaseInvoice.Total = CalculateTotal(retailPurchaseInvoice.Id);
         _retailPurchaseInvoiceService.GetRepository().Update(retailPurchaseInvoice);
     }
     return(retailPurchaseInvoiceDetail);
 }