Пример #1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            checkBox1.Enabled = true;
            checkBox2.Enabled = true;
            checkBox3.Enabled = true;
            checkBox4.Enabled = true;

            if (comboBox1.SelectedIndex == 0)
            {
                checkBox1.Checked = false;
                checkBox2.Checked = false;
                checkBox3.Checked = false;
                checkBox4.Checked = false;
                textBox1.Text     = $"{bevarage.getDescription()}";
                textBox2.Text     = $"{bevarage.cost()}";
                textBox7.Text     = $"{bevarage.cost()}";

                buf = 1;
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                checkBox1.Checked = false;
                checkBox2.Checked = false;
                checkBox3.Checked = false;
                checkBox4.Checked = false;
                textBox1.Text     = $"{bevarage1.getDescription()}";
                textBox2.Text     = $"{bevarage1.cost()}";
                textBox7.Text     = $"{bevarage1.cost()}";
                buf = 2;
            }
            else if (comboBox1.SelectedIndex == 2)
            {
                checkBox1.Checked = false;
                checkBox2.Checked = false;
                checkBox3.Checked = false;
                checkBox4.Checked = false;
                textBox1.Text     = $"{bevarage2.getDescription()}";
                textBox2.Text     = $"{bevarage2.cost()}";
                textBox7.Text     = $"{bevarage2.cost()}";
                buf = 3;
            }
            else if (comboBox1.SelectedIndex == 3)
            {
                checkBox1.Checked = false;
                checkBox2.Checked = false;
                checkBox3.Checked = false;
                checkBox4.Checked = false;
                textBox1.Text     = $"{bevarage3.getDescription()}";
                textBox2.Text     = $"{bevarage3.cost()}";
                textBox7.Text     = $"{bevarage3.cost()}";
                buf = 4;
            }
        }
Пример #2
0
        private void checkBox4_CheckedChanged(object sender, EventArgs e)
        {
            comboBox5.Enabled = true;
            comboBox5.Text    = "1";
            textBox6.Text     = "0,55";
            switch (buf)
            {
            case 1:
                if (checkBox4.Checked)
                {
                    bevarage      = new Whip(bevarage);
                    textBox1.Text = $"{bevarage.getDescription()}";
                    textBox2.Text = $"{bevarage.cost()}";
                }
                else
                {
                    comboBox5.Enabled = false;
                    bevarage          = new Espresso();
                    bevarage          = new Mocha(bevarage);
                    bevarage          = new Soy(bevarage);
                    bevarage          = new Milk(bevarage);
                    textBox1.Text     = $"{bevarage.getDescription()}";
                    textBox2.Text     = $"{bevarage.cost()}";
                    textBox6.Text     = "0";
                }
                break;

            case 2:
                if (checkBox3.Checked)
                {
                    bevarage1     = new Whip(bevarage1);
                    textBox1.Text = $"{bevarage1.getDescription()}";
                    textBox2.Text = $"{bevarage1.cost()}";
                }
                else
                {
                    comboBox5.Enabled = false;
                    bevarage1         = new Americano();
                    bevarage1         = new Mocha(bevarage1);
                    bevarage1         = new Soy(bevarage1);
                    bevarage1         = new Milk(bevarage1);
                    textBox1.Text     = $"{bevarage1.getDescription()}";
                    textBox2.Text     = $"{bevarage1.cost()}";
                    textBox6.Text     = "0";
                }
                break;

            case 3:
                if (checkBox3.Checked)
                {
                    bevarage2     = new Whip(bevarage2);
                    textBox1.Text = $"{bevarage2.getDescription()}";
                    textBox2.Text = $"{bevarage2.cost()}";
                }
                else
                {
                    comboBox5.Enabled = false;
                    bevarage2         = new Capuccino();
                    bevarage2         = new Mocha(bevarage2);
                    bevarage2         = new Soy(bevarage2);
                    bevarage2         = new Milk(bevarage2);
                    textBox1.Text     = $"{bevarage2.getDescription()}";
                    textBox2.Text     = $"{bevarage2.cost()}";
                    textBox6.Text     = "0";
                }
                break;

            case 4:
                if (checkBox3.Checked)
                {
                    bevarage3     = new Whip(bevarage3);
                    textBox1.Text = $"{bevarage3.getDescription()}";
                    textBox2.Text = $"{bevarage3.cost()}";
                }
                else
                {
                    comboBox5.Enabled = false;
                    bevarage3         = new Latte();
                    bevarage3         = new Mocha(bevarage3);
                    bevarage3         = new Soy(bevarage3);
                    bevarage3         = new Milk(bevarage3);
                    textBox1.Text     = $"{bevarage3.getDescription()}";
                    textBox2.Text     = $"{bevarage3.cost()}";
                    textBox6.Text     = "0";
                }
                break;
            }
        }