예제 #1
0
 private void MakeAPayment(InvoiceManager invoiceManager, PaymentMethodType type, double payment)
 {
     invoiceManager.Ticket.PaymentMethods.Add(new PaymentMethod
     {
         PaymentMethodJoinId = SetTheProductLineJoinId(invoiceManager.Ticket),
         Type         = type,
         Value        = payment,
         CreationDate = DateTime.Now
     });
 }
예제 #2
0
        public double SetThePaymentMethod(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
        {
            invoiceManager.Ticket.PaymentMethods = invoiceManager.PaymentMethods;

            MakeACBPayment(invoiceManager, paymentType, payment);
            MakeAMoneyPayment(invoiceManager, paymentType, payment);
            MakeAChequePayment(invoiceManager, paymentType, payment);
            MakeAGiftChequePayment(invoiceManager, paymentType, payment);

            payment.TotalPayment = payment.CBPayment + payment.MoneyPayment + payment.ChequePayment;

            return(payment.TotalPayment);
        }
예제 #3
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();
 }
예제 #4
0
        public void EditProductQuantity(InvoiceManager invoiceManager)
        {
            var ticket = invoiceManager.Ticket;

            foreach (var productLine in ticket.ProductLines)
            {
                var dbContext      = new StockContext();
                var productToCheck = dbContext.Products.Where(p => p.Name == productLine.Product.Name).FirstOrDefault();

                if (productToCheck != null)
                {
                    var newProductQuantity = dbContext.ProductStocks.Where(p => p.ProductStockId == productToCheck.ProductId).FirstOrDefault();
                    newProductQuantity.Quantity -= productLine.Quantity;
                    dbContext.SaveChanges();
                }
            }
        }
예제 #5
0
 private void MakeAGiftChequePayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.GiftCheque;
     MakeAPayment(invoiceManager, paymentType.Type, payment.GiftChequePayment);
 }
예제 #6
0
 private void MakeAMoneyPayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.Money;
     MakeAPayment(invoiceManager, paymentType.Type, payment.MoneyPayment);
 }
예제 #7
0
 private void MakeACBPayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.CB;
     MakeAPayment(invoiceManager, paymentType.Type, payment.CBPayment);
 }