Example #1
0
        public Soda(string name, string volume, string st, string bubleCount, string cost)
        {
            this.name   = name;
            base.volume = Convert.ToDouble(volume.Replace(" л", ""));
            switch (st)
            {
            case "Кока-кола":
                this.soda = sodaType.cocaCola;
                break;

            case "Фанта":
                this.soda = sodaType.fanta;
                break;

            case "Пепси":
                this.soda = sodaType.pepsi;
                break;

            case "Тархун":
                this.soda = sodaType.tarragon;
                break;
            }
            this.bubleCount = int.Parse(bubleCount);
            base.cost       = ushort.Parse(cost);
        }
Example #2
0
 public Soda(double volume, int bubleCount, sodaType st, string name, ushort cost)
 {
     base.volume     = volume / 1000;
     base.name       = name;
     this.bubleCount = bubleCount;
     soda            = st;
     base.cost       = cost;
 }
Example #3
0
        public Soda()
        {
            int i = rnd.Next(0, sodaName.Length);

            name       = sodaName[i];
            volume     = ((500 + rnd.Next(1500)) / 1000.0);
            bubleCount = rnd.Next(10000);
            soda       = (sodaType)rnd.Next(4);
            cost       = (ushort)rnd.Next(0, 200);
        }
Example #4
0
        private void addSoda_Click(object sender, EventArgs e)
        {
            nameSoda.BackColor = Color.White;
            if (nameSoda.Text == "")
            {
                nameSoda.BackColor = Color.Red;
                return;
            }
            mainForm.sodaCount++;
            string   name   = nameSoda.Text;
            double   volume = (double)numericUpDown2.Value;
            sodaType s      = sodaType.cocaCola;

            switch (comboBox2.Text)
            {
            case "Кока-Кола":
                s = sodaType.cocaCola;
                break;

            case "Пепси":
                s = sodaType.pepsi;
                break;

            case "Тархун":
                s = sodaType.tarragon;
                break;

            case "Фанта":
                s = sodaType.fanta;
                break;
            }
            int    bubleCount = (int)numericUpDown5.Value;
            ushort cost       = (ushort)numericUpDown7.Value;

            mainForm.drinksList.Add(new Soda(volume, bubleCount, s, name, cost));
            nameSoda.Clear();
            numericUpDown2.Value    = 1;
            numericUpDown5.Value    = 1;
            comboBox2.SelectedIndex = 0;
            mainForm.isEdit         = true;
            MessageBox.Show("Успешно");
            mainForm.ShowInfo();
        }