示例#1
0
        private void adddepartment(object sender, RoutedEventArgs e)
        {
            DataRow newRow  = dtdep.NewRow();
            DepEdit depEdit = new DepEdit(newRow);

            depEdit.ShowDialog();

            if (depEdit.DialogResult.Value)
            {
                dtdep.Rows.Add(depEdit.resultRow);
                adapter.Update(dtdep);
            }
        }
示例#2
0
        private void changedepartment(object sender, RoutedEventArgs e)
        {
            DataRowView newRow = (DataRowView)departmentDataGrid.SelectedItem;

            newRow.BeginEdit();

            DepEdit depEdit = new DepEdit(newRow.Row);

            depEdit.ShowDialog();

            if (depEdit.DialogResult.HasValue && depEdit.DialogResult.Value)
            {
                newRow.EndEdit();
                adapter.Update(dtdep);
            }
            else
            {
                newRow.CancelEdit();
            }
        }