project name record_organizer

This commit is contained in:
JenneJ
2015-07-27 15:55:21 +02:00
commit aa525e08b8
351 changed files with 454129 additions and 0 deletions

View File

@@ -0,0 +1,319 @@
Imports DevExpress.XtraTreeList
Public Class frmForm_Overview
Sub New()
InitializeComponent()
End Sub
Private Shared _Instance As frmForm_Overview = Nothing
Private insert As Boolean = False
Public Shared Function Instance() As frmForm_Overview
If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
_Instance = New frmForm_Overview
End If
_Instance.BringToFront()
Return _Instance
End Function
Private Sub frmForm_Overview_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
ClassWindowLocation.SaveFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmForm_Overview")
'Load_Forms()
SaveLayout()
Catch ex As Exception
MsgBox("Error in Form Close:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub frmForm_Overview_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_DMSDataSet.TBPMO_FORM_TYPE". Sie können sie bei Bedarf verschieben oder entfernen.
Try
TBPMO_FORMTableAdapter.Connection.ConnectionString = MyConnectionString
TBPMO_FORM_VIEWTableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBPMO_FORM_TYPETableAdapter.Connection.ConnectionString = MyConnectionString
Load_TreeView()
Me.TBPMO_FORM_TYPETableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_FORM_TYPE)
ClassWindowLocation.LoadFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmForm_Overview")
LoadLayout()
Catch ex As Exception
MsgBox("Error in Form Load:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Load_TreeView()
Try
Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPMO_FORM WHERE FORM_TYPE_ID = 1 AND PARENT_ID = 0")
If DT.Rows.Count > 0 Then
TreeViewEntity.Nodes.Clear()
For Each Row As DataRow In DT.Rows
Dim Node As TreeNode
Node = TreeViewEntity.Nodes.Add(Row.Item("NAME").ToString)
Node.Tag = Row.Item("GUID")
'Jetzt die Ebene1Knoten einhängen
Dim dtEbene1 As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPMO_FORM WHERE PARENT_ID = " & Row.Item("GUID") & " AND FORM_TYPE_ID in (2,5) ORDER BY LEVEL")
If dtEbene1.Rows.Count > 0 Then
For Each row1 As DataRow In dtEbene1.Rows
Dim Node1 As TreeNode
Node1 = Node.Nodes.Add(row1.Item("NAME").ToString)
Node1.Tag = row1.Item("GUID")
'Jetzt die Ebene2 Knoten einhängen
Dim dtEbene2 As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPMO_FORM WHERE FORM_TYPE_ID in (3,5) AND PARENT_ID = " & row1.Item("GUID") & " ORDER BY LEVEL")
If dtEbene2.Rows.Count > 0 Then
For Each row2 As DataRow In dtEbene2.Rows
Dim Node2 As TreeNode
Node2 = Node1.Nodes.Add(row2.Item("NAME").ToString)
Node2.Tag = row2.Item("GUID")
Next
End If
Next
End If
Next
Dim DT3 As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPMO_FORM WHERE FORM_TYPE_ID = 4 AND PARENT_ID = 0 ORDER BY NAME")
If DT3.Rows.Count > 0 Then
Dim Node As TreeNode
Node = TreeViewEntity.Nodes.Add("Unabhängige/Eigenständige Entitäten")
For Each row3 As DataRow In DT3.Rows
Dim Node2 As TreeNode
Node2 = Node.Nodes.Add(row3.Item("NAME").ToString)
Node2.Tag = row3.Item("GUID")
Next
End If
TreeViewEntity.ExpandAll()
End If
Catch ex As Exception
MsgBox("Error in Load_TreeView:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Load_Forms(FORMID As Integer)
Try
Me.TBPMO_FORMTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_FORM, FORMID)
Me.TBPMO_FORM_VIEWTableAdapter.FillByFORMID(Me.DD_DMSDataSet.TBPMO_FORM_VIEW, FORMID)
'ResizeColumns()
Catch ex As Exception
MsgBox("Error in Load_Forms:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Open_Designer()
Cursor = Cursors.WaitCursor
OpenFormLevelDesigner()
Cursor = Cursors.Default
End Sub
Sub Open_Viewer()
Try
If GUIDTextBox.Text = "" Then
Exit Sub
End If
Dim FormId As Integer = GUIDTextBox.Text 'GetCurrentGUID()
If FormId <> -1 Then
Me.Hide()
Cursor = Cursors.WaitCursor
OpenFormInputFor(FormId, 1)
Cursor = Cursors.Default
' Me.Visible = True
End If
Catch ex As Exception
MsgBox("Error while Opening Entity View!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Try
If GUIDTextBox.Text <> "" Then
Dim FormId As Integer = GUIDTextBox.Text 'GetCurrentGUID()
If FormId <> -1 Then
CURRENT_FORM_ID = FormId
Open_Designer()
Me.Hide()
End If
End If
Catch ex As Exception
MsgBox("Error while Opening Entity!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
Open_Viewer()
End Sub
Private Sub gvMainView_DoubleClick(sender As Object, e As EventArgs)
Open_Viewer()
End Sub
Private Function GetCurrentGUID() As Integer
Dim FormId As Integer
Try
Dim CurrentRow As DataRowView = Me.TBPMO_FORMBindingSource.Current
FormId = CurrentRow.Row.Item("GUID")
Catch ex As Exception
FormId = -1
End Try
Return FormId
End Function
Private Sub TBPMO_FORMBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPMO_FORMBindingSource.AddingNew
DD_DMSDataSet.TBPMO_FORM.ADDED_WHOColumn.DefaultValue = Environment.UserName
DD_DMSDataSet.TBPMO_FORM_VIEW.ADDED_WHOColumn.DefaultValue = Environment.UserName
Me.GroupBox1.Visible = True
insert = True
End Sub
Private Sub SaveLayout()
Try
Dim XMLPath = System.IO.Path.Combine(Application.UserAppDataPath(), "FORM-OVERVIEW-UserLayout.xml")
' treeListForms.SaveLayoutToXml(XMLPath)
Catch ex As Exception
MsgBox("Error while saving custom Layout!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub LoadLayout()
Try
Dim XMLPath = System.IO.Path.Combine(Application.UserAppDataPath(), "FORM-OVERVIEW-UserLayout.xml")
' treeListForms.RestoreLayoutFromXml(XMLPath)
Catch notFoundEx As System.IO.FileNotFoundException
ClassLogger.Add("Layout added for Overview")
Catch ex As Exception
MsgBox("Error while loading custom Layout!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click
Try
Me.TBPMO_FORMBindingSource.EndEdit()
Dim changes = False
' Save FORM Properties
If DD_DMSDataSet.TBPMO_FORM.GetChanges Is Nothing = False Then
Me.CHANGED_WHOTextBoxPMOForm.Text = Environment.UserName
Me.TBPMO_FORMBindingSource.EndEdit()
TBPMO_FORMTableAdapter.Update(DD_DMSDataSet.TBPMO_FORM)
changes = True
End If
' Save FORM_VIEW Properties
If insert = True Then
Dim sql = "SELECT (MAX(GUID)) FROM TBPMO_FORM"
Dim FORM_ID = ClassDatabase.Execute_Scalar(sql)
Dim FORM_TITLE As String = FORM_TITLETextBox.Text
Dim DESCRIPTION As String = DESCRIPTIONTextBox.Text
Dim ADDED_WHO As String = Environment.UserName
'MsgBox(FORM_TITLETextBox.Text)
'ggg()
If FORM_ID Is Nothing = False Then
' Dim SQL1 = ClassDatabase.Execute_Scalar("SELECT SQL_RECORD_SQL1 FROM TBPMO_KONFIGURATION WHERE GUID = 1")
' Dim SQL2 = ClassDatabase.Execute_Scalar("SELECT SQL_RECORD_SQL2 FROM TBPMO_KONFIGURATION WHERE GUID = 1")
' SQL2 = SQL2.ToString.Replace("@FORM_ID", FORM_ID)
' sql = "INSERT INTO TBPMO_FORM_SQL_CONSTRUCT (SCREEN_ID,FORM_ID,SQL1,SQL2,ADDED_WHO) VALUES (" & FORM_ID & ", 1,'" & SQL1 & "','" & SQL2 & "','" & ADDED_WHO & "')"
' ClassDatabase.Execute_non_Query(sql)
sql = "INSERT INTO TBPMO_FORM_VIEW (FORM_ID, SCREEN_ID, FORM_TITLE, DESCRIPTION, ADDED_WHO) VALUES (" & FORM_ID & ", 1, '" & FORM_TITLE & "', '" & DESCRIPTION & "', '" & ADDED_WHO & "')"
ClassDatabase.Execute_non_Query(sql)
End If
Else
Me.TBPMO_FORM_VIEWBindingSource.EndEdit()
If DD_DMSDataSet.TBPMO_FORM_VIEW.GetChanges Is Nothing = False Then
Me.CHANGED_WHOTextBoxPMOFormView.Text = Environment.UserName
Me.TBPMO_FORM_VIEWBindingSource.EndEdit()
TBPMO_FORM_VIEWTableAdapter.Update(DD_DMSDataSet.TBPMO_FORM_VIEW)
changes = True
End If
End If
insert = False
If changes = True Then
Load_TreeView()
lblStatus.Text = "Änderungen erfolgreich gespeichert"
lblStatus.Visible = True
'MsgBox("Änderungen erfolgreich gespeichert!", MsgBoxStyle.Information)
Else
lblStatus.Visible = False
End If
' Load_Forms()
Catch ex As Exception
MsgBox("Error in Save:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btndelete_Click(sender As Object, e As EventArgs) Handles btndelete.Click
Dim result As MsgBoxResult = MsgBox("Wollen Sie das Formular wirklich löschen?", MsgBoxStyle.YesNo, "Frage:")
If result = MsgBoxResult.Yes Then
Try
Dim CurrentID = GetCurrentGUID()
Dim delete As String = "DELETE FROM TBPMO_FORM_SQL WHERE FORM_ID = " & CurrentID
ClassDatabase.Execute_non_Query(delete, True)
' Delete controls (and control screens and control values)
ClassFormCommands.DeleteFormControls(CurrentID)
' Delete form view
ClassFormCommands.DeleteFormView(CurrentID)
' Delete the actual form
Me.TBPMO_FORMTableAdapter.Delete(CurrentID)
MsgBox("Das Formular/Die Entität wurde erfolgreich gelöscht!", MsgBoxStyle.Information)
Load_TreeView()
Load_Forms(999999999)
Catch ex As Exception
MsgBox("Formular konnte nicht gelöscht werden:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
End Sub
Private Sub btninsert_Click(sender As Object, e As EventArgs) Handles btninsert.Click
TBPMO_FORMBindingSource.AddNew()
End Sub
Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeViewEntity.AfterSelect
Try
If Not TreeViewEntity.SelectedNode Is Nothing Then
Dim formId As Integer = Integer.Parse(TreeViewEntity.SelectedNode.Tag)
Console.WriteLine(formId)
Load_Forms(formId)
TreeViewEntity.ExpandAll()
End If
Catch ex As Exception
MsgBox("Error in AfterSelect:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btncopy_Click(sender As Object, e As EventArgs) Handles btncopy.Click
Dim result As MsgBoxResult = MsgBox("Wollen Sie diese Entität kopieren?", MsgBoxStyle.YesNo, "Frage:")
If result = MsgBoxResult.Yes Then
Try
Dim CurrentID = GetCurrentGUID()
Dim sql As String = "EXEC PRPMO_COPY_ENTITY " & CurrentID.ToString
If ClassDatabase.Execute_non_Query(sql) = True Then
'MsgBox("Die Entität wurde erfolgreich kopiert!", MsgBoxStyle.Information)
Load_TreeView()
Load_Forms(999999999)
lblStatus.Text = "Die Entität wurde erfolgreich kopiert."
lblStatus.Visible = True
Else
lblStatus.Visible = False
End If
Catch ex As Exception
MsgBox("Formular konnte nicht gelöscht werden:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
End Sub
Private Sub NAMETextBox_TextChanged(sender As Object, e As EventArgs) Handles NAMETextBox.TextChanged
If insert = True Then
FORM_TITLETextBox.Text = NAMETextBox.Text
End If
End Sub
End Class