Exemplo n.º 1
0
 private void ButtonVY_Click(object sender, RoutedEventArgs e)
 {
     if (DataGridVoditeli.Items.Count > 0)
     {
         var index = DataGridVoditeli.SelectedItem;
         if (index != null)
         {
             id = int.Parse((DataGridVoditeli.SelectedCells[0].Column.GetCellContent(index) as TextBlock).Text);
         }
         WinVY winVY = new WinVY();
         using (GIBDDContainer db = new GIBDDContainer())
         {
             var licenses = db.Licences.First(p => p.idDriver == id);
             winVY.TextBoxLic.Text    = licenses.LicenceSeries;
             winVY.TextBoxNumber.Text = licenses.LicenceNumber.ToString();
             winVY.TextBoxExpire.Text = licenses.ExpireDate.ToString();
             winVY.TextBoxVidan.Text  = licenses.Issued;
             winVY.TextBoxDate.Text   = licenses.LicenceDate.ToString();
             winVY.TextBoxVidan.Text  = licenses.Issued;
             winVY.TextBoxCity.Text   = licenses.City;
             if (!winVY.ShowDialog().HasValue)
             {
                 return;
             }
         }
     }
 }
 public WinVinTransports()
 {
     InitializeComponent();
     using (GIBDDContainer db = new GIBDDContainer())
     {
         drivers.Clear();
         drivers = db.Drivers.ToList();
     }
 }
Exemplo n.º 3
0
 private void FillTable()
 {
     drivers.Clear();
     using (GIBDDContainer db = new GIBDDContainer())
     {
         foreach (Drivers u in db.Drivers)
         {
             drivers.Add(u);
         }
         DataGridVoditeli.ItemsSource = drivers;
     }
 }
Exemplo n.º 4
0
        private void ButtonIz_Click(object sender, RoutedEventArgs e)
        {
            WinIz dobDriver = new WinIz();

            if (DataGridVoditeli.Items.Count > 0)
            {
                var index = DataGridVoditeli.SelectedItem;
                if (index != null)
                {
                    int id = int.Parse((DataGridVoditeli.SelectedCells[0].Column.GetCellContent(index) as TextBlock).Text);
                    using (GIBDDContainer db = new GIBDDContainer())
                    {
                        Drivers driver = db.Drivers.Find(id);
                        dobDriver.TextBoxIden.Text  = driver.Id.ToString();
                        dobDriver.TextBoxFam.Text   = driver.Lastname;
                        dobDriver.TextBoxName.Text  = driver.Name;
                        dobDriver.TextBoxMid.Text   = driver.Middlename;
                        dobDriver.TextBoxSer.Text   = driver.PassportSerial.ToString();
                        dobDriver.TextBoxNum.Text   = driver.PassportNumber.ToString();
                        dobDriver.TextBoxReg.Text   = driver.Address;
                        dobDriver.TextBoxPro.Text   = driver.Address;
                        dobDriver.TextBoxRab.Text   = driver.Company;
                        dobDriver.TextBoxDol.Text   = driver.Jobname;
                        dobDriver.TextBoxPhone.Text = driver.Phone;
                        dobDriver.TextBoxEmail.Text = driver.Email;
                        string photo = "C:\\Users\\3курс\\Desktop\\мдк 01.01\\01.02\\GIBDD\\bin\\Debug\\photo\\" + driver.Photo;
                        dobDriver.TextBoxZam.Text = driver.Description;

                        if (dobDriver.ShowDialog().HasValue)
                        {
                            return;
                        }

                        driver.Lastname       = dobDriver.TextBoxFam.Text;
                        driver.Name           = dobDriver.TextBoxName.Text;
                        driver.Middlename     = dobDriver.TextBoxMid.Text;
                        driver.PassportSerial = int.Parse(dobDriver.TextBoxSer.Text);
                        driver.PassportNumber = int.Parse(dobDriver.TextBoxNum.Text);
                        driver.Address        = dobDriver.TextBoxReg.Text;
                        driver.Address        = dobDriver.TextBoxPro.Text;
                        driver.Company        = dobDriver.TextBoxRab.Text;
                        driver.Jobname        = dobDriver.TextBoxDol.Text;
                        driver.Phone          = dobDriver.TextBoxPhone.Text;
                        driver.Email          = dobDriver.TextBoxEmail.Text;
                        driver.Description    = dobDriver.TextBoxZam.Text;
                        db.SaveChanges();
                    }
                }
                FillTable();
            }
        }
Exemplo n.º 5
0
 private void ButtonZap_Click(object sender, RoutedEventArgs e)
 {
     if (TextBoxFam.Text.Length != 0)
     {
         if (TextBoxName.Text.Length != 0)
         {
             if (TextBoxMid.Text.Length != 0)
             {
                 if (TextBoxSer.Text.Length != 0 || TextBoxNum.Text.Length != 0)
                 {
                     if (TextBoxReg.Text.Length != 0 || TextBoxPro.Text.Length != 0)
                     {
                         if (TextBoxPhone.Text.Length != 0)
                         {
                             if (TextBoxEmail.Text.Length != 0 && CheckEmail(TextBoxEmail.Text) == true)
                             {
                                 if (path != null)
                                 {
                                     using (GIBDDContainer db = new GIBDDContainer())
                                     {
                                         Drivers driver = new Drivers();
                                         driver.Id             = int.Parse(TextBoxIden.Text);
                                         driver.Name           = TextBoxName.Text;
                                         driver.Lastname       = TextBoxFam.Text;
                                         driver.Middlename     = TextBoxMid.Text;
                                         driver.PassportSerial = int.Parse(TextBoxSer.Text);
                                         driver.PassportNumber = int.Parse(TextBoxNum.Text);
                                         driver.Postcode       = int.Parse(TextBoxIden.Text);
                                         driver.Address        = TextBoxReg.Text;
                                         driver.AddressLife    = TextBoxPro.Text;
                                         driver.Company        = TextBoxRab.Text;
                                         driver.Jobname        = TextBoxDol.Text;
                                         driver.Phone          = TextBoxPhone.Text;
                                         driver.Email          = TextBoxEmail.Text;
                                         driver.Description    = TextBoxZam.Text;
                                         driver.Photo          = path.Substring(path.LastIndexOf("\\") + 1);
                                         db.Drivers.Add(driver);
                                         db.SaveChanges();
                                         MessageBox.Show("Полььзователь зарегестрирован");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }