private void CheckoutButton_Click(object sender, RoutedEventArgs e) { Order currentOrder; //update stocks accordingly try { Console.WriteLine(_orderEntriesList.Count); if (_orderEntriesList.Count > 0) { #region Updating stocks //foreach (var odrEntry in _orderEntriesList) //{ // if (Tyre.GetTyres(odrEntry.ProductId.ToString()).Count() == 1) // { // Item.UpdateStockDetails(odrEntry.ProductId, // Tyre.GetTyres(odrEntry.ProductId.ToString()).ElementAt(0).Stock - odrEntry.Quantity); // } // else if (Battery.GetBatteries(odrEntry.ProductId.ToString()).Count() == 1) // { // Item.UpdateStockDetails(odrEntry.ProductId, // Battery.GetBatteries(odrEntry.ProductId.ToString()).ElementAt(0).Stock - // odrEntry.Quantity); // } // else if (AlloyWheel.GetAlloyWheels(odrEntry.ProductId.ToString()).Count() == 1) // { // Item.UpdateStockDetails(odrEntry.ProductId, // AlloyWheel.GetAlloyWheels(odrEntry.ProductId.ToString()).ElementAt(0).Stock - // odrEntry.Quantity); // } //} #endregion currentOrder = new Order(_invoiceNo, /*MainWindow.CurrentUser.Id */ 1, _orderEntriesList, CustomerNameTextBox.Text, DateTime.Now); if (_creditOrder) { if (MessageBox.Show(this, "Do you want to proceed with Credit Order?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { try { var verificWindow = new Customers.CreditCustomerVerificationWindow(CustomerNameTextBox.Text); verificWindow.ShowDialog(); if (verificWindow.DialogResult == true) { // MessageBox.Show(verificWindow.CustomerId.ToString()); // MessageBox.Show(verificWindow.CustomerName Order.AddOrder(currentOrder); //add order to the DB & order Entries to DB CreditOrder.AddCreditOrder(_invoiceNo, verificWindow.CustomerId); // Customer.UpdateDues(verificWindow.CustomerId, _currentOrder.Total); MessageBox.Show( "Successfully Created The Order. Customer Name :" + verificWindow.CustomerName, "Credit Order Status"); Close(); } else { CreditCheckBox.IsChecked = false; _creditOrder = false; RefreshOrderEntriesDataGrid(); } } catch (Exception ex) { log.Debug(ex.Message); MessageBox.Show("Customer Verification Failed"); } } } else if (MessageBox.Show(this, "Do you want to proceed with Cash Order?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Order.AddOrder(currentOrder); MessageBox.Show("Successfully added the cash order.", "Order Status"); Close(); } } else { log.Debug("Proceed button click without selecting an item"); MessageBox.Show("Select Items to proceed!", "Empty order"); } } catch (Exception ex) { MessageBox.Show("exception in proceed button click" + ex.Message); log.Debug(ex.Message); } }
public void GetCreditOrdersTest() { Assert.IsNotNull(CreditOrder.GetCreditOrders()); }
public void AddCreditOrderTest() { CreditOrder.AddCreditOrder(99, 1); }
// Приказы по банкам и фин.орг. private void button5_Click(object sender, EventArgs e) { CreditOrder form2 = new CreditOrder(); // Создание соовтественующего окна form2.Show(); // показать окно }