예제 #1
0
        private void AddDep_Click(object sender, RoutedEventArgs e)
        {
            DataRow newRow     = dtDepartments.NewRow();
            EditDep editWindow = new EditDep(newRow);

            editWindow.ShowDialog();

            if (editWindow.DialogResult.Value)
            {
                dtDepartments.Rows.Add(editWindow.resultRow);
                adapterDep.Update(dtDepartments);
            }
        }
예제 #2
0
 private void EditDep_Click(object sender, RoutedEventArgs e)
 {
     if (DepBox.SelectedIndex > -1)
     {
         DataRowView curRow = (DataRowView)DepBox.SelectedItem;
         curRow.BeginEdit();
         EditDep editWindow = new EditDep(curRow.Row);
         editWindow.ShowDialog();
         if (editWindow.DialogResult.Value)
         {
             curRow.EndEdit();
             adapterDep.Update(dtDepartments);
         }
         else
         {
             curRow.CancelEdit();
         }
     }
 }