예제 #1
0
        /// <summary>
        /// Insert a record into the db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Table_RowChanged(object sender, DataRowChangeEventArgs e)
        {
            //insert if there was an add action
            if (e.Action == DataRowAction.Add)
            {
                try
                {
                    registrationDB.InsertTableRow(e.Row);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Insertion failed: " + ex.Message);
                }

                //update view (dapartmentmajorscount)
                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);
            }
        }