示例#1
0
 private void orderNewOrderButton_Click(object sender, EventArgs e) // New order button clicked
 {
     if (orderDescriptionGridView.Rows.Count > 0)
     {
         controller.insertorders();              // it inserts in the order table default values new order number + date
         int transno = controller.lastorderno(); // get the last created order number
         for (int i = 0; i < orderDescriptionGridView.Rows.Count; i++)
         {
             controller.insertordercon(Int32.Parse(orderDescriptionGridView.Rows[i].Cells[2].Value.ToString()), Int32.Parse(orderDescriptionGridView.Rows[i].Cells[1].Value.ToString()), transno);
         }
         orderDescriptionGridView.Rows.Clear();
         stocklevel();
         refreshComboBoxes();
         orderQuantityTextField.Clear();
         OrderReceipt orderReceipt = new OrderReceipt(transno); // Opens new Order Receipt window
         orderReceipt.Show();
         orderTotalPriceValueTextLabel.Text    = "0";
         orderTotalPriceValueTextLabel.Visible = false;
     }
     else
     {
         MessageBox.Show("No order items selected");
     }
 }