Beispiel #1
0
        private void CreateCar()
        {
            var cd     = new CarDialog();
            var result = cd.ShowDialog();

            if (result != true)
            {
                return;
            }
            int dCount;
            int wCount;

            if (int.TryParse(cd.DoorCountTextBox.Text, out dCount) &&
                int.TryParse(cd.WheelCountTextBox.Text, out wCount))
            {
                var car = new Car(wCount, dCount)
                {
                    DetailNumber = CarList.Count + 1
                };
                CarList.Add(car);
            }
            else
            {
                MessageBox.Show("¬ведены неверные параметры автомобил¤!");
            }
        }
Beispiel #2
0
        //private void ShowPerson(object sender, EventArgs e)
        //{
        //    UserDataGridView.DataSource = _context.Person_MAS.ToList();
        //}

        private void RentCarButton(object sender, EventArgs e)
        {
            if (_context.Car_MAS.Count() == 0)
            {
                MessageBox.Show("Przepraszamy! Aktualnie nie ma samochodu do wypożyczenia", "Brak samochodu", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
            else
            {
                this.Hide();
                var selectedPerson = (Person)UserDataGridView.SelectedRows[0].DataBoundItem;
                //int id = selectedPerson.Id;
                //var dialog = new CarDialog(id, _context);
                var dialog = new CarDialog(selectedPerson, _context);
                dialog.Closed += (s, args) => this.Close();
                dialog.ShowDialog();
            }
        }