Initial commit
This commit is contained in:
73
EDOKA_Toolset/Plugin_HostNotiz/form1.vb
Normal file
73
EDOKA_Toolset/Plugin_HostNotiz/form1.vb
Normal file
@@ -0,0 +1,73 @@
|
||||
Imports MyNameSpace.CSVDataAdapter
|
||||
Imports System.IO
|
||||
Public Class form1
|
||||
|
||||
Dim dsdaten As New DataSet
|
||||
Private Sub SchliessenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SchliessenToolStripMenuItem.Click
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub DokumentlisteLadenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DokumentlisteLadenToolStripMenuItem.Click
|
||||
dsdaten.Tables.Clear()
|
||||
Me.OpenFileDialog1.Filter = "CSV-Dateien (*.csv)|*.csv|Text-Dateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*"
|
||||
Me.OpenFileDialog1.FileName = ""
|
||||
Me.OpenFileDialog1.ShowDialog()
|
||||
If Me.OpenFileDialog1.FileName = "" Then Exit Sub
|
||||
|
||||
FillDataTableFromText(Me.OpenFileDialog1.FileName)
|
||||
Try
|
||||
Me.c1daten.DataSource = Nothing
|
||||
Me.c1daten.DataSource = dsdaten.Tables(0)
|
||||
Me.c1daten.DataMember = dsdaten.Tables(0).TableName
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function FillDataTableFromText(ByVal file As String) As DataTable
|
||||
Select Case UCase(Microsoft.VisualBasic.Right(file, 3))
|
||||
Case "CSV"
|
||||
Dim csv As New MyNameSpace.CSVDataAdapter(file, True, ";")
|
||||
csv.Fill(Me.dsdaten)
|
||||
End Select
|
||||
'Rel. Office Migration
|
||||
|
||||
Dim dv As DataRow
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub NotizLadenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NotizLadenToolStripMenuItem.Click
|
||||
Me.OpenFileDialog1.Filter = "Text-Dateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*"
|
||||
Me.OpenFileDialog1.FileName = ""
|
||||
Me.OpenFileDialog1.ShowDialog()
|
||||
If Me.OpenFileDialog1.FileName = "" Then Exit Sub
|
||||
Dim read As IO.StreamReader
|
||||
read = IO.File.OpenText(Me.OpenFileDialog1.FileName)
|
||||
TextBox1.Text = read.ReadToEnd()
|
||||
read.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateDurchführenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UpdateDurchführenToolStripMenuItem.Click
|
||||
Dim f As New frmProgress
|
||||
f.Show()
|
||||
f.ProgressBar1.Minimum = 1
|
||||
f.ProgressBar1.Maximum = Me.dsdaten.Tables(0).Rows.Count
|
||||
Dim db As New DB
|
||||
Dim dbconn As New DB_Connection
|
||||
|
||||
Dim i As Integer = 0
|
||||
For Each r As DataRow In dsdaten.Tables(0).Rows
|
||||
db.insert_data(r(2), Me.TextBox1.Text)
|
||||
i = i + 1
|
||||
f.ProgressBar1.Value = i
|
||||
f.Refresh()
|
||||
|
||||
Next
|
||||
f.Close()
|
||||
MsgBox("Updates seitens EDOKA sind durchgeführt.", vbInformation)
|
||||
End Sub
|
||||
|
||||
Private Sub form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user