Пример #1
0
 /// <summary>
 /// delete a row in the database given the datarow that was deleted from the control and datatable
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Table_RowDeleted(object sender, DataRowChangeEventArgs e)
 {
     try
     {
         registrationDB.DeleteTableRow(e.Row);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     //update view
     registrationDB.LoadDataTable(dataGridViewDepartmentMajorsCount.DataSource as DataTable);
 }
Пример #2
0
        private void RegistrationTableRowChanged(DataRowChangeEventArgs e)
        {
            // only insert if there was an Add action. Updates will be handled
            // by ColumnChanged
            if (e.Action == DataRowAction.Add)
            {
                try
                {
                    registrationDB.InsertTableRow(e.Row);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Insertion fail: " + ex.Message);
                }

                // updata a lower control, a view
                registrationDB.LoadDataTable(dataGridViewDepartmentMajorsCount.DataSource as DataTable);
            }
        }