private void ButtonAddMapping_Click(object sender, EventArgs e) { SupplierState suppState = new SupplierState(); suppState.State_Code = TextEditCode.Text; _selectedRecord.SupplierState.Add(suppState); BindSupplierState(); GridViewSupplierState.FocusedRowHandle = BindingSourceSupplierState.Count - 1; }
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(); }
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(); } }
internal override bool isValid() { int requiredFilterCount = SupplierID.NullSafeLength() + LeadTime1.NullSafeLength() + LeadTime2.NullSafeLength() + SupplierCompany.NullSafeLength() + SupplierCurrencyCode.NullSafeLength() + SupplierCity.NullSafeLength() + SupplierState.NullSafeLength() + SupplierCountry.NullSafeLength(); if (requiredFilterCount != 0) { return(true); } throw new NetoRequestException("At least one filter is required in the GetSupplier request"); }