jj 07.12 1
This commit is contained in:
@@ -164,6 +164,7 @@ Partial Class frmGeodataNavigation
|
|||||||
Me.grvwMain.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect
|
Me.grvwMain.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect
|
||||||
Me.grvwMain.OptionsView.ColumnAutoWidth = False
|
Me.grvwMain.OptionsView.ColumnAutoWidth = False
|
||||||
Me.grvwMain.OptionsView.EnableAppearanceEvenRow = True
|
Me.grvwMain.OptionsView.EnableAppearanceEvenRow = True
|
||||||
|
Me.grvwMain.OptionsView.ShowAutoFilterRow = True
|
||||||
Me.grvwMain.OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.[True]
|
Me.grvwMain.OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.[True]
|
||||||
'
|
'
|
||||||
'btnSave
|
'btnSave
|
||||||
@@ -175,10 +176,10 @@ Partial Class frmGeodataNavigation
|
|||||||
Me.btnSave.Text = "Save"
|
Me.btnSave.Text = "Save"
|
||||||
Me.btnSave.UseVisualStyleBackColor = True
|
Me.btnSave.UseVisualStyleBackColor = True
|
||||||
'
|
'
|
||||||
'Button1
|
'btnOpenMap
|
||||||
'
|
'
|
||||||
Me.btnOpenMap.Location = New System.Drawing.Point(277, 96)
|
Me.btnOpenMap.Location = New System.Drawing.Point(277, 96)
|
||||||
Me.btnOpenMap.Name = "Button1"
|
Me.btnOpenMap.Name = "btnOpenMap"
|
||||||
Me.btnOpenMap.Size = New System.Drawing.Size(96, 33)
|
Me.btnOpenMap.Size = New System.Drawing.Size(96, 33)
|
||||||
Me.btnOpenMap.TabIndex = 4
|
Me.btnOpenMap.TabIndex = 4
|
||||||
Me.btnOpenMap.Text = "Set on Map"
|
Me.btnOpenMap.Text = "Set on Map"
|
||||||
@@ -209,7 +210,6 @@ Partial Class frmGeodataNavigation
|
|||||||
Me.txtLon.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
Me.txtLon.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||||
Me.txtLon.Location = New System.Drawing.Point(11, 96)
|
Me.txtLon.Location = New System.Drawing.Point(11, 96)
|
||||||
Me.txtLon.Name = "txtLon"
|
Me.txtLon.Name = "txtLon"
|
||||||
Me.txtLon.ReadOnly = True
|
|
||||||
Me.txtLon.Size = New System.Drawing.Size(260, 33)
|
Me.txtLon.Size = New System.Drawing.Size(260, 33)
|
||||||
Me.txtLon.TabIndex = 1
|
Me.txtLon.TabIndex = 1
|
||||||
'
|
'
|
||||||
@@ -218,7 +218,6 @@ Partial Class frmGeodataNavigation
|
|||||||
Me.txtLat.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
Me.txtLat.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||||
Me.txtLat.Location = New System.Drawing.Point(11, 41)
|
Me.txtLat.Location = New System.Drawing.Point(11, 41)
|
||||||
Me.txtLat.Name = "txtLat"
|
Me.txtLat.Name = "txtLat"
|
||||||
Me.txtLat.ReadOnly = True
|
|
||||||
Me.txtLat.Size = New System.Drawing.Size(260, 33)
|
Me.txtLat.Size = New System.Drawing.Size(260, 33)
|
||||||
Me.txtLat.TabIndex = 0
|
Me.txtLat.TabIndex = 0
|
||||||
'
|
'
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Imports DevExpress.XtraEditors
|
|||||||
Imports DevExpress.XtraGrid
|
Imports DevExpress.XtraGrid
|
||||||
Imports DevExpress.Utils
|
Imports DevExpress.Utils
|
||||||
Imports DevExpress.XtraGrid.Columns
|
Imports DevExpress.XtraGrid.Columns
|
||||||
|
Imports DevExpress.XtraEditors.Repository
|
||||||
|
|
||||||
Public Class frmGeodataNavigation
|
Public Class frmGeodataNavigation
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ Public Class frmGeodataNavigation
|
|||||||
Private Grid As GridControl = Nothing
|
Private Grid As GridControl = Nothing
|
||||||
Private CurrentPoint As GeoPoint = Nothing
|
Private CurrentPoint As GeoPoint = Nothing
|
||||||
|
|
||||||
|
#Region "MAP CONTROL"
|
||||||
Private ReadOnly Property ImageLayer() As ImageTilesLayer
|
Private ReadOnly Property ImageLayer() As ImageTilesLayer
|
||||||
Get
|
Get
|
||||||
Return CType(MapControl1.Layers("ImageLayer"), ImageTilesLayer)
|
Return CType(MapControl1.Layers("ImageLayer"), ImageTilesLayer)
|
||||||
@@ -24,16 +26,6 @@ Public Class frmGeodataNavigation
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub New(ByRef gridControl As GridControl, ByVal EntityId As Integer)
|
|
||||||
' Dieser Aufruf ist für den Designer erforderlich.
|
|
||||||
InitializeComponent()
|
|
||||||
|
|
||||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
||||||
Me.Grid = gridControl
|
|
||||||
Me.EntityId = EntityId
|
|
||||||
Me.EntitySql = String.Format("SELECT T.*, T1.LATITUDE, T1.LONGITUDE from VWTEMP_PMO_FORM{0} T,TBPMO_RECORD_GEODATA T1 WHERE T.[Record-ID] = T1.RECORD_ID", Me.EntityId)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function CreateItemList()
|
Private Function CreateItemList()
|
||||||
' Liste für PushPins anlegen
|
' Liste für PushPins anlegen
|
||||||
'Dim items As New List(Of MapPushpin)
|
'Dim items As New List(Of MapPushpin)
|
||||||
@@ -57,13 +49,6 @@ Public Class frmGeodataNavigation
|
|||||||
customElement.SelectedFill = Color.White
|
customElement.SelectedFill = Color.White
|
||||||
|
|
||||||
items.Add(customElement)
|
items.Add(customElement)
|
||||||
|
|
||||||
'Dim pushpin As New MapPushpin()
|
|
||||||
'pushpin.Location = New GeoPoint(lat, lon)
|
|
||||||
'pushpin.Text = row.Item("Record-ID").ToString()
|
|
||||||
'pushpin.Information = row.Item("Record-ID")
|
|
||||||
|
|
||||||
'items.Add(pushpin)
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Return items
|
Return items
|
||||||
@@ -82,6 +67,18 @@ Public Class frmGeodataNavigation
|
|||||||
|
|
||||||
MapControl1.ZoomToFitLayerItems()
|
MapControl1.ZoomToFitLayerItems()
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
Public Sub New(ByRef gridControl As GridControl, ByVal EntityId As Integer)
|
||||||
|
' Dieser Aufruf ist für den Designer erforderlich.
|
||||||
|
InitializeComponent()
|
||||||
|
|
||||||
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||||
|
Me.Grid = gridControl
|
||||||
|
Me.EntityId = EntityId
|
||||||
|
Me.EntitySql = String.Format("SELECT T.*, T1.LATITUDE, T1.LONGITUDE from VWTEMP_PMO_FORM{0} T,TBPMO_RECORD_GEODATA T1 WHERE T.[Record-ID] = T1.RECORD_ID", Me.EntityId)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub frmGeodataNavigation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
Private Sub frmGeodataNavigation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||||
Try
|
Try
|
||||||
@@ -92,6 +89,10 @@ Public Class frmGeodataNavigation
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub LoadGridData()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub frmGeodataNavigation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub frmGeodataNavigation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
Try
|
Try
|
||||||
Dim dataProvider As New BingMapDataProvider()
|
Dim dataProvider As New BingMapDataProvider()
|
||||||
@@ -109,6 +110,18 @@ Public Class frmGeodataNavigation
|
|||||||
Dim listcheck As List(Of String) = ClassHelper.Return_listcheck(CURRENT_FORM_ID)
|
Dim listcheck As List(Of String) = ClassHelper.Return_listcheck(CURRENT_FORM_ID)
|
||||||
Dim listdate As List(Of String) = ClassHelper.Return_listdate(CURRENT_FORM_ID)
|
Dim listdate As List(Of String) = ClassHelper.Return_listdate(CURRENT_FORM_ID)
|
||||||
|
|
||||||
|
Dim CheckBoxEditorForDisplay = New RepositoryItemCheckEdit()
|
||||||
|
CheckBoxEditorForDisplay.ValueChecked = 1
|
||||||
|
CheckBoxEditorForDisplay.ValueUnchecked = 0
|
||||||
|
GridControlGeo.RepositoryItems.Add(CheckBoxEditorForDisplay)
|
||||||
|
|
||||||
|
' Alle Checkbox Spalten durchgehen und CheckBoxEditor zuweisen
|
||||||
|
For Each col As String In listcheck
|
||||||
|
If Not IsNothing(grvwMain.Columns(col)) Then
|
||||||
|
grvwMain.Columns(col).ColumnEdit = CheckBoxEditorForDisplay
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
For Each col As String In listdate
|
For Each col As String In listdate
|
||||||
Dim date_edit As New DevExpress.XtraEditors.Repository.RepositoryItemTimeEdit
|
Dim date_edit As New DevExpress.XtraEditors.Repository.RepositoryItemTimeEdit
|
||||||
Dim date_column As GridColumn = grvwMain.Columns(col)
|
Dim date_column As GridColumn = grvwMain.Columns(col)
|
||||||
@@ -191,8 +204,7 @@ Public Class frmGeodataNavigation
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub grvwMain_RowStyle(sender As Object, e As Views.Grid.RowStyleEventArgs) Handles grvwMain.RowStyle
|
Private Sub grvwMain_RowStyle(sender As Object, e As Views.Grid.RowStyleEventArgs) Handles grvwMain.RowStyle
|
||||||
'TODO: Make Rows without geodata RED
|
If e.RowHandle > 0 Then
|
||||||
If e.RowHandle <> -1 Then
|
|
||||||
Dim row As DataRowView = grvwMain.GetRow(e.RowHandle)
|
Dim row As DataRowView = grvwMain.GetRow(e.RowHandle)
|
||||||
Dim LATITUDE = row.Item("LATITUDE")
|
Dim LATITUDE = row.Item("LATITUDE")
|
||||||
Dim LONGITUDE = row.Item("LONGITUDE")
|
Dim LONGITUDE = row.Item("LONGITUDE")
|
||||||
@@ -207,58 +219,50 @@ Public Class frmGeodataNavigation
|
|||||||
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
|
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
|
||||||
Dim lat, lon As Decimal
|
Dim lat, lon As Decimal
|
||||||
|
|
||||||
Try
|
If currentRow Is Nothing Then
|
||||||
lat = currentRow.Item("LATITUDE")
|
Exit Sub
|
||||||
lon = currentRow.Item("LONGITUDE")
|
End If
|
||||||
Catch ex As InvalidCastException
|
|
||||||
lat = -1
|
|
||||||
lon = -1
|
|
||||||
End Try
|
|
||||||
|
|
||||||
If lat = -1 And lon = -1 Then
|
If currentRow IsNot Nothing AndAlso Not IsDBNull(currentRow.Item("LATITUDE")) And Not IsDBNull(currentRow.Item("LONGITUDE")) Then
|
||||||
|
Dim validLat As Boolean = Decimal.TryParse(currentRow.Item("LATITUDE"), lat)
|
||||||
|
Dim validLon As Boolean = Decimal.TryParse(currentRow.Item("LONGITUDE"), lon)
|
||||||
|
|
||||||
|
If validLat And validLon Then
|
||||||
|
txtLat.Text = lat
|
||||||
|
txtLon.Text = lon
|
||||||
|
Else
|
||||||
|
txtLat.Text = String.Empty
|
||||||
|
txtLon.Text = String.Empty
|
||||||
|
End If
|
||||||
|
Else
|
||||||
txtLat.Text = String.Empty
|
txtLat.Text = String.Empty
|
||||||
txtLon.Text = String.Empty
|
txtLon.Text = String.Empty
|
||||||
CurrentPoint = Nothing
|
|
||||||
Else
|
|
||||||
txtLat.Text = lat
|
|
||||||
txtLon.Text = lon
|
|
||||||
CurrentPoint = New GeoPoint(lat, lon)
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnOpenMap_Click(sender As Object, e As EventArgs) Handles btnOpenMap.Click
|
Private Sub btnOpenMap_Click(sender As Object, e As EventArgs) Handles btnOpenMap.Click
|
||||||
Dim lat, lon As Double
|
Dim point As GeoPoint = GetCurrentPoint()
|
||||||
Dim point As GeoPoint
|
|
||||||
|
|
||||||
Try
|
Dim frm As New frmGeodataSelect(point)
|
||||||
lat = Double.Parse(txtLat.Text)
|
Dim result = frm.ShowDialog()
|
||||||
lon = Double.Parse(txtLon.Text)
|
|
||||||
point = New GeoPoint(lat, lon)
|
|
||||||
Catch ex As Exception
|
|
||||||
point = Nothing
|
|
||||||
Finally
|
|
||||||
Dim frm As New frmGeodataSelect(point)
|
|
||||||
Dim result = frm.ShowDialog()
|
|
||||||
|
|
||||||
If result = Windows.Forms.DialogResult.OK Then
|
If result = Windows.Forms.DialogResult.OK Then
|
||||||
Dim SelectedPoint As GeoPoint = frm.SelectedPoint
|
Dim SelectedPoint As GeoPoint = frm.SelectedPoint
|
||||||
|
|
||||||
txtLat.Text = SelectedPoint.Latitude
|
txtLat.Text = SelectedPoint.Latitude
|
||||||
txtLon.Text = SelectedPoint.Longitude
|
txtLon.Text = SelectedPoint.Longitude
|
||||||
CurrentPoint = SelectedPoint
|
End If
|
||||||
End If
|
|
||||||
End Try
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
|
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
|
||||||
If CurrentPoint Is Nothing Then
|
Dim point As GeoPoint = GetCurrentPoint()
|
||||||
MsgBox("Es wurden keine Koodinaten angegeben!", MsgBoxStyle.Critical)
|
|
||||||
|
If point Is Nothing Then
|
||||||
|
' TODO: Add Error Mesg
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim lat As Decimal = CurrentPoint.Latitude
|
|
||||||
Dim lon As Decimal = CurrentPoint.Longitude
|
|
||||||
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
|
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
|
||||||
Dim RecordId As Integer = currentRow.Item("Record-ID")
|
Dim RecordId As Integer = currentRow.Item("Record-ID")
|
||||||
|
|
||||||
@@ -266,8 +270,8 @@ Public Class frmGeodataNavigation
|
|||||||
Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection(MyConnectionString)
|
Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection(MyConnectionString)
|
||||||
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(SQL, conn)
|
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(SQL, conn)
|
||||||
|
|
||||||
cmd.Parameters.Add("@lat", SqlDbType.Decimal).Value = lat
|
cmd.Parameters.Add("@lat", SqlDbType.Decimal).Value = point.Latitude
|
||||||
cmd.Parameters.Add("@lon", SqlDbType.Decimal).Value = lon
|
cmd.Parameters.Add("@lon", SqlDbType.Decimal).Value = point.Longitude
|
||||||
cmd.Parameters.Add("@who", SqlDbType.VarChar).Value = Environment.UserName
|
cmd.Parameters.Add("@who", SqlDbType.VarChar).Value = Environment.UserName
|
||||||
cmd.Parameters.Add("@recordid", SqlDbType.Int).Value = RecordId
|
cmd.Parameters.Add("@recordid", SqlDbType.Int).Value = RecordId
|
||||||
|
|
||||||
@@ -275,8 +279,24 @@ Public Class frmGeodataNavigation
|
|||||||
cmd.ExecuteNonQuery()
|
cmd.ExecuteNonQuery()
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Error while saving Coordinates: " & vbNewLine & ex.Message)
|
MsgBox("Error while saving Coordinates: " & vbNewLine & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetCurrentPoint() As GeoPoint
|
||||||
|
Dim lat, lon As Decimal
|
||||||
|
|
||||||
|
Dim validLat As Boolean = Decimal.TryParse(txtLat.Text, lat)
|
||||||
|
Dim validLon As Boolean = Decimal.TryParse(txtLon.Text, lon)
|
||||||
|
|
||||||
|
If validLat And validLon Then
|
||||||
|
Return New GeoPoint(lat, lon)
|
||||||
|
Else
|
||||||
|
Return Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
Reference in New Issue
Block a user