Пример #1
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            ComputerView cv = new ComputerView();

            cv.ShowDialog();
            Close();
        }
Пример #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Model1    db  = new Model1();
         Computers cmp = new Computers
         {
             problem     = problem.Text,
             brand       = brand.Text,
             name        = equipment.Text,
             model       = model.Text,
             description = description.Text
         };
         db.Computers.Add(cmp);
         db.SaveChanges();
         MessageBox.Show("Техника добавлена!");
         ComputerView cv = new ComputerView();
         cv.Show();
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
        private void viewCOMP_Click(object sender, RoutedEventArgs e)
        {
            ComputerView cv1 = new ComputerView();

            cv1.Show();
            Close();
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Model1 db  = new Model1();
            int    a   = Convert.ToInt32(idtxt.Text);
            var    cls = db.Computers
                         .Where(c => c.id_comp == a)
                         .FirstOrDefault();

            cls.name        = name.Text;
            cls.brand       = brand.Text;
            cls.model       = model.Text;
            cls.problem     = problem.Text;
            cls.description = descr.Text;
            db.SaveChanges();

            MessageBox.Show("Данные о технике изменены!");
            ComputerView cv = new ComputerView();

            cv.Show();
            Close();
        }