public void CalculateTheTicketPrice() { try { ProductViewManager productViewManager = new ProductViewManager(); ProductLineManager productLineManager = new ProductLineManager(); DiscountManager discountManager = new DiscountManager(); CashRegisterManager.MakeASalesCycle(productViewManager.SelectAProductByRow(ArticleToSellDataGrid.CurrentCell.Item), CashRegisterManager, InvoiceManager, productLineManager, discountManager, SalesParametersWindow.SalesParameter.Quantity, SalesParametersWindow.SalesParameter.PourcentDiscount, SalesParametersWindow.SalesParameter.Discount); InvoiceDataGrid.ItemsSource = CashRegisterManager.InvoiceViewsList; Payment.TotalToPay = Math.Round(InvoiceManager.Ticket.TotalToPay, 2); TotalTxtBlock.Text = $"{Math.Round(InvoiceManager.Ticket.Recipe, 2)}€ TTC"; RestToPayTxtBlock.Text = $"{Math.Round(Payment.TotalToPay, 2)}€"; if (CashRegisterManager.CalculateTheTotalInvoiceDiscount(InvoiceManager.Ticket) > 0) { DiscountTxtBlock.Text = "Remise"; TotalDiscountTxtBlock.Text = $"-{Math.Round(CashRegisterManager.CalculateTheTotalInvoiceDiscount(InvoiceManager.Ticket), 2)}"; } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void EditAProductQuantityButton_Click(object sender, RoutedEventArgs e) { ProductViewManager productViewManager = new ProductViewManager(); productViewManager.SelectAProductByRow((ProductView)ProductsDataGrid.CurrentCell.Item); InventoryAdjustmentWindow inventoryAdjustmentWindow = new InventoryAdjustmentWindow(); inventoryAdjustmentWindow.ShowDialog(); }
private void EditAnArticleButton_Click(object sender, RoutedEventArgs e) { try { ProductViewManager productViewManager = new ProductViewManager(); productViewManager.SelectAProductByRow((ProductView)ProductsDataGrid.CurrentCell.Item); EditAnArticleWindow editAnArticleWindow = new EditAnArticleWindow(); editAnArticleWindow.ShowDialog(); ReloadDataGrid(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void DeleteAnArticleButton_Click(object sender, RoutedEventArgs e) { try { if (MessageBox.Show("Etes-vous sûr de vouloir supprimer cet article?", "DataGridView", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ProductViewManager productViewManager = new ProductViewManager(); ProductManager.RemoveAProductToDataBase(productViewManager.SelectAProductByRow(ProductsDataGrid.CurrentCell.Item)); } ReloadDataGrid(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }