Example #1
0
        private void BtnAddEmp_Click(object sender, RoutedEventArgs e)
        {
            DataRow    newRow     = dt.NewRow();
            editWindow editWindow = new editWindow(newRow);

            editWindow.ShowDialog();
            if (editWindow.DialogResult.Value)
            {
                dt.Rows.Add(editWindow.resultRow);
                adapter.Update(dt);
            }
        }
Example #2
0
        private void BtnChengeEmp_Click(object sender, RoutedEventArgs e)
        {
            DataRowView newRow = (DataRowView)EmployeeDataGrid.SelectedItem; //выбор строки

            newRow.BeginEdit();
            editWindow editWindow = new editWindow(newRow.Row);

            editWindow.ShowDialog();
            if (editWindow.DialogResult.HasValue && editWindow.DialogResult.Value)
            {
                newRow.EndEdit();
                adapter.Update(dt);
            }
            else
            {
                newRow.CancelEdit();
            }
        }