Пример #1
0
 private void AmericanoRadio_CheckedChanged(object sender, EventArgs e)
 {
     if (((RadioButton)sender).Checked == true)
     {
         rAmericano = ((RadioButton)sender).Name;
     }
     if (rAmericano == "NormalAmericano")
     {
         Baverages bev = new Americano();
         string    x   =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value));
         AmericanoOrder.Text = x;
     }
     if (rAmericano == "ExtraAmericano")
     {
         Baverages bev = new Americano();
         bev = new Milk(bev);
         string x =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value));
         AmericanoOrder.Text = x;
     }
 }
Пример #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 Order_Click(object sender, EventArgs e)
        {
            bool control = false;

            if (LemonCheck.Checked)
            {
                Baverages      bev    = new Lemonade();
                DatabaseInsert insert = new DatabaseInsert();
                insert.Connection();
                insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(LemonUpDown.Value), Convert.ToInt32(LemonUpDown.Value));
                insert.Execute();
                insert.Close();
                control = true;
            }
            if (AmericanoCheck.Checked)
            {
                if (NormalAmericano.Checked)
                {
                    Baverages      bev    = new Americano();
                    DatabaseInsert insert = new DatabaseInsert();
                    insert.Connection();
                    insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value), Convert.ToInt32(AmericanoUpDown.Value));
                    insert.Execute();
                    insert.Close();
                    control = true;
                }
                if (ExtraAmericano.Checked)
                {
                    Baverages bev = new Americano();
                    bev = new Milk(bev);
                    DatabaseInsert insert = new DatabaseInsert();
                    insert.Connection();
                    insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value), Convert.ToInt32(AmericanoUpDown.Value));
                    insert.Execute();
                    insert.Close();
                    control = true;
                }
            }
            if (TCoffeeCheck.Checked)
            {
                if (SugarFree.Checked)
                {
                    Baverages bev = new TurkishCoffee();
                    bev = new SugarFree(bev);
                    DatabaseInsert insert = new DatabaseInsert();
                    insert.Connection();
                    insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value), Convert.ToInt32(TCoffeeUpDown.Value));
                    insert.Execute();
                    insert.Close();
                    control = true;
                }
                if (MidSugar.Checked)
                {
                    Baverages bev = new TurkishCoffee();
                    bev = new MidSugar(bev);
                    DatabaseInsert insert = new DatabaseInsert();
                    insert.Connection();
                    insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value), Convert.ToInt32(TCoffeeUpDown.Value));
                    insert.Execute();
                    insert.Close();
                    control = true;
                }
                if (Sugary.Checked)
                {
                    Baverages bev = new TurkishCoffee();
                    bev = new Sugary(bev);
                    DatabaseInsert insert = new DatabaseInsert();
                    insert.Connection();
                    insert.InsertOrders(Table, bev.GetDescription(), bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value), Convert.ToInt32(TCoffeeUpDown.Value));
                    insert.Execute();
                    insert.Close();
                    control = true;
                }
            }
            if (control)
            {
                MessageBox.Show("Your order has been received.");
                LemonCheck.Checked     = false;
                AmericanoCheck.Checked = false;
                TCoffeeCheck.Checked   = false;
            }
            else
            {
                MessageBox.Show("You did not choose any order!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }