コード例 #1
0
        private void buttonAddWorker_Click(object sender, RoutedEventArgs e)
        {
            AddWorker wind = new AddWorker();

            wind.Closing += AddWorker_Closing;
            wind.ShowDialog();
        }
コード例 #2
0
 private void button_EditWorker_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridWorker.SelectedItem != null)
     {
         MyContext db   = new MyContext();
         Employee  s    = dataGridWorker.SelectedItem as Employee;
         AddWorker wind = new AddWorker();
         wind.textBox_login.Text         = s.Login;
         wind.textBox_name.Text          = s.Name;
         wind.textBox_surname.Text       = s.Surname;
         wind.comboBox_role.SelectedItem = s.Role;
         wind.textBlock_Id.Text          = Convert.ToString(s.Id);
         wind.Closing += AddWorker_Closing;
         wind.ShowDialog();
     }
     else
     {
         MessageBox.Show("Вы не выбрали запись для редактирования!", "Ошибка");
     }
 }