Beispiel #1
0
        private void GridTable_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TheSupplier Works = GridTable.SelectedItem as TheSupplier;

            if (Works != null)
            {
                check = db.TheSupplier.Where(w => w.Name == Works.Name && w.ContactNumber == Works.ContactNumber && w.TheContactPerson == Works.TheContactPerson).Select(s => s.id).FirstOrDefault();
            }
            else
            {
                check = 0;
            }
        }
Beispiel #2
0
 public int added()
 {
     if (NameOrg.Text == "" && ContPhone.Text == "" && ContPers.Text == "" && Email.Text == "" && Adress.Text == "")
     {
         return(0);
     }
     if (ContPhone.Text == "")
     {
         return(0);
     }
     if (ContPers.Text == "")
     {
         return(0);
     }
     if (Email.Text == "")
     {
         return(0);
     }
     if (Adress.Text == "")
     {
         return(0);
     }
     if (NameOrg.Text == "")
     {
         return(0);
     }
     else
     {
         TheSupplier sup = new TheSupplier()
         {
             Name             = NameOrg.Text,
             ContactNumber    = ContPhone.Text,
             TheContactPerson = ContPers.Text,
             Email            = Email.Text,
             LegalAddress     = Adress.Text
         };
         db.TheSupplier.Add(sup);
         db.SaveChanges();
         MessageBox.Show("Новый поставщик добавлен");
         return(1);
     }
 }