Esempio n. 1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LicenseModel license = new LicenseModel();
                license.IdDriver      = DriverLogic.GetIdByPassport(PassportDriver.Text);
                license.IdTransport   = LogicTransport.GetIdByVIN(VIN.Text);
                license.LicenseDate   = LicenseDate.SelectedDate.Value;
                license.ExpireDate    = ExpireDate.SelectedDate.Value;
                license.LicenseSeries = Series.Text;
                license.LicenseNumber = Number.Text;

                CategoryLicenseModel category = new CategoryLicenseModel();

                List <string> listCategory = new List <string>();
                if (M.IsChecked == true)
                {
                    category.M = true;
                }
                if (A.IsChecked == true)
                {
                    category.A = true;
                }
                if (A1.IsChecked == true)
                {
                    category.A1 = true;
                }
                if (B.IsChecked == true)
                {
                    category.B = true;
                }
                if (D1.IsChecked == true)
                {
                    category.D1 = true;
                }
                if (D.IsChecked == true)
                {
                    category.D = true;
                }
                if (CE.IsChecked == true)
                {
                    category.CE = true;
                }
                if (C1E.IsChecked == true)
                {
                    category.C1E = true;
                }
                if (BE.IsChecked == true)
                {
                    category.BE = true;
                }
                if (B1.IsChecked == true)
                {
                    category.B1 = true;
                }
                if (C.IsChecked == true)
                {
                    category.C = true;
                }
                if (C1.IsChecked == true)
                {
                    category.C1 = true;
                }
                if (D1E.IsChecked == true)
                {
                    category.D1E = true;
                }
                if (DE.IsChecked == true)
                {
                    category.DE = true;
                }
                if (Tm.IsChecked == true)
                {
                    category.Tm = true;
                }
                if (Tb.IsChecked == true)
                {
                    category.Tb = true;
                }


                LogicLicense.SaveLicense(license);
                category.IdLicense = LogicLicense.GetId(Series.Text + Number.Text);
                LogicCategoryLicense.SaveCategory(category);
                MessageBox.Show("Водительское удостоверение успешно сохранено!");

                InspectorMainWindow inspector = new InspectorMainWindow();
                inspector.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
 public static void SaveCategory(CategoryLicenseModel NewCategory)
 {
     DbContext.db.CategoryLicense.Add(NewCategory);
     DbContext.db.SaveChanges();
 }