Private Function GetUserDTFromOA() As DataTable
Dim strUserInfoXML As String = GetUserInfoXML()
Dim xmlDom As New XmlDocument
Dim rowNodes As XmlNodeList
Dim i As Int16
Dim dtUserFromOA As DataTable = New DataTable()
dtUserFromOA.Columns.Add("UserCode", Type.GetType("System.String"))
dtUserFromOA.Columns.Add("UserName", Type.GetType("System.String"))
dtUserFromOA.Columns.Add("MobilePhone", Type.GetType("System.String"))
dtUserFromOA.Columns.Add("UserGUID", Type.GetType("System.String"))
dtUserFromOA.Columns.Add("rowid", Type.GetType("System.Int16"))
xmlDom.LoadXml(strUserInfoXML)
rowNodes = xmlDom.SelectNodes("accounts/account")
If rowNodes.Count > 0 Then
For i = 0 To rowNodes.Count - 1
Dim dr As DataRow = dtUserFromOA.NewRow
dr(0) = rowNodes(i).InnerText
dr(1) = rowNodes(i).Attributes("username").Value
dr(2) = rowNodes(i).Attributes("unit").Value
dr(3) = MyDB.GetDataItemString("select ISNULL(UserGUID,'') from myUser where UserCode= '" & rowNodes(i).InnerText & "'")
dr(4) = i + 1
dtUserFromOA.Rows.Add(dr)
Next
End If
Return dtUserFromOA
End Function
Private Function GetUserInfoXML() As String
Dim strUserInfoXML As StringBuilder = New StringBuilder("")
strUserInfoXML.Append("<accounts>")
strUserInfoXML.Append("<account username='username1' unit='mobile1' >useraccount1</account>")
strUserInfoXML.Append("<account username='username2' unit='mobile2' >useraccount2</account>")
strUserInfoXML.Append("<account username='username3' unit='mobile3' >useraccount3</account>")
strUserInfoXML.Append("<account username='username4' unit='mobile4' >useraccount4</account>")
strUserInfoXML.Append("<account username='username5' unit='mobile5' >useraccount5</account>")
strUserInfoXML.Append("<account username='username6' unit='mobile6' >useraccount6</account>")
strUserInfoXML.Append("</accounts>")
Return strUserInfoXML.ToString()
End Function