I've come full circle on this and have concluded you still need to essentially re-do the business logic and form to extend this in any meaningful way.
The code I showed to replace the AddRange method won't actually work (I've gone and tried it) because the item being added to the collection of lines has properties which are classes that contain friend property setters - so any class outside the assembly won't be allowed to set certain properties... for instance, this part:
- Code: Select all
If manualBoReleaseForm.ManualBOBatch.InventoryItems.Contains(InventoryID) = False Then
newInventoryItem = manualBoReleaseForm.Manager.CollectionItemFactory.CreateCollectionItem(Of InventoryItem)
newInventoryItem.Inventory.ReadRecord(InventoryID)
newInventoryItem.QuantityAvailable = .Sanitise(SQLReader, "QuantityAvailable")
newInventoryItem.RecID = InventoryID
manualBoReleaseForm.ManualBOBatch.InventoryItems.Add(newInventoryItem)
End If
will not be able to work because the QuantityAvailable property of the InventoryItem class has a friend setter. And you cannot just inherit from InventoryItem and shadow the setter because you still won't be able to add that to the InventoryItems collection because it wan'ts it's type of InventoryItem, not a decended one.
And there's a whole bunch more in other classes - specifically SalesOrder and BatchLine.
I think perhaps what Nina was doing was repurposing the Manual BO Release form so that it did something completely different? I can't see how Nina's code could have added to the BatchLines collection and have the form behave as it should after that point.