Guest User

MapPinPoint

a guest
Jun 4th, 2024
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.78 KB | Source Code | 0 0
  1. Imports System
  2. Imports System.Collections.Generic
  3. Imports System.Data
  4. Imports System.Data.Common
  5. Imports System.Globalization
  6. Imports System.IO
  7. Imports System.Linq
  8. Imports System.Windows.Forms
  9. Imports Microsoft.VisualBasic
  10. Imports OneStream.Finance.Database
  11. Imports OneStream.Finance.Engine
  12. Imports OneStream.Shared.Common
  13. Imports OneStream.Shared.Database
  14. Imports OneStream.Shared.Engine
  15. Imports OneStream.Shared.Wcf
  16. Imports OneStream.Stage.Database
  17. Imports OneStream.Stage.Engine
  18.  
  19. Namespace OneStream.BusinessRule.DashboardDataSet.MapPinPoint
  20.     Public Class MainClass
  21.         Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
  22.             Try
  23.                 Select Case args.FunctionType                      
  24.                     Case Is = DashboardDataSetFunctionType.GetDataSet          
  25.                         If args.DataSetName.XFEqualsIgnoreCase("LocationPinPoints")        
  26.                             Dim tempDataSet As New XFDataSet
  27.                             Dim collection As New XFMapItemCollection
  28.                             collection = OneStream.Shared.Wcf.XFMapDataSetHelper.CreateXFMapItemCollection(si, tempDataSet)    
  29.                    
  30.                             Dim sSQL As String
  31.                             sSQL = "SELECT a.OriginDestinationKey
  32.                                    , a.Origin
  33.                                    , a.Employee
  34.                                    , CAST(LLo.Lat AS Decimal(8,6)) AS OriginLat
  35.                                    , CAST(LLo.Long AS Decimal(9,6)) AS OriginLong
  36.                                    , a.Destination
  37.                                    , CAST(LLd.Lat AS Decimal(8,6)) AS DestinationLat
  38.                                    , CAST(LLd.Long AS Decimal(9,6)) AS DestinationLong
  39.                                    , a.iDistance
  40.                                    , a.Distance
  41.                                    , a.iTravelTime
  42.                                    , a.TravelTime
  43.                                    FROM aGoogleData a
  44.                                 LEFT OUTER JOIN aGoogleDataLatLong LLo
  45.                                 ON LLo.Location = a.Origin
  46.                                     LEFT OUTER JOIN aGoogleDataLatLong LLd
  47.                                     ON LLd.Location = a.Destination"
  48.  
  49.                             Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
  50.                                 Dim dt As DataTable = BRApi.Database.ExecuteSql(dbConnApp, sSQL, False)
  51.  
  52.                                 If Not dt Is Nothing AndAlso dt.Rows.Count > 0
  53.  
  54.                                     For Each dr As DataRow In dt.Rows
  55.                                         Dim pin As New XFMapPinPoint(dr("OriginLat"), dr("OriginLong"), dr("Origin"), _
  56.                                                         XFImageFileSourceType.DashboardFile,"<Your PICTURE FILE>",0,0, dr("Employee"), XFImageFileSourceType.DashboardFile,"<YOUR PICTURE FILE>")
  57.                                         Collection.AddPinPoint(pin)
  58.  
  59.                                     Next 'dr
  60.                                 End If 'Not dt Is Nothing AndAlso dt.Rows.Count > 0
  61.                             End Using 'dbConnApp
  62.  
  63.                             Return collection.CreateDataSet(si)
  64.                         End If 'args.DataSetName.XFEqualsIgnoreCase("LocationPinPoints")
  65.                 End Select 'Case args.FunctionType
  66.                 Return Nothing
  67.             Catch ex As Exception
  68.                 Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
  69.             End Try
  70.         End Function
  71.     End Class
  72. End Namespace
Tags: OneStream
Advertisement
Add Comment
Please, Sign In to add comment