예제 #1
0
 private void FinalizeBindings()
 {
     BindingSource.EndEdit();
     GridViewSupplierState.CloseEditor();
     GridViewSupplierState.UpdateCurrentRow();
     //Set the city code for each mapping just in case
     for (int rowCtr = 0; rowCtr < GridViewSupplierState.DataRowCount; rowCtr++)
     {
         SupplierState suppState = (SupplierState)GridViewSupplierState.GetRow(rowCtr);
         suppState.State_Code = TextEditCode.Text;
     }
     BindingSourceSupplierState.EndEdit();
 }
예제 #2
0
 private void ButtonDeleteMapping_Click(object sender, EventArgs e)
 {
     if (GridViewSupplierState.FocusedRowHandle >= 0)
     {
         SupplierState suppState = (SupplierState)GridViewSupplierState.GetFocusedRow();
         _selectedRecord.SupplierState.Remove(suppState);
         //Removing from the collection just removes the object from its parent, but does not mark
         //it for deletion, effectively orphaning it.  This will cause foreign key errors when saving.
         //To flag for deletion, delete it from the context as well.
         _selectedRecord.SupplierState.Remove(suppState);
         _context.SupplierState.DeleteObject(suppState);
         BindSupplierState();
     }
 }