WIP: EDM Designer, Create Tables

This commit is contained in:
Jonathan Jenne
2018-09-03 17:24:17 +02:00
parent ae0bb16dc8
commit a2e233fe68
13 changed files with 490 additions and 174 deletions

View File

@@ -1,16 +1,18 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports System.IO
Public Class FrmMain
Private SelectedTable As Integer
Private Logger As NLog.Logger
Private LogWrapper As LogConfig
Private _logger As NLog.Logger
Private _logConfig As LogConfig
Private DBFirebird As Firebird
Private Sub CreateTableNodesFromDatatable(dt As DataTable)
' Node der Datenbank erstellen
Dim dbNode As New TreeNode With {
.Text = My.Settings.fbDatabaseLocation
.Text = My.Settings.fbDatabaseLocation,
.Name = "DATABASE"
}
' Übernode für Tabellen erstellen
@@ -48,7 +50,7 @@ Public Class FrmMain
End Function
Private Sub Init()
DBFirebird = New Firebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
DBFirebird = New Firebird(_logConfig.LogFactory, My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
If DBFirebird.ConnectionFailed Then
MsgBox("Database connection failed. Please check the log.", vbCritical)
@@ -56,39 +58,23 @@ Public Class FrmMain
End If
' Get info about the logged in user
CurrentUser = New ClassCurrentUser(DBFirebird)
'CurrentUser = New ClassCurrentUser(DBFirebird)
Dim dt As DataTable = LoadTables()
CreateTableNodesFromDatatable(dt)
End Sub
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
LogWrapper = New LogConfig(ClassLogger.PathType.CurrentDirectory)
Logger = NLog.LogManager.GetCurrentClassLogger()
Logger.Debug("DEBUG1")
Logger.Debug("DEBUG2")
Logger.Debug("DEBUG3")
LogWrapper.Debug = False
Logger.Debug("DEBUG4")
Logger.Debug("DEBUG5")
Logger.Debug("DEBUG6")
LogWrapper.Debug = True
Logger.Debug("DEBUG7")
Logger.Debug("DEBUG8")
Logger.Debug("DEBUG9")
Logger.Info("Starting EDMDesigner..")
Logger.Error(New IO.FileNotFoundException("Central 66"), "This is Error!")
_logConfig = New LogConfig(ClassLogger.PathType.CurrentDirectory)
_logger = _logConfig.LogFactory.GetCurrentClassLogger()
' Check for existing database credentials
While Not DatabaseSettingsExist()
Dim result As DialogResult = FrmConnection.ShowDialog()
Dim form As New FrmConnection With {
.LogFactory = _logConfig.LogFactory
}
Dim result As DialogResult = form.ShowDialog()
If result = DialogResult.OK Then
Exit While
End If
@@ -129,20 +115,25 @@ Public Class FrmMain
End Sub
Private Sub DebugAnToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAnToolStripMenuItem.Click
LogWrapper.Debug = True
_logConfig.Debug = True
End Sub
Private Sub DebugAusToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAusToolStripMenuItem.Click
LogWrapper.Debug = False
_logConfig.Debug = False
End Sub
Private Sub WriteDebugLogToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WriteDebugLogToolStripMenuItem.Click
Logger.Debug("Welcome to monkey island!")
Private Sub WriteDebugLogToolStripMenuItem_Click(sender As Object, e As EventArgs)
_logger.Debug("Welcome to monkey island!")
End Sub
Private Sub SpamTheLogToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpamTheLogToolStripMenuItem.Click
Private Sub SpamTheLogToolStripMenuItem_Click(sender As Object, e As EventArgs)
For index = 1 To 100000
Logger.Debug("Spam No. {0}", index)
_logger.Debug("Spam No. {0}", index)
Next
End Sub
Private Sub NeueTabelleToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NeueTabelleToolStripMenuItem.Click
Dim frm As New FrmNewTable(_logConfig.LogFactory)
frm.ShowDialog()
End Sub
End Class