Ejemplo 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 (GIBDDContainer1 db = new GIBDDContainer1())
         {
             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;
             }
         }
     }
 }
Ejemplo n.º 2
0
 public WinNewDriver()
 {
     InitializeComponent();
     using (GIBDDContainer1 db = new GIBDDContainer1())
     {
         drivers.Clear();
         drivers = db.Drivers.ToList();
     }
 }
Ejemplo n.º 3
0
 private void FillTable()
 {
     drivers.Clear();
     using (GIBDDContainer1 db = new GIBDDContainer1())
     {
         foreach (Transport t in db.Transport)
         {
             drivers.Add(t);
         }
         DataGridDTP.ItemsSource = drivers;
     }
 }
Ejemplo n.º 4
0
 private void FillTable()
 {
     drivers.Clear();
     using (GIBDDContainer1 db = new GIBDDContainer1())
     {
         foreach (Drivers u in db.Drivers)
         {
             drivers.Add(u);
         }
         DataGridVoditeli.ItemsSource = drivers;
     }
 }
Ejemplo n.º 5
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 (GIBDDContainer1 db = new GIBDDContainer1())
                    {
                        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();
            }
        }
Ejemplo n.º 6
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 (GIBDDContainer1 db = new GIBDDContainer1())
                                     {
                                         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("Полььзователь зарегестрирован");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
        private void Button_Click_Add(object sender, RoutedEventArgs e)
        {
            var    index         = DataGridDTP.SelectedItem;
            WinDTP winTransports = new WinDTP();

            if (index != null)
            {
                this.Hide();
                int id = int.Parse((DataGridDTP.SelectedCells[0].Column.GetCellContent(index) as TextBlock).Text);
                using (GIBDDContainer1 db = new GIBDDContainer1())
                {
                    var transport = db.Transport.Join(db.Manufacture, p => p.Manufacturer, c => c.Id, (p, c) => new { Vin = p.VIN, IdDriver = p.IdDriver, Manufacture = c.Name, Model = p.Model, Year = p.Year, Weight = p.Weight }).ToList();
                    winTransports.DataGridDTP.ItemsSource = transport;
                    Transport driver = db.Transport.Find(id);
                    winTransports.Show();
                }
            }
        }