I'm trying to model objects for the following problem:
A building site contains assemblies, each of which can contain other
assemblies and/or materials.
I have modelled this using a Site class, Assembly class, and Material class
as follows...
Site Class (clsSite):
Option Explicit
'General Details
Public ProjectNumber As String
Public SiteWBSCode As String
Public SiteType As String
Public LastUpdateFirstName As String
Public LastUpdateSurname As String
Public LastUpdateDate As Date
Public TotalPriceOfAllMaterials As Double
Public GeneralNotes As String
'Contents of Site
Public SiteAssemblies As clsAssemblies 'a collection class of clsAssembly
Public SiteMaterials As clsMaterials 'a collection class of clsMaterial
Assembly Class (clsAssembly):
Option Explicit
'General Details
Public ID As Long
Public QuantityRequested As Integer
Public QuantityIssued As Integer
'Contents
Public AssemblyAssemblies As clsAssemblies 'a collection class of
clsAssembly
Public AssemblyMaterials As clsMaterials 'a collection class of clsMaterial
Material Class (clsMaterial)
Option Explicit
'General Details
Public InventoryCode As String
Public Rate As Double
Public QuantityRequested As Integer
Public QuantityIssued As Integer
Public TotalPrice As Double
Public DateAmended As Date
My questions are:
1. Have I modelled the problem correctly?
2. There is the potential for an infinite hierarchy of Assemblies - is this
ok?
3. If so, I am having problems imagining how I would iterate through say all
the materials to update their 'Rate' for example.
4. I'm also having problems imagining how I would go and find a material if
its 'Quantity Requested' has changed, given that it could be any number of
levels down.
I've spent hours without making much progress. Please help if you know the
answer to any of these questions.
Many Thanks
Iain