Exemple #1
0
 //BR_PO9
 private void IsNotDuplicate(OrderItem orderItem)
 {
     var q1 = OrderItems.FirstOrDefault(c => c.GoodId == orderItem.GoodId
         // && c.GoodPartyAssignmentId == orderItem.GoodPartyAssignmentId
                                             && c.Id != orderItem.Id);
     if (q1 != null)
         throw new BusinessRuleException("BR_PO9", " OrderItem Has Duplicate ");
 }
        //<A.H> This method is required for unifying the InvoiceItem with relevant OrderItem Unit of Measurement.
        private decimal updateInvoiceItemWithHeterogeneousOderItem(InvoiceItem invoiceItem, OrderItem orderItem, decimal availableForInvoice)
        {
            var currentValueInMainUnit = goodUnitConvertorDomainService.GetUnitValueInMainUnit
                (invoiceItem.GoodId, invoiceItem.MeasuringUnitId, invoiceItem.Quantity);
            invoiceItem.UpdateUnitAndQuantity(currentValueInMainUnit.Id, currentValueInMainUnit.Value);
            var newValueInMainUnit = goodUnitConvertorDomainService.GetUnitValueInMainUnit
                (invoiceItem.GoodId, orderItem.MeasuringUnitId, availableForInvoice);

            return newValueInMainUnit.Value;
        }
Exemple #3
0
        private void CheckCommonAddAndEditItemRules(OrderItem orderItem,
                                                    GoodFullInfo goodFullInfo)
        {
            //BR_PO04
            IsOnOpenState();

            //BR_PO9
            IsNotDuplicate(orderItem);

            // BR_17  developer Dont implement refrence in order

            //BR_PO18
            CanBeOrderThisGood(orderItem, goodFullInfo);

            //BR_PO20
            GoodHaveValidSuplierAndTransporter(orderItem, goodFullInfo);

            //ValidateGoodQuantity(orderItem, goodDomainService);

            //            //BR_PO21
            //            CanBeOrderWithReOrderLevelCheck(orderItem, goodDomainService);

            //            //BR_PO22
            //            MaxOfOrderCheck(orderItem.Quantity, orderItem, goodPartyAssignmentDomainService);
            //
            //            //BR_PO23
            //            FixOfOrderCheck(orderItem.Quantity, orderItem, goodPartyAssignmentDomainService);
        }
Exemple #4
0
 //BR_PO20
 private void GoodHaveValidSuplierAndTransporter(OrderItem orderItem, GoodFullInfo goodFullInfo)
 {
     _orderBaseType.ValidateGoodSuplierAndTransporter(this, goodFullInfo);
 }
Exemple #5
0
 //        //BR_PO10
 //        private void IsNotOnMiddleApprovedStates()
 //        {
 //            var isMiddleApprovedState = new IsOrderInMiddleApprovedState();
 //            if (isMiddleApprovedState.IsSatisfiedBy(this))
 //                throw new BusinessRuleException("BR_PO10", "Order in Middle Approve State");
 //        }
 //
 //        //BR_PO13
 //        private void IsOnMiddleApprovedStates()
 //        {
 //            var isMiddleApprovedState = new IsOrderInMiddleApprovedState();
 //            if (isMiddleApprovedState.IsSatisfiedBy(this))
 //                throw new BusinessRuleException("BR_PO10", "Order in Middle Approve State");
 //        }
 //BR_PO18
 private void CanBeOrderThisGood(OrderItem orderItem,
                                 GoodFullInfo goodFullInfo)
 {
     if (!goodFullInfo.CanBeOrderedThisGood)
         throw new BusinessRuleException("BR_PO18", "Good Order Cant Be Order ");
 }
Exemple #6
0
        public void DeleteItem(OrderItem item, IOrderItemDomainService orderItemDomainService)
        {
            // Bussuiness Rules
            IsOnOpenState();

            var orderItem = OrderItems.FirstOrDefault(c => c.Id == item.Id);
            if (orderItem == null)
                throw new ObjectNotFound("OrderItem", item.Id);
            orderItemDomainService.DeleteOrderItem(orderItem);
        }
Exemple #7
0
 public void AddItem(OrderItem orderItem, GoodFullInfo goodFullDomainInStorageService)
 {
     OrderItems.Add(orderItem);
     CheckCommonAddAndEditItemRules(orderItem, goodFullDomainInStorageService);
 }
 public void DeleteOrderItem(OrderItem orderItem)
 {
     orderItemRepository.Delete(orderItem);
 }
Exemple #9
0
 public OrderItem CreateFactoryOrderItemObject(Order order, string description, decimal quantity, long goodId,
                                               long unitId, GoodFullInfo goodFullDetails)
 {
     var orderItem = new OrderItem(description, quantity, goodId, unitId, goodFullDetails);
     return orderItem;
 }