예제 #1
0
 public WindowMakeCreditNota(Invoice invoice)
 {
     InitializeComponent();
     this.invoice               = invoice;
     TextBoxCustomer.Text       = invoice.Order.Customer.CompanyName;
     TextBoxDateOfDelivery.Text = invoice.DateOfDelivery.ToString();
     TextBoxFormOfDelivery.Text = invoice.FormOfDelivery;
     TextBoxFormOfPayment.Text  = invoice.FormOfPayment;
     Orderlines.ItemsSource     = orderlineRepository.DisplayOrderlines(invoice.Order);
     TextBoxTotalPrice.Text     = invoice.Order.TotalPrice.ToString();
 }
예제 #2
0
        private void ComboBoxOffers_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int comboBoxNumber = ComboBoxOffers.SelectedIndex - 1;

            if (comboBoxNumber != -1)
            {
                order = nonActiveOrders[comboBoxNumber];
                TextBoxCustomer.Text       = $"{order.Customer.CompanyName}";
                TextBoxDateOfPurchase.Text = $"{order.DateOfPurchase}";
                TextBoxTotalPrice.Text     = $"{order.TotalPrice}";
                Orderlines.ItemsSource     = orderlineRepository.DisplayOrderlines(order);

                RadioButtonIsOrder.IsChecked = true;
                RadioButtonIsOffer.IsEnabled = false;
            }
            else
            {
                order = new Order();
                TextBoxCustomer.Text       = $"";
                TextBoxDateOfPurchase.Text = $"";
                TextBoxTotalPrice.Text     = $"";
                Orderlines.ItemsSource     = null;

                RadioButtonIsOrder.IsChecked = false;
                RadioButtonIsOffer.IsChecked = false;
                RadioButtonIsOffer.IsEnabled = true;
            }
        }
예제 #3
0
        private void ComboBoxOrders_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int comboBoxNumber = ComboBoxOrders.SelectedIndex - 1;

            if (comboBoxNumber != -1)
            {
                List <Order> tempList = new List <Order>();
                for (int i = 0; i < activeOrders.Count; i++)
                {
                    int index = invoices.FindIndex(item => item.Order.OrderID == activeOrders[i].OrderID);
                    if (index < 0)
                    {
                        tempList.Add(activeOrders[i]);
                    }
                }

                invoice.Order          = tempList[comboBoxNumber];
                TextBoxCustomer.Text   = $"{invoice.Order.Customer.CompanyName}";
                TextBoxTotalPrice.Text = $"{invoice.Order.TotalPrice}";
                Orderlines.ItemsSource = orderlineRepository.DisplayOrderlines(invoice.Order);
            }
            else
            {
                invoice.Order          = new Order();
                TextBoxCustomer.Text   = $"";
                TextBoxTotalPrice.Text = $"";
                Orderlines.ItemsSource = null;
            }
        }
예제 #4
0
        private void ButtonYes_Click(object sender, RoutedEventArgs e)
        {
            List <Orderline> orderlines = orderlineRepository.DisplayOrderlines(order);

            for (int i = 0; i < orderlines.Count; i++)
            {
                Product product = orderlines[i].Product;
                product.ProductAmount += orderlines[i].Amount;
                productRepository.EditProduct(product);
                orderlineRepository.DeleteOrderline(orderlines[i].OrderlineNumber);
            }
            orderRepository.DeleteOrder(order.OrderID);
            this.Close();
        }
예제 #5
0
 private void Update()
 {
     orderlines             = orderlineRepository.DisplayOrderlines(order);
     Orderlines.ItemsSource = orderlines;
     CollectionViewSource.GetDefaultView(Orderlines.ItemsSource).Refresh();
 }