public void randomCarDealers() { Random random = new Random(); for (int i = 0; i < 5; i++) { float age = random.Next(-5, 6); float beuty = random.Next(-5, 6); CarDealer carDealer = new CarDealer(age, beuty, "CarDealer" + i.ToString()); carDealers.Add(carDealer); CarDealerListBox.Items.Add(carDealer.toString()); } }
private void AddCarDealerButton_Click(object sender, EventArgs e) { bool isDataCorrect = validateService.validateValuesForElement( CarDealerBeautyTB, CarDealerOldTB, CarDealerName); if (isDataCorrect) { float beuty = float.Parse(CarDealerBeautyTB.Text); float old = float.Parse(CarDealerOldTB.Text); updateMaxPointValue(beuty); updateMaxPointValue(old); String name = CarDealerName.Text; CarDealer carDealer = new CarDealer(old, beuty, name); carDealers.Add(carDealer); CarDealerListBox.Items.Add(carDealer.toString()); } else { MessageBox.Show("Nieprawidłowe wartości dla komisu."); } }