I have an Object, called boot. This boot contains two other objects - a headset and a shellset.
Each headset and shellset contains 1 head and 1 shell respectively.
My code is not working as expected....I really need some help on this one!
Here is the code for my Head/HeadSet
Option Explicit On
Public Class Head
Inherits WQS_BusinessEntity.HeadSet
#Region "Private Variables"
Private _iVesselID As Integer
Private _iHeadID As Integer
Private _iMaterialID As Integer
Private _iLocationID As Integer
Private _strMaterial As String
Private _dDiameter As Double
Private _dCurrentThickness As Double
Private _dNominalThickness As Double
Private _strShape As String
Private _iShapeID As Integer
Private _strLocation As String
#End Region
#Region "Constructors"
Public Sub New()
End Sub
Public Sub New(ByVal iVesselID As Integer, ByVal iHeadID As Integer, ByVal iMaterialID As Integer, ByVal iLocationID As Integer, _
ByVal strMaterial As String, ByVal dDiameter As Double, ByVal dCurrentThickness As Double, ByVal dNominalThickness As Double, ByVal strShape As String, ByVal iShapeID As Integer, ByVal strLocation As String)
_iVesselID = iVesselID
_iHeadID = iHeadID
_iLocationID = iLocationID
_strMaterial = strMaterial
_dDiameter = dDiameter
_dCurrentThickness = dCurrentThickness
_dNominalThickness = dNominalThickness
_iShapeID = iShapeID
_strShape = strShape
_strLocation = strLocation
End Sub
#End Region
#Region "Public Properties"
Public Property iVesselID() As Integer
Get
Return _iVesselID
End Get
Set(ByVal iValue As Integer)
_iVesselID = iValue
End Set
End Property
Public Property iHeadID() As Integer
Get
Return _iHeadID
End Get
Set(ByVal iValue As Integer)
_iHeadID = iValue
End Set
End Property
Public Property iShapeID() As Integer
Get
Return _iShapeID
End Get
Set(ByVal iValue As Integer)
_iShapeID = iValue
End Set
End Property
Public Property iLocationID() As Integer
Get
Return _iLocationID
End Get
Set(ByVal iValue As Integer)
_iLocationID = iValue
End Set
End Property
Public Property iMaterialID() As Integer
Get
Return _iMaterialID
End Get
Set(ByVal iValue As Integer)
_iMaterialID = iValue
End Set
End Property
Public Property strMaterial() As String
Get
Return _strMaterial
End Get
Set(ByVal strValue As String)
_strMaterial = strValue
End Set
End Property
Public Property dDiameter() As Double
Get
Return _dDiameter
End Get
Set(ByVal dValue As Double)
_dDiameter = dValue
End Set
End Property
Public Property dCurrentThickness() As Double
Get
Return _dCurrentThickness
End Get
Set(ByVal dValue As Double)
_dCurrentThickness = dValue
End Set
End Property
Public Property dNominalThickness() As Double
Get
Return _dNominalThickness
End Get
Set(ByVal dValue As Double)
_dNominalThickness = dValue
End Set
End Property
Public Property strShape() As String
Get
Return _strShape
End Get
Set(ByVal strValue As String)
_strShape = strValue
End Set
End Property
Public Property strLocation() As String
Get
Return _strLocation
End Get
Set(ByVal strValue As String)
_strLocation = strValue
End Set
End Property
#End Region
End Class
Public Class HeadSet
Inherits Collections.ArrayList
Public Shadows Function Add(ByVal oValue As Head) As Integer
If Not oValue Is Nothing Then
MyBase.Add(oValue)
End If
End Function
Default Public Shadows Property Item(ByVal iIndex As Integer) As Head
Get
Return CType(MyBase.Item(iIndex), Head)
End Get
Set(ByVal Value As Head)
MyBase.Item(iIndex) = Value
End Set
End Property
End Class
...And here is the code containing the Shells
Option Explicit On
Public Class Shell
Inherits WQS_BusinessEntity.ShellSet
#Region "Private Variables"
Private _iVesselID As Integer
Private _iShellID As Integer
Private _iMaterialID As Integer
Private _strMaterial As String
Private _dDiameter As Double
Private _dCurrentThickness As Double
Private _dNominalThickness As Double
Private _cOrientation As Char
#End Region
#Region "Constructors"
Public Sub New()
End Sub
Public Sub New(ByVal iVesselID As Integer, ByVal iShellID As Integer, ByVal iMaterialID As Integer, _
ByVal strMaterial As String, ByVal dDiameter As Double, ByVal dCurrentThickness As Double, _
ByVal dNominalThickness As Double, ByVal cOrientation As Char)
_iVesselID = iVesselID
_iShellID = iShellID
_iMaterialID = iMaterialID
_strMaterial = strMaterial
_dDiameter = dDiameter
_dCurrentThickness = dCurrentThickness
_dNominalThickness = dNominalThickness
_cOrientation = cOrientation
End Sub
#End Region
#Region "Public Properties"
Public Property iVesselID() As Integer
Get
Return _iVesselID
End Get
Set(ByVal iValue As Integer)
_iVesselID = iValue
End Set
End Property
Public Property iShellID() As Integer
Get
Return _iShellID
End Get
Set(ByVal iValue As Integer)
_iShellID = iValue
End Set
End Property
Public Property iMaterialID() As Integer
Get
Return _iMaterialID
End Get
Set(ByVal iValue As Integer)
_iMaterialID = iValue
End Set
End Property
Public Property strMaterial() As String
Get
Return _strMaterial
End Get
Set(ByVal strValue As String)
_strMaterial = strValue
End Set
End Property
Public Property dDiameter() As Double
Get
Return _dDiameter
End Get
Set(ByVal dValue As Double)
_dDiameter = dValue
End Set
End Property
Public Property dCurrentThickness() As Double
Get
Return _dCurrentThickness
End Get
Set(ByVal dValue As Double)
_dCurrentThickness = dValue
End Set
End Property
Public Property dNominalThickness() As Double
Get
Return _dNominalThickness
End Get
Set(ByVal dValue As Double)
_dNominalThickness = dValue
End Set
End Property
Public Property cOrientation() As Char
Get
Return _cOrientation
End Get
Set(ByVal chValue As Char)
_cOrientation = chValue
End Set
End Property
#End Region
End Class
Public Class ShellSet
Inherits Collections.ArrayList
Public Shadows Function Add(ByVal oValue As Shell) As Integer
If Not oValue Is Nothing Then
MyBase.Add(oValue)
End If
End Function
Default Public Shadows Property Item(ByVal iIndex As Integer) As Shell
Get
Return CType(MyBase.Item(iIndex), Shell)
End Get
Set(ByVal Value As Shell)
MyBase.Item(iIndex) = Value
End Set
End Property
End Class
Both of these live in the Business Entity layer.
I am encountering the difficult in my DataAccess Layer.
Here is the code DataSet to BootSet from the BootDAL:
Private Function DataSetToBootSet(ByVal oDS As DataSet) As WQS_BusinessEntity.BootSet
Dim oRow As DataRow
Dim oSet As New WQS_BusinessEntity.BootSet
Dim iCount As Integer = 0
'Dim iTable As Integer
'iTable = oDS.Tables.Count - 1
For Each oRow In oDS.Tables(1).Rows
Dim oItem As New WQS_BusinessEntity.Boot
With oItem
'Add a Shell and a Head to the Boot's Head and Shell Sets
'oItem.oShellSet.Add(New WQS_BusinessEntity.Shell)
'oItem.oHeadSet.Add(New WQS_BusinessEntity.Head)
'Boot Data
.iBootID = oDS.Tables(0).Rows(iCount).Item("BootID")
.iBootTypeID = oDS.Tables(1).Rows(iCount).Item("BootFunctionTypeId")
.iVesselID = oDS.Tables(1).Rows(iCount).Item("VesselId")
'1 head, 1 shell per boot now.
'Head Data
oItem.oHeadSet.Item(0).iHeadID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadId"))
oItem.oHeadSet.Item(0).iVesselID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("VesselId"))
oItem.oHeadSet.Item(0).iMaterialID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadMaterialId"))
oItem.oHeadSet.Item(0).iLocationID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadLocationId"))
oItem.oHeadSet.Item(0).strMaterial = oDS.Tables(1).Rows(iCount).Item("HeadMaterialName")
oItem.oHeadSet.Item(0).dDiameter = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadDiameter"))
oItem.oHeadSet.Item(0).dCurrentThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadCurrentThickness"))
oItem.oHeadSet.Item(0).dNominalThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadNominalThickness"))
oItem.oHeadSet.Item(0).strShape = oDS.Tables(1).Rows(iCount).Item("HeadShapeName")
oItem.oHeadSet.Item(0).iShapeID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadShapeId"))
oItem.oHeadSet.Item(0).strLocation = EmptyIfNull(oDS.Tables(1).Rows(iCount).Item("HeadLocationOnVesselName"))
'Shell(Data)
oItem.oShellSet.Item(0).iShellID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellId"))
oItem.oShellSet.Item(0).iVesselID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("VesselId"))
oItem.oShellSet.Item(0).iMaterialID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellMaterialId"))
oItem.oShellSet.Item(0).strMaterial = EmptyIfNull(oDS.Tables(1).Rows(iCount).Item("ShellMaterialName"))
oItem.oShellSet.Item(0).dDiameter = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellDiameter"))
oItem.oShellSet.Item(0).dCurrentThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellCurrentThickness"))
oItem.oShellSet.Item(0).dNominalThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellNominalThickness"))
Select Case oDS.Tables(1).Rows(iCount).Item("ShellOrientation")
Case 0.0
oItem.oShellSet.Item(0).cOrientation = "H"
Case 90.0
oItem.oShellSet.Item(0).cOrientation = "V"
Case Else
'default to horizontal
oItem.oShellSet.Item(0).cOrientation = "H"
End Select
End With
'Add the Boot to the BootSet
oSet.Add(oItem)
iCount = iCount + 1
Next
Return oSet
End Function
The code does not throw an error. But when I put a watch on oSet (the returned BootSet Object) I get what you see in the attached screenshot. I need to be able to access the Head and Shell Data, which I dont see ...this data is used to populate a gridview on the presentation layer. Please Help!