Пример #1
0
 private void NerimanIng_CheckedChanged(object sender, EventArgs e)
 {
     if (NerimanIng.Checked == true)
     {
         NerimanLabel.Visible = true;
         AbstractStore store = new LeShokaladeDukkan();
         NerimanLabel.Text = store.OrderDessert("neriman").Ingredients();
     }
     else
     {
         NerimanLabel.Visible = false;
     }
 }
Пример #2
0
 private void SudeIng_CheckedChanged(object sender, EventArgs e)
 {
     if (SudeIng.Checked == true)
     {
         SudeLabel.Visible = true;
         AbstractStore store = new LeShokaladeDukkan();
         SudeLabel.Text = store.OrderDessert("sude").Ingredients();
     }
     else
     {
         SudeLabel.Visible = false;
     }
 }
Пример #3
0
 private void GiveOrder_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Customer.Text))
     {
         MessageBox.Show("Please specify a name!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         bool control = false;
         foreach (string choice in ProductList.CheckedItems)
         {
             string CustomerSent = Customer.Text;
             if (choice == "TastingSude")
             {
                 Baverages tasting = new LeShokaladeSude();
                 tasting = new Tasting(tasting);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, tasting.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "FillingSude")
             {
                 Baverages filling = new LeShokaladeSude();
                 filling = new Filling(filling);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, filling.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "TastingNeriman")
             {
                 Baverages tasting = new LeShokaladeNeriman();
                 tasting = new Tasting(tasting);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, tasting.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "FillingNeriman")
             {
                 Baverages filling = new LeShokaladeNeriman();
                 filling = new Filling(filling);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, filling.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "Lemonade")
             {
                 Baverages      bev    = new Lemonade();
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "Americano")
             {
                 Baverages      bev    = new Americano();
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "MilkyAmericano")
             {
                 Baverages bev = new Americano();
                 bev = new Milk(bev);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
         }
         if (control)
         {
             MessageBox.Show("Your order has been received.", "Thank you :)");
             AbstractStore store = new LeShokaladeDukkan();
             Box.Text = store.OrderDessert("sude").Box();
             for (int i = 0; i < ProductList.Items.Count; i++)
             {
                 ProductList.SetItemChecked(i, false);
             }
             Orders.Text   = " ";
             Customer.Text = "Your Name";
         }
         else
         {
             MessageBox.Show("You did not choose any order!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }