예제 #1
0
 private void NerimanCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (NerimanCombo.Text == "Tasting  250CC")
     {
         NerimanOrder.Text = "";
         Baverages tasting = new LeShokaladeNeriman();
         tasting           = new Tasting(tasting);
         NerimanOrder.Text = string.Format("Tadimlik Neriman-${0}", tasting.GetPrice() * Convert.ToDouble(NerimanUpdown.Value));
     }
     if (NerimanCombo.Text == "Filling  400CC")
     {
         NerimanOrder.Text = "";
         Baverages filling = new LeShokaladeNeriman();
         filling           = new Filling(filling);
         NerimanOrder.Text = string.Format("Filling Neriman-${0}", filling.GetPrice() * Convert.ToDouble(NerimanUpdown.Value));
     }
     if (NerimanCombo.SelectedIndex == 0)
     {
         NerimanOrder.Text = "";
     }
 }
예제 #2
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);
         }
     }
 }
예제 #3
0
        private void OrderBtn_Click(object sender, EventArgs e)
        {
            bool control = false;

            if (SudeCombo.Text == "Tasting  250CC")
            {
                Baverages tasting = new LeShokaladeSude();
                tasting = new Tasting(tasting);
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, "Tasting Sude", tasting.GetPrice() * Convert.ToDouble(SudeUpDown.Value), Convert.ToInt32(SudeUpDown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (SudeCombo.Text == "Filling  400CC")
            {
                Baverages filling = new LeShokaladeSude();
                filling = new Filling(filling);
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, "Filling Sude", filling.GetPrice() * Convert.ToDouble(SudeUpDown.Value), Convert.ToInt32(SudeUpDown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (NerimanCombo.Text == "Tasting  250CC")
            {
                Baverages tasting = new LeShokaladeNeriman();
                tasting = new Tasting(tasting);
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, "Tasting Neriman", tasting.GetPrice() * Convert.ToDouble(NerimanUpdown.Value), Convert.ToInt32(NerimanUpdown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (NerimanCombo.Text == "Filling  400CC")
            {
                Baverages filling = new LeShokaladeNeriman();
                filling = new Filling(filling);
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, "Filling Neriman", filling.GetPrice() * Convert.ToDouble(NerimanUpdown.Value), Convert.ToInt32(NerimanUpdown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (WaffleCheck.Checked == true)
            {
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, "Waffle", 10 * Convert.ToInt32(WaffleUpDown.Value), Convert.ToInt32(WaffleUpDown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (control)
            {
                MessageBox.Show("Your order has been received.", "Thank You :)");
                SudeCombo.SelectedIndex    = 0;
                NerimanCombo.SelectedIndex = 0;
                WaffleCheck.Checked        = false;
            }
            else
            {
                MessageBox.Show("You did not choose any order!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }