Here is the web method.
<WebMethod()> _
Public Function GetItemsToPull(ByVal strJobNo As String) As DataSet
Dim MyDataSet As DataSet
Dim objIMFunctions As New clsIMFunctions
MyDataSet = objIMFunctions.GetPartsToPull(strJobNo)
Return MyDataSet
End Function
The class has a function which calls a routine that instantiates a com object
Here is that function and routine.
Public Function GetPartsToPull(ByVal JobNo As String) As DataSet
'This routine will get the parts to be pulled, populate a temporary
' table and put them into a datareader object to be returned to the client
Dim MyWorkTable As DataTable
Dim MyDataset As New DataSet
'Dim MyRow As DataRow
Dim MyCol As DataColumn
'Dim MyDataCommand As New SqlCommand
'Dim MyDataReader As SqlDataReader
'Dim strSql As String
'create the work table
MyWorkTable = New DataTable("ItemsToPull")
MyCol = New DataColumn("ItemNo")
MyCol.DataType = System.Type.GetType("System.String")
MyWorkTable.Columns.Add(MyCol)
MyCol = New DataColumn("Description")
MyCol.DataType = System.Type.GetType("System.String")
MyWorkTable.Columns.Add(MyCol)
MyCol = New DataColumn("Need")
MyCol.DataType = System.Type.GetType("System.Double")
MyWorkTable.Columns.Add(MyCol)
MyCol = New DataColumn("Pulled")
MyCol.DataType = System.Type.GetType("System.Double")
MyWorkTable.Columns.Add(MyCol)
MyCol = New DataColumn("QtyFin")
MyCol.DataType = System.Type.GetType("System.Double")
MyWorkTable.Columns.Add(MyCol)
MyCol = New DataColumn("IsBar")
MyCol.DataType = System.Type.GetType("System.Int32")
MyWorkTable.Columns.Add(MyCol)
My.Log.WriteEntry("Calling routine to get parts")
'Load the items to pull
LoadItemsToPull(JobNo, MyWorkTable)
'Add the table to the dataset
MyDataset.Tables.Add(MyWorkTable)
'Return the dataset
Return MyDataset
End Function
Public Sub LoadItemsToPull(ByVal strJobNo As String, ByRef MyWorkTable As DataTable)
Dim objWip As New Wip.JobSeq
Dim objItem As ItemMaster.InvItem
Dim lAvlShop As Long
'My.Log.WriteEntry("Setting Wip Object")
objWip.GetJobSeq(strJobNo, "01")
lAvlShop = CLng(objWip.QtyRec)
If objWip.WipItem.IType = "SE" Then
For Each objItem In objWip.WipItem.SrBom
LoadItem(objItem, CDbl(lAvlShop), MyWorkTable, True)
Next
Else
For Each objItem In objWip.WipItem.PrdStr
LoadItem(objItem, CDbl(lAvlShop), MyWorkTable)
Next
End If
'cleanup
'objWip = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(objWip)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(objItem)
'My.Log.WriteEntry("Completed routine")
End Sub