Exemplo n.º 1
0
 private void TCoffeeRadio_CheckedChanged(object sender, EventArgs e)
 {
     if (((RadioButton)sender).Checked == true)
     {
         rTCoffee = ((RadioButton)sender).Name;
     }
     if (rTCoffee == "SugarFree")
     {
         Baverages bev = new TurkishCoffee();
         bev = new SugarFree(bev);
         string x =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value));
         TCoffeOrder.Text = x;
     }
     if (rTCoffee == "MidSugar")
     {
         Baverages bev = new TurkishCoffee();
         bev = new MidSugar(bev);
         string x =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value));
         TCoffeOrder.Text = x;
     }
     if (rTCoffee == "Sugary")
     {
         Baverages bev = new TurkishCoffee();
         bev = new Sugary(bev);
         string x =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(TCoffeeUpDown.Value));
         TCoffeOrder.Text = x;
     }
 }
Exemplo n.º 2
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);
            }
        }