Esempio n. 1
0
 private void ButtonDeleteMapping_Click(object sender, EventArgs e)
 {
     if (GridViewSupplierCountry.FocusedRowHandle >= 0)
     {
         SupplierCountry suppCountry = (SupplierCountry)GridViewSupplierCountry.GetFocusedRow();
         _selectedRecord.SupplierCountry.Remove(suppCountry);
         //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.
         _context.SupplierCountry.DeleteObject(suppCountry);
         BindSupplierCountry();
     }
 }
Esempio n. 2
0
 private void FinalizeBindings()
 {
     BindingSource.EndEdit();
     GridViewSupplierCountry.CloseEditor();
     GridViewSupplierCountry.UpdateCurrentRow();
     //Set the city code for each mapping just in case
     for (int rowCtr = 0; rowCtr < GridViewSupplierCountry.DataRowCount; rowCtr++)
     {
         SupplierCountry suppCountry = (SupplierCountry)GridViewSupplierCountry.GetRow(rowCtr);
         suppCountry.Country_Code = TextEditCode.Text;
     }
     BindingSourceSupplierCountry.EndEdit();
 }