private void AddInvoiceToClient(Invoice orderInvoice) { var invoiceCount = _uow.InvoiceRepository.All.Count(x => x != null && x.ClientId == 2); Assert.AreEqual(0, invoiceCount); _uow.InvoiceRepository.Add(orderInvoice); _uow.Save(); var invoiceCountUpdated = _uow.InvoiceRepository.All.Count(x => x != null && x.ClientId == 2); Assert.AreEqual(1, invoiceCountUpdated); }
public void AddInvoice(Invoice i) { Monitor.Enter(_lock); try { this.invoices.Add(i); } finally { Monitor.Exit(_lock); } }
public Invoice FirstInvoice() { MyOrders = new List<Order>(); var client1Orders = new FakeClient1Order().MyOrders; foreach (var order in client1Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); //Add it is is a subscriptions var firstOrderInvoice = new Invoice { InvoiceId = 1, OrderId = firstOrder.OrderId, ClientId = firstOrder.ClientId, OrderDate = firstOrder.OrderDate, DeliveryDate = firstOrder.DeliveryDate, CurrencyId = firstOrder.CurrencyId, CookerId = firstOrderCharge.CookerId, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, PlanTitle = firstOrderCharge.PlanTitle, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges, OrderModelTypeId = (int)Util.OrderModelType.Values.Transaction, CookerSubscriptionId = null, ServingPriceId = null, PlanId = null }; return firstOrderInvoice; }
public Invoice FirstInvoice() { MyOrders = new List<Order>(); var client2Orders = new FakeClient2Order().MyOrders; foreach (var order in client2Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); var firstOrderInvoice = new Invoice { InvoiceId = 2, OrderId = firstOrder.OrderId, ClientId = firstOrder.ClientId, OrderDate = firstOrder.OrderDate, DeliveryDate = firstOrder.DeliveryDate, CurrencyId = firstOrder.CurrencyId, CookerId = firstOrderCharge.CookerId, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, PlanTitle = firstOrderCharge.PlanTitle, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges }; return firstOrderInvoice; }
private void DgvDatos_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { if (dgvDatos.Items.Count > 0 && dgvDatos.SelectedItem != null) { try { DataRowView dataRow = (DataRowView)dgvDatos.SelectedItem; int id = int.Parse(dataRow.Row.ItemArray[0].ToString()); invoiceImpl = new InvoiceImpl(); invoice = invoiceImpl.Get(id); lblnames.Content = invoice.BussinesName; lblmail.Content = invoice.IdPayer.ToString(); lblid.Text = invoice.IdInvoide.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void AddInvoice(Invoice i) { this.invoices.Add(i); }
private Invoice CreateSubscriptionInvoice(OrderSubscription orderSubscription) { if (orderSubscription == null) return null; var subscriptionHelper = new SubscriptionHelper(_uow); var subscriptionOrderCharge = new SubscriptionCharge(uow: _uow).Calculate(orderSubscription.ClientId, orderSubscription); var subscriptionOrderInvoice = new Invoice { InvoiceId = _uow.InvoiceRepository.All.ToList().Max(x => x == null ? 0 : x.InvoiceId) + 1, #region Orders Fields //OrderId = null, OrderDate = null, DeliveryDate = null, #endregion #region Subscription Fields OrderId = orderSubscription.OrderSubscriptionId, SubscriptionStartDate = DateTime.Now.Date, SubscriptionEndDate = DateTime.Now.Date.AddMonths(1), SubscriptionInvoiceDate = DateTime.Now.Date, ClientSubscriptionId = orderSubscription.ClientSubscriptionId, CookerSubscriptionId = subscriptionHelper.GetCookerSubscription(orderSubscription.ClientSubscriptionId).CookerSubscriptionId, ServingPriceId = subscriptionHelper.GetCookerServingPriceModel(orderSubscription.ClientSubscriptionId).ServicePriceId, PlanId = orderSubscription.PlanId, PlanTitle = subscriptionHelper.GetPlanTitle(orderSubscription.PlanId), #endregion #region Common Fields ClientId = orderSubscription.ClientId, CookerId = subscriptionOrderCharge.CookerId, OrderModelTypeId = orderSubscription.OrderTypeId, OrderTypeValue = subscriptionOrderCharge.OrderTypeValue, PaymentMethodValue = subscriptionOrderCharge.PaymentMethodValue, CurrencyId = orderSubscription.CurrencyId, PromotionTitle = subscriptionOrderCharge.PromotionTitle, PromotionPrice = subscriptionOrderCharge.PromotionPrice, PromotionCurrencyId = subscriptionOrderCharge.PromotionCurrencyId, CouponTitle = subscriptionOrderCharge.CouponTitle, CouponPrice = subscriptionOrderCharge.CouponPrice, CouponCurrencyId = subscriptionOrderCharge.CouponCurrencyId, SalesTax = subscriptionOrderCharge.SalesTaxes, DeliveryFees = subscriptionOrderCharge.DeliveryFee, SubTotal = subscriptionOrderCharge.Subtotal, Total = subscriptionOrderCharge.TotalCharges #endregion }; return subscriptionOrderInvoice; }
private void ClientPaySubscriptionInvoice(Invoice subscriptionInvoice) { Debug.Assert(subscriptionInvoice.OrderId != null, "subscriptionInvoice.OrderId != null"); var clientPaymentCount = _uow.PaymentRepository.All.Count(x => x != null && x.InvoiceId == subscriptionInvoice.InvoiceId); Assert.AreEqual(0, clientPaymentCount); var clientSubscriptionPayment = new Payment { PaymentId = 1, InvoiceId = subscriptionInvoice.InvoiceId, PaymentDate = DateTime.Now.Date, PaymentAmount = subscriptionInvoice.Total, OrderId = (int)subscriptionInvoice.OrderId, ClientId = subscriptionInvoice.ClientId, CookerId = subscriptionInvoice.CookerId, TransactionId = new Guid().ToString(), OrderModelTypeId = (int)OrderModelType.Values.Transaction, PaymentStatusId = (int)PaymentStatusType.Values.Pending }; _uow.PaymentRepository.Add(clientSubscriptionPayment); _uow.Save(); var clientPaymentCountUpdate = _uow.PaymentRepository.All.Count(x => x != null && x.InvoiceId == subscriptionInvoice.InvoiceId); Assert.AreEqual(1, clientPaymentCountUpdate); }
public Invoice FirstSubscriptionInvoice() { //TODO CHANGE IT TO REFLECT THE SUBSCRIPTION MyOrders = new List<Order>(); var client1Orders = new FakeClient1SubscriptionsOrder().MyOrders; foreach (var order in client1Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); //Add it is is a subscriptions var firstOrderInvoice = new Invoice { InvoiceId = 10, #region Orders Fields OrderId = null, OrderDate = null, DeliveryDate = null, #endregion #region Subscription Fields SubscriptionStartDate = DateTime.Now.Date, SubscriptionEndDate = DateTime.Now.Date, SubscriptionInvoiceDate = DateTime.Now.Date, ClientSubscriptionId = 1, CookerSubscriptionId = 1, ServingPriceId = 3, PlanId = 1, PlanTitle = firstOrderCharge.PlanTitle, #endregion #region Common Fields ClientId = firstOrder.ClientId, CookerId = firstOrderCharge.CookerId, OrderModelTypeId = 2, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, CurrencyId = firstOrder.CurrencyId, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges, #endregion }; return firstOrderInvoice; }
public Invoice FirstSubscriptionInvoice() { MySubscriptionsOrders = new List<OrderSubscription>(); var client1SubscriptionsOrders = new FakeClient1SubscriptionsOrder().MyOrders; foreach (var order in client1SubscriptionsOrders) { MySubscriptionsOrders.Add(order); } var firstSubscriptionOrder = MySubscriptionsOrders.FirstOrDefault(); if (firstSubscriptionOrder == null) return null; var subscriptionHelper = new SubscriptionHelper(); var firstSubscriptionOrderCharge = new SubscriptionCharge().Calculate(firstSubscriptionOrder.ClientId, firstSubscriptionOrder); var firstSubscriptionOrderInvoice = new Invoice { InvoiceId = 20, #region Orders Fields //OrderId = null, OrderDate = null, DeliveryDate = null, #endregion #region Subscription Fields OrderId = firstSubscriptionOrder.OrderSubscriptionId, SubscriptionStartDate = DateTime.Now.Date, SubscriptionEndDate = DateTime.Now.Date.AddMonths(1), SubscriptionInvoiceDate = DateTime.Now.Date, ClientSubscriptionId = firstSubscriptionOrder.ClientSubscriptionId, CookerSubscriptionId = subscriptionHelper.GetCookerSubscription(firstSubscriptionOrder.ClientSubscriptionId).CookerSubscriptionId, ServingPriceId = subscriptionHelper.GetCookerServingPriceModel(firstSubscriptionOrder.ClientSubscriptionId).ServicePriceId, PlanId = firstSubscriptionOrder.PlanId, PlanTitle = subscriptionHelper.GetPlanTitle(firstSubscriptionOrder.PlanId), #endregion #region Common Fields ClientId = firstSubscriptionOrder.ClientId, CookerId = firstSubscriptionOrderCharge.CookerId, OrderModelTypeId = firstSubscriptionOrder.OrderTypeId, OrderTypeValue = firstSubscriptionOrderCharge.OrderTypeValue, PaymentMethodValue = firstSubscriptionOrderCharge.PaymentMethodValue, CurrencyId = firstSubscriptionOrder.CurrencyId, PromotionTitle = firstSubscriptionOrderCharge.PromotionTitle, PromotionPrice = firstSubscriptionOrderCharge.PromotionPrice, PromotionCurrencyId = firstSubscriptionOrderCharge.PromotionCurrencyId, CouponTitle = firstSubscriptionOrderCharge.CouponTitle, CouponPrice = firstSubscriptionOrderCharge.CouponPrice, CouponCurrencyId = firstSubscriptionOrderCharge.CouponCurrencyId, SalesTax = firstSubscriptionOrderCharge.SalesTaxes, DeliveryFees = firstSubscriptionOrderCharge.DeliveryFee, SubTotal = firstSubscriptionOrderCharge.Subtotal, Total = firstSubscriptionOrderCharge.TotalCharges #endregion }; return firstSubscriptionOrderInvoice; }
private Invoice CreateOrderInvoice(Order clientNewOrderTransaction) { if (clientNewOrderTransaction == null) return null; var orderCharge = new OrderCharge(uow: _uow).Calculate(clientNewOrderTransaction); var orderInvoice = new Invoice { InvoiceId = _uow.InvoiceRepository.All.ToList().Max(x => x == null ? 0 : x.InvoiceId) + 1, OrderId = clientNewOrderTransaction.OrderId, ClientId = clientNewOrderTransaction.ClientId, OrderDate = clientNewOrderTransaction.OrderDate, DeliveryDate = clientNewOrderTransaction.DeliveryDate, CurrencyId = clientNewOrderTransaction.CurrencyId, CookerId = orderCharge.CookerId, OrderTypeValue = orderCharge.OrderTypeValue, PaymentMethodValue = orderCharge.PaymentMethodValue, PromotionTitle = orderCharge.PromotionTitle, PromotionPrice = orderCharge.PromotionPrice, PromotionCurrencyId = orderCharge.PromotionCurrencyId, CouponTitle = orderCharge.CouponTitle, CouponPrice = orderCharge.CouponPrice, CouponCurrencyId = orderCharge.CouponCurrencyId, PlanTitle = orderCharge.PlanTitle, SalesTax = orderCharge.SalesTaxes, DeliveryFees = orderCharge.DeliveryFee, SubTotal = orderCharge.Subtotal, Total = orderCharge.TotalCharges, OrderModelTypeId = (int)OrderModelType.Values.Transaction, CookerSubscriptionId = null, ServingPriceId = null, PlanId = null }; return orderInvoice; }