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