Exemple #1
0
 private void OrderButton_Click(object sender, EventArgs e)
 {
     if (CheckInputData())
     {
         var currentOrder = new OrderToDB()
         {
             ClientName = nameTextBox.Text,
             ClientMail = mailTextBox.Text,
             Date       = DateTime.Now,
             games      = new List <Tuple <string, int> >()
         };
         foreach (var game in (from game in UIController.currentOrderGames group game by game.Item1))
         {
             currentOrder.games.Add(new Tuple <string, int>(game.Key, game.Count()));
         }
         var order = DBController.AddOrderToDB(currentOrder);
         MessageBox.Show($"Ваш заказ №{order.ID} успешно оформлен");
         UIController.currentOrderGames.Clear();
         var currentOrderToReport = DBController.GetOrderParamsByID(order.ID);
         ReportExportController.CreateReceipt(currentOrderToReport);
         DialogResult = DialogResult.OK;
     }
 }
 private void exportButton_Click(object sender, EventArgs e)
 {
     ReportExportController.CreateTableOrders(dataGridView1);
 }