コード例 #1
0
 public void MakeASalesCycle(ProductView productView,
                             CashRegisterManager cashRegisterManager,
                             InvoiceManager invoiceManager,
                             ProductLineManager productLineManager,
                             DiscountManager discountManager,
                             double quantity,
                             double pourcentDTxtBox,
                             double discountTxtBox)
 {
     invoiceManager.MakeAInvoice(productView, cashRegisterManager, productLineManager, discountManager, quantity, pourcentDTxtBox, discountTxtBox);
     productLineManager.SetAProductLine(invoiceManager.Ticket, ProductLinesList);
     discountManager.SetADiscount(invoiceManager.Ticket, TotalDiscountsList);
     JoinProductLineWithDiscount();
 }
コード例 #2
0
        public Invoice MakeAInvoice(ProductView productView,
                                    CashRegisterManager cashRegisterManager,
                                    ProductLineManager productLineManager,
                                    DiscountManager discountManager,
                                    double quantity,
                                    double pourcentDTxtBox,
                                    double discountTxtBox)
        {
            ClearAllInvoiceSetup(cashRegisterManager);

            var sum = cashRegisterManager.CalculateAPrice(productView, quantity);
            var pourcentDiscountValue   = cashRegisterManager.CalculateAPourcentDiscount(pourcentDTxtBox, sum);
            var discountValue           = cashRegisterManager.CalculateADiscount(discountTxtBox);
            var totalDiscountValue      = cashRegisterManager.CalculateTotalPourcentDAndDiscount(pourcentDiscountValue, discountValue);
            var totalDiscountPriceValue = cashRegisterManager.CalculateADiscountPrice(sum, totalDiscountValue);

            Ticket.NameSeller   = LoginManager.LoginSession.UserName;
            Ticket.Recipe      += totalDiscountPriceValue;
            Ticket.TotalToPay  += totalDiscountPriceValue;
            Ticket.CreationDate = DateTime.Now;

            Ticket.ProductLines.Add(new ProductLine
            {
                ProductLineJoinId = productLineManager.SetTheProductLineId(Ticket),
                Product           = new Product
                {
                    Name  = productView.Name,
                    Price = productView.Price,
                },
                Quantity        = quantity,
                FinalTotalPrice = totalDiscountPriceValue,
                Discounts       = new List <Discount>
                {
                    new Discount
                    {
                        DiscountJoinId = discountManager.SetTheDiscountId(Ticket),
                        Type           = DiscountType.SubTotalDiscount,
                        Value          = totalDiscountValue,
                        TotalDiscount  = totalDiscountValue
                    }
                }
            });
            return(Ticket);
        }