private void buttonFind_Click(object sender, EventArgs e) { Sound.MakeSound("ButtonClick"); List <EconomCar> economCars = new List <EconomCar>(); XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <EconomCar>)); using (Stream stream = File.OpenRead(@"..\..\XML\EconomCars.xml")) { economCars = (List <EconomCar>)xmlSerializer.Deserialize(stream); } economCar = new EconomCar(); economCar.IsChildSeat = checkBoxChildSeat.Checked; economCar.IsWheelChair = checkBoxWheelChair.Checked; economCar.NumberOfSeats = Convert.ToInt32(numericUpDownAmountPeople.Value); for (int i = 0; i < economCars.Count; ++i) { if ((economCars[i].IsMatch(economCar)) != null) { economCar = economCars[i]; break; } } DialogResult = DialogResult.OK; }
public EconomCar IsMatch(EconomCar car) { if (IsChildSeat == car.IsChildSeat && IsWheelChair == car.IsWheelChair && this.NumberOfSeats >= car.NumberOfSeats && this.taxist.IsWorking == false) { return(this); } else { return(null); } }
public TaxistEconomCarDetails(Car mainCar, bool isEnglish) { InitializeComponent(); car = (EconomCar)mainCar; if (isEnglish) { labelAmountSeats.Text = "Amount seats:"; checkBoxChildSeat.Text = "Child seat"; checkBoxWheelChair.Text = "Wheel chair"; } else { labelAmountSeats.Text = "К-сть сидінь:"; checkBoxChildSeat.Text = "Дитячий візок"; checkBoxWheelChair.Text = "Інвалідне крісло"; } }