| | 1669 | Public Shared Sub WriteMailingListIDsToDatabase(ByVal mPilot As EveHQ.Core.Pilot) |
| | 1670 | Dim accountName As String = mPilot.Account |
| | 1671 | Dim mAccount As EveHQ.Core.EveAccount = CType(EveHQ.Core.HQ.EveHQSettings.Accounts.Item(accountName), Core.EveAccount) |
| | 1672 | ' Send this to the API |
| | 1673 | Dim IDXML As XmlDocument = EveHQ.Core.EveAPI.GetAPIXML(EveHQ.Core.EveAPI.APIRequest.MailingLists, mAccount, mPilot.ID, EveHQ.Core.EveAPI.APIReturnMethod.ReturnStandard) |
| | 1674 | ' Parse this XML |
| | 1675 | Dim FinalIDs As New SortedList(Of Long, String) |
| | 1676 | Dim IDList As XmlNodeList |
| | 1677 | Dim IDNode As XmlNode |
| | 1678 | Dim eveID As Long = 0 |
| | 1679 | Dim eveName As String = "" |
| | 1680 | IDList = IDXML.SelectNodes("/eveapi/result/rowset/row") |
| | 1681 | If IDList.Count > 0 Then |
| | 1682 | For Each IDNode In IDList |
| | 1683 | eveID = CLng(IDNode.Attributes.GetNamedItem("listID").Value) |
| | 1684 | eveName = IDNode.Attributes.GetNamedItem("displayName").Value |
| | 1685 | If FinalIDs.ContainsKey(eveID) = False Then |
| | 1686 | FinalIDs.Add(eveID, eveName) |
| | 1687 | End If |
| | 1688 | Next |
| | 1689 | End If |
| | 1690 | ' Add all the data to the database |
| | 1691 | Dim strIDInsert As String = "INSERT INTO eveIDToName (eveID, eveName) VALUES " |
| | 1692 | For Each eveID In FinalIDs.Keys |
| | 1693 | eveName = FinalIDs(eveID) |
| | 1694 | Dim uSQL As New StringBuilder |
| | 1695 | uSQL.Append(strIDInsert) |
| | 1696 | uSQL.Append("(" & eveID & ", ") |
| | 1697 | uSQL.Append("'" & eveName & "');") |
| | 1698 | If EveHQ.Core.DataFunctions.SetData(uSQL.ToString) = False Then |
| | 1699 | 'MessageBox.Show("There was an error writing data to the Eve ID database table. The error was: " & ControlChars.CrLf & ControlChars.CrLf & EveHQ.Core.HQ.dataError & ControlChars.CrLf & ControlChars.CrLf & "Data: " & uSQL.ToString, "Error Writing Eve IDs", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) |
| | 1700 | End If |
| | 1701 | Next |
| | 1702 | End Sub |
| | 1703 | |