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

            cv.Show();
            Close();
        }
Пример #2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            ComputerViewMaster cv = new ComputerViewMaster();

            cv.Show();
            Close();
        }
Пример #3
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("Техника добавлена!");
         ComputerViewMaster cv = new ComputerViewMaster();
         cv.Show();
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        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("Данные о технике изменены!");
            ComputerViewMaster cv = new ComputerViewMaster();

            cv.Show();
            Close();
        }