I am attempting to add a column for the sales order entry person onto the Time Phase Inquiry grid.
It appears that it is only returning the first row even though I have implemented a for each/next loop.
What am I missing?
'//**************************************************
'// Custom VB.NET code for TimePhasForm
'// Created: 7/27/2017 9:18:56 AM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Erp.UI
Imports Ice.Lib.Framework
Imports Ice.Lib.ExtendedProps
Imports Ice.UI.FormFunctions
Imports Ice.Lib.Customization
Imports Ice.Adapters
Imports Erp.Adapters
Imports Ice.Lib.Searches
Imports Ice.Lib
Imports Erp.BO
Imports Ice.BO
Imports Erp.Proxy.BO
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
Private WithEvents edvTimePhas As EpiDataView
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
edvTimePhas = CType(oTrans.EpiDataViews("TimePhas"), EpiDataView)
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
If Not (edvTimePhas.dataView.Table.Columns.Contains("EntryPerson")) Then
edvTimePhas.dataView.Table.Columns.Add(new DataColumn("EntryPerson"))
End If
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub edvTimePhas_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvTimePhas.EpiViewNotification
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
If (args.Row > -1) Then
AddEntryPerson()
End If
End If
End Sub
Private Sub AddEntryPerson()
For Each dr As DataRow In edvTimePhas.dataView.Table.Rows
If Not IsDBNull(dr("OrderNum")) Then
dr("EntryPerson") = getEntryPerson(dr("OrderNum"))
End If
Next
End Sub
Private Function getEntryPerson(ByVal order As String) As String
Dim EntryPerson As String
Dim recordSelected As Boolean
Dim showSearch As Boolean = False
Dim whereClause As String = "OrderNum = '" + order + "'"
Dim dsOrderInfo As DataSet = SearchFunctions.listLookup(TimePhasForm, "SalesOrderAdapter", recordSelected, showSearch, whereClause)
If recordSelected Then
EntryPerson = dsOrderInfo.Tables(0).Rows(0)("EntryPerson").ToString()
Else
EntryPerson = "n/a"
End If
Return EntryPerson
End Function
End Module