jj 07.12 3

This commit is contained in:
JenneJ 2016-12-07 14:39:37 +01:00
parent 9aaadf7921
commit 934732780d
4 changed files with 90 additions and 30 deletions

View File

@ -26,6 +26,7 @@ Partial Class frmGeodataNavigation
Dim VectorItemsLayer1 As DevExpress.XtraMap.VectorItemsLayer = New DevExpress.XtraMap.VectorItemsLayer()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmGeodataNavigation))
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip()
Me.btnReload = New System.Windows.Forms.ToolStripButton()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tsLabelRecordCount = New System.Windows.Forms.ToolStripStatusLabel()
Me.MapControl1 = New DevExpress.XtraMap.MapControl()
@ -35,12 +36,14 @@ Partial Class frmGeodataNavigation
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
Me.GridControlGeo = New DevExpress.XtraGrid.GridControl()
Me.grvwMain = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.btnDelete = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.btnOpenMap = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtLon = New System.Windows.Forms.TextBox()
Me.txtLat = New System.Windows.Forms.TextBox()
Me.ToolStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
CType(Me.MapControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -57,12 +60,21 @@ Partial Class frmGeodataNavigation
'
'ToolStrip1
'
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.btnReload})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(1002, 25)
Me.ToolStrip1.TabIndex = 0
Me.ToolStrip1.Text = "ToolStrip1"
'
'btnReload
'
Me.btnReload.Image = Global.DD_Record_Organiser.My.Resources.Resources.refresh_16xLG
Me.btnReload.ImageTransparentColor = System.Drawing.Color.Magenta
Me.btnReload.Name = "btnReload"
Me.btnReload.Size = New System.Drawing.Size(81, 22)
Me.btnReload.Text = "Neu laden"
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsLabelRecordCount})
@ -128,6 +140,7 @@ Partial Class frmGeodataNavigation
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.btnDelete)
Me.SplitContainer1.Panel2.Controls.Add(Me.btnSave)
Me.SplitContainer1.Panel2.Controls.Add(Me.btnOpenMap)
Me.SplitContainer1.Panel2.Controls.Add(Me.Label2)
@ -167,22 +180,36 @@ Partial Class frmGeodataNavigation
Me.grvwMain.OptionsView.ShowAutoFilterRow = True
Me.grvwMain.OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.[True]
'
'btnDelete
'
Me.btnDelete.Image = Global.DD_Record_Organiser.My.Resources.Resources.delete
Me.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnDelete.Location = New System.Drawing.Point(379, 96)
Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(96, 33)
Me.btnDelete.TabIndex = 6
Me.btnDelete.Text = "Löschen"
Me.btnDelete.UseVisualStyleBackColor = True
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(379, 96)
Me.btnSave.Image = Global.DD_Record_Organiser.My.Resources.Resources.save_16xLG
Me.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnSave.Location = New System.Drawing.Point(277, 96)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(96, 33)
Me.btnSave.TabIndex = 5
Me.btnSave.Text = "Save"
Me.btnSave.Text = "Speichern"
Me.btnSave.UseVisualStyleBackColor = True
'
'btnOpenMap
'
Me.btnOpenMap.Location = New System.Drawing.Point(277, 96)
Me.btnOpenMap.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnOpenMap.Location = New System.Drawing.Point(277, 41)
Me.btnOpenMap.Name = "btnOpenMap"
Me.btnOpenMap.Size = New System.Drawing.Size(96, 33)
Me.btnOpenMap.Size = New System.Drawing.Size(198, 33)
Me.btnOpenMap.TabIndex = 4
Me.btnOpenMap.Text = "Set on Map"
Me.btnOpenMap.Text = "Auf Karte setzen"
Me.btnOpenMap.UseVisualStyleBackColor = True
'
'Label2
@ -233,6 +260,8 @@ Partial Class frmGeodataNavigation
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmGeodataNavigation"
Me.Text = "Geodata Navigation"
Me.ToolStrip1.ResumeLayout(False)
Me.ToolStrip1.PerformLayout()
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
CType(Me.MapControl1, System.ComponentModel.ISupportInitialize).EndInit()
@ -267,4 +296,6 @@ Partial Class frmGeodataNavigation
Friend WithEvents txtLat As System.Windows.Forms.TextBox
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents btnOpenMap As System.Windows.Forms.Button
Friend WithEvents btnReload As System.Windows.Forms.ToolStripButton
Friend WithEvents btnDelete As System.Windows.Forms.Button
End Class

View File

@ -106,9 +106,13 @@ Public Class frmGeodataNavigation
End Sub
Private Sub LoadData()
Dim rowhandle As Integer = grvwMain.FocusedRowHandle
EntityDataTable = ClassDatabase.Return_Datatable(EntitySql)
LoadItemList()
LoadGridData()
grvwMain.FocusedRowHandle = rowhandle
End Sub
@ -222,8 +226,11 @@ Public Class frmGeodataNavigation
Dim LATITUDE = row.Item("LATITUDE")
Dim LONGITUDE = row.Item("LONGITUDE")
If LATITUDE Is Nothing Or LONGITUDE Is Nothing Then
Console.WriteLine(LATITUDE.ToString())
If IsDBNull(LATITUDE) Or IsDBNull(LONGITUDE) Then
e.Appearance.BackColor = Color.Red
e.HighPriority = True
End If
End If
End Sub
@ -316,11 +323,7 @@ Public Class frmGeodataNavigation
conn.Close()
End If
' Markierte Zeile speichern, um diese beim neu laden wieder zu setzen
Dim rowhandle As Integer = grvwMain.FocusedRowHandle
LoadData()
grvwMain.FocusedRowHandle = rowhandle
Catch ex As Exception
MsgBox("Error while saving Coordinates: " & vbNewLine & ex.Message)
End Try
@ -339,4 +342,26 @@ Public Class frmGeodataNavigation
End If
End Function
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles btnReload.Click
LoadData()
End Sub
Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
Try
Dim result As DialogResult = MessageBox.Show("Wollen Sie die Koordinaten für diesen Datensatz löschen?", "Koordinaten löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
Dim RecordId As Integer = currentRow.Item("Record-ID")
Dim sql = "DELETE FROM TBPMO_RECORD_GEODATA WHERE RECORD_ID = " & RecordId
ClassDatabase.Execute_Scalar(sql)
LoadData()
End If
Catch ex As Exception
MsgBox("Error while deleting Coordinates:" & vbNewLine & ex.Message)
End Try
End Sub
End Class

View File

@ -40,7 +40,7 @@ Partial Class frmGeodataSelect
'ToolStrip1
'
Me.ToolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.btnSave, Me.ToolStripLabel1, Me.ToolStripLabel2, Me.txtLat, Me.ToolStripLabel4, Me.txtLon, Me.tsbtnactivate})
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.btnSave, Me.tsbtnactivate, Me.ToolStripLabel2, Me.txtLat, Me.ToolStripLabel4, Me.txtLon, Me.ToolStripLabel1})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(934, 25)
@ -49,7 +49,6 @@ Partial Class frmGeodataSelect
'
'btnSave
'
Me.btnSave.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.btnSave.Image = Global.DD_Record_Organiser.My.Resources.Resources.save_16xLG1
Me.btnSave.ImageTransparentColor = System.Drawing.Color.Magenta
Me.btnSave.Name = "btnSave"
@ -58,6 +57,7 @@ Partial Class frmGeodataSelect
'
'ToolStripLabel1
'
Me.ToolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.ToolStripLabel1.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ToolStripLabel1.Name = "ToolStripLabel1"
Me.ToolStripLabel1.Size = New System.Drawing.Size(146, 22)
@ -65,24 +65,28 @@ Partial Class frmGeodataSelect
'
'ToolStripLabel2
'
Me.ToolStripLabel2.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.ToolStripLabel2.Name = "ToolStripLabel2"
Me.ToolStripLabel2.Size = New System.Drawing.Size(53, 22)
Me.ToolStripLabel2.Text = "Latitude:"
'
'txtLat
'
Me.txtLat.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.txtLat.Name = "txtLat"
Me.txtLat.Size = New System.Drawing.Size(36, 22)
Me.txtLat.Text = "txtLat"
'
'ToolStripLabel4
'
Me.ToolStripLabel4.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.ToolStripLabel4.Name = "ToolStripLabel4"
Me.ToolStripLabel4.Size = New System.Drawing.Size(64, 22)
Me.ToolStripLabel4.Text = "Longitude:"
'
'txtLon
'
Me.txtLon.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
Me.txtLon.Name = "txtLon"
Me.txtLon.Size = New System.Drawing.Size(40, 22)
Me.txtLon.Text = "txtLon"

View File

@ -29,6 +29,24 @@ Public Class frmGeodataSelect
Me.InitializeComponent()
End Sub
Private Sub frmGeodataSelect_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim dataProvider As New BingMapDataProvider()
dataProvider.BingKey = BING_KEY
ImageLayer.DataProvider = dataProvider
Dim storage As New MapItemStorage()
VectorLayer.Data = storage
If SelectedPoint IsNot Nothing Then
Dim pin = New MapPushpin()
pin.Location = SelectedPoint
ItemStorage.Items.Add(pin)
txtLat.Text = SelectedPoint.Latitude.ToString()
txtLon.Text = SelectedPoint.Longitude.ToString()
End If
End Sub
Private Sub MapControl1_Click(sender As Object, e As MouseEventArgs) Handles MapControl1.Click
If e.Button <> Windows.Forms.MouseButtons.Left Then
Exit Sub
@ -53,24 +71,6 @@ Public Class frmGeodataSelect
SelectedPoint = point
End Sub
Private Sub frmGeodataSelect_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim dataProvider As New BingMapDataProvider()
dataProvider.BingKey = BING_KEY
ImageLayer.DataProvider = dataProvider
Dim storage As New MapItemStorage()
VectorLayer.Data = storage
If SelectedPoint IsNot Nothing Then
Dim pin = New MapPushpin()
pin.Location = SelectedPoint
ItemStorage.Items.Add(pin)
txtLat.Text = SelectedPoint.Latitude.ToString()
txtLon.Text = SelectedPoint.Longitude.ToString()
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()