コード例 #1
0
        private void workerAdd_Click(object sender, RoutedEventArgs e)
        {
            DataRow    newRow     = dt.NewRow();
            EditWorker editWindow = new EditWorker(newRow);

            editWindow.ShowDialog();

            if (editWindow.DialogResult.Value)
            {
                dt.Rows.Add(editWindow.resultRow);
                adapter.Update(dt);
                dt.Clear();
                adapter.Fill(dt);
            }
        }
コード例 #2
0
        private void workerEdit_Click(object sender, RoutedEventArgs e)
        {
            DataRowView newRow = (DataRowView)WorkersDG.SelectedItem;

            newRow.BeginEdit();

            EditWorker editWindow = new EditWorker(newRow.Row);

            editWindow.ShowDialog();

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