Пример #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            Auto openautomobile = new Auto();

            try
            {
                AutoService service = new AutoService(Model.Automobiles);
                openautomobile = service.automobileSearch(btn.Name);
                if (openautomobile.Enable)
                {
                    ClientList clientList = new ClientList(true, openautomobile);
                    clientList.Show();
                }
                else
                {
                    MessageBox.Show("Автомобиля нет в наличии.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
                MessageBox.Show("Вы пытаетесь добавить несуществующий автомобиль", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }