Ejemplo n.º 1
0
        private void OkButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            short   year  = 0;
            decimal price = 0;
            decimal worth = 0;

            if (short.TryParse(YearBox.Text, out year) &&
                decimal.TryParse(PriceBox.Text, out price) &&
                decimal.TryParse(WorthBox.Text, out worth) == true &&
                YearBox.Text.Length == 4)
            {
                CarRentalDbWorker.AddNewCar(_connection,
                                            GovNumBox.Text,
                                            ModelBox.Text,
                                            ColorBox.Text,
                                            year,
                                            price,
                                            worth);
                DialogResult = true;
                Close();
            }
            else
            {
                MessageBox.Show("Неверно введены данные");
            }
        }