public Alcohol(string name, string volume, string at, string fortress, string cost) { this.name = name; base.volume = Convert.ToDouble(volume.Replace(" л", "")); switch (at) { case "Пиво": this.type = alcoholType.beer; break; case "Джин": this.type = alcoholType.gin; break; case "Водка": this.type = alcoholType.vodka; break; case "Виски": this.type = alcoholType.whiskey; break; } this.fortress = int.Parse(fortress); base.cost = ushort.Parse(cost); }
public Alcohol(double volume, int fortress, alcoholType at, string name, ushort cost) { base.volume = volume / 1000; base.name = name; this.fortress = fortress; type = at; base.cost = cost; }
public Alcohol() { int i = rnd.Next(0, nameAlcohol.Length); name = nameAlcohol[i]; volume = ((500 + rnd.Next(1500)) / 1000.0); fortress = rnd.Next(1, 50); type = (alcoholType)rnd.Next(4); cost = (ushort)rnd.Next(0, 10000); }
private void addAlcohol_Click(object sender, EventArgs e) { nameAlcohol.BackColor = Color.White; if (nameAlcohol.Text == "") { nameAlcohol.BackColor = Color.Red; return; } mainForm.alcoholCount++; string name = nameAlcohol.Text; double volume = (int)numericUpDown3.Value; alcoholType a = alcoholType.beer; switch (comboBox3.Text) { case "Виски": a = alcoholType.whiskey; break; case "Водка": a = alcoholType.vodka; break; case "Джин": a = alcoholType.gin; break; case "Пиво": a = alcoholType.beer; break; } int fortress = (int)numericUpDown4.Value; ushort cost = (ushort)numericUpDown8.Value; mainForm.drinksList.Add(new Alcohol(volume, fortress, a, name, cost)); nameAlcohol.Clear(); numericUpDown3.Value = 1; numericUpDown4.Value = 1; comboBox3.SelectedIndex = 0; mainForm.isEdit = true; MessageBox.Show("Успешно"); mainForm.ShowInfo(); }