Example #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
     });
 }
Example #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);
        }
Example #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();
 }
Example #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();
                }
            }
        }
Example #5
0
 private void MakeAGiftChequePayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.GiftCheque;
     MakeAPayment(invoiceManager, paymentType.Type, payment.GiftChequePayment);
 }
Example #6
0
 private void MakeAMoneyPayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.Money;
     MakeAPayment(invoiceManager, paymentType.Type, payment.MoneyPayment);
 }
Example #7
0
 private void MakeACBPayment(InvoiceManager invoiceManager, PaymentMethod paymentType, Payment payment)
 {
     paymentType.Type = PaymentMethodType.CB;
     MakeAPayment(invoiceManager, paymentType.Type, payment.CBPayment);
 }