Imports System.Data.SqlClient Public Class frmProfileDesigner Private _windreamPM As ClassPMWindream Private email As New ClassEmail Public profile_guid As Integer = 0 Dim formloaded As Boolean Private INSERT_ACTIVE As Boolean = False Private Sub LoadProfilesInCombobox() 'Schreibt die Profile in die Combobox in der Toolbar. Try Me.cmbProfiles.DropDownItems.Clear() Me.TBPM_PROFILETableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_PROFILE) If Me.DD_DMSLiteDataSet.TBPM_PROFILE.Rows.Count > 0 Then Dim anz As Integer = 0 For Each row As DataRow In Me.DD_DMSLiteDataSet.TBPM_PROFILE.Rows Me.cmbProfiles.DropDownItems.Add(row.Item("NAME")) anz = anz + 1 Next End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der Profile in Auswahlliste:") End Try End Sub Private Sub frmFormDesigner_Load(sender As Object, e As System.EventArgs) Handles Me.Load 'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_DMSLiteDataSet.TBDD_CONNECTION". Sie können sie bei Bedarf verschieben oder entfernen. 'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_DMSLiteDataSet.TBPM_ERROR_LOG". Sie können sie bei Bedarf verschieben oder entfernen. formloaded = False Try TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = MyConnectionString TBPM_PROFILETableAdapter.Connection.ConnectionString = MyConnectionString TBPM_TYPETableAdapter.Connection.ConnectionString = MyConnectionString TBPM_USERTableAdapter.Connection.ConnectionString = MyConnectionString TBPROFILE_USERTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPM_ERROR_LOGTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPM_PROFILE_CONTROLSTableAdapter.Connection.ConnectionString = MyConnectionString TBPM_PROFILE_FILESTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBDD_CONNECTIONTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBDD_CONNECTION) Refresh_Profildaten() Catch ex As Exception MsgBox("Fehler bei Laden der Wertehilfen und Konfig-Daten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try Try ' Windream instanziieren _windreamPM = New ClassPMWindream() 'Windream initialisieren (Connection, Session, ... aufbauen) _windreamPM.Init() Catch ex As Exception MsgBox("Fehler bei Initialisieren von windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try LoadProfilesInCombobox() ObjekttypenEintragen() Indexe_eintragen() End Sub Sub Indexe_eintragen() If cmbObjekttypen.Text <> "" Then Try Me.PM_VEKTOR_INDEXComboBox.Items.Clear() Me.cmbLOGIndex.Items.Clear() Dim indexe = _windreamPM.GetIndicesByObjecttype(cmbObjekttypen.Text) Me.PM_VEKTOR_INDEXComboBox.Items.Add("") Me.cmbLOGIndex.Items.Add("") If indexe IsNot Nothing Then For Each index As String In indexe Dim _vektorString As Boolean = False Select Case _windreamPM.GetTypeOfIndex(index) Case 4097 _vektorString = True Case 36865 _vektorString = True Case Else _vektorString = False End Select If _vektorString = True Then Me.PM_VEKTOR_INDEXComboBox.Items.Add(index) Me.cmbLOGIndex.Items.Add(index) End If Next End If If Me.PM_VEKTOR_INDEXComboBox.Text <> "" Then PM_VEKTOR_INDEXComboBox.SelectedIndex = PM_VEKTOR_INDEXComboBox.FindStringExact(Me.PM_VEKTOR_INDEXComboBox.Text) Else PM_VEKTOR_INDEXComboBox.SelectedIndex = -1 End If If Me.cmbLOGIndex.Text <> "" Then cmbLOGIndex.SelectedIndex = cmbLOGIndex.FindStringExact(Me.cmbLOGIndex.Text) Else cmbLOGIndex.SelectedIndex = -1 End If Catch ex As Exception MsgBox("Fehler bei Indexe_eintragen: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") PM_VEKTOR_INDEXComboBox.SelectedIndex = -1 cmbLOGIndex.SelectedIndex = -1 End Try End If End Sub Sub Refresh_Profildaten() Try Me.TBPM_PROFILETableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_PROFILE) Me.TBPM_TYPETableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_TYPE) Me.TBPM_KONFIGURATIONTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_KONFIGURATION) Me.TBPM_USERTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBDD_USER) Catch ex As Exception MsgBox("Fehler bei Refresh_Profildaten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try End Sub Private Sub ObjekttypenEintragen() Me.cmbObjekttypen.Items.Clear() Try Dim oDokumentTypen As WINDREAMLib.WMObjects = Me._windreamPM.GetObjecttypesAsObjects() If oDokumentTypen Is Nothing Then Exit Sub For Each aType In oDokumentTypen Me.cmbObjekttypen.Items.Add(aType.aName) Next Catch ex As Exception MsgBox("Es konnte keine Verbindung zum windream-Server hergestellt werden.", MsgBoxStyle.Critical, "Fehler beim Zugriff auf windream-Server") End Try End Sub Private Sub cmbProfiles_DropDownItemClicked(sender As Object, e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles cmbProfiles.DropDownItemClicked cmbProfiles.Text = e.ClickedItem.Text Dim anz As Integer = 0 For Each row As DataRow In Me.DD_DMSLiteDataSet.TBPM_PROFILE.Rows If e.ClickedItem.Text = row.Item("NAME") Then Me.TBPM_PROFILEBindingSource.Position = anz End If anz = anz + 1 Next End Sub Private Sub cmbProfiles_ButtonClick(sender As System.Object, e As System.EventArgs) Handles cmbProfiles.ButtonClick End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnWDSuche.Click If Not Me.WD_SEARCHTextBox.Text = "" Then Me.dlgWindreamsuche.FileName = Me.WD_SEARCHTextBox.Text End If If Me.dlgWindreamsuche.ShowDialog = Windows.Forms.DialogResult.OK Then Me.WD_SEARCHTextBox.Text = Me.dlgWindreamsuche.FileName End If End Sub Private Sub btnopenSuche_Click(sender As System.Object, e As System.EventArgs) Handles btnopenSuche.Click Try If Not Me.WD_SEARCHTextBox.Text = "" Then Dim p As New Process() p.StartInfo.FileName = Me.WD_SEARCHTextBox.Text p.StartInfo.WindowStyle = ProcessWindowStyle.Normal p.Start() p.WaitForExit() p.Close() End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei öffnen der windream-Suche:") End Try End Sub Private Sub VWPM_PROFILE_USERBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles VWPM_PROFILE_USERBindingNavigatorSaveItem.Click Try Me.TBPM_PROFILEBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_PROFILE.GetChanges Is Nothing = False Then Me.TBPM_PROFILETableAdapter.Update(DD_DMSLiteDataSet.TBPM_PROFILE) tstrlblSave.Visible = True Else tstrlblSave.Visible = False End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Speichern des Profils:") End Try End Sub Private Sub TBPM_PROFILEBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPM_PROFILEBindingSource.AddingNew DD_DMSLiteDataSet.TBPM_PROFILE.ADDED_WHOColumn.DefaultValue = Environment.UserName DD_DMSLiteDataSet.TBPM_PROFILE.ADDED_WHENColumn.DefaultValue = Date.Now DD_DMSLiteDataSet.TBPM_PROFILE.TYPEColumn.DefaultValue = 1 End Sub Private Sub TBPM_PROFILEBindingSource_PositionChanged(sender As System.Object, e As System.EventArgs) Handles TBPM_PROFILEBindingSource.PositionChanged tstrlblSave.Visible = False If NAMETextBox.Text = "" Then cmbProfiles.Text = "Kein Profil gewählt" Else cmbProfiles.Text = NAMETextBox.Text End If Indexe_eintragen() If tabctrl_Profilkonfig.SelectedIndex = 1 Then Refresh_Final_indexe() End If End Sub Private Sub tstrpbtn_add_Click(sender As System.Object, e As System.EventArgs) Handles tstrpbtn_add.Click If TBPM_PROFILETableAdapter.cmdAnzProfile + 1 > LICENSE_PROFILES Then MsgBox("Sie haben die maximale Anzahl (" & LICENSE_PROFILES & ") von lizensierten Profilen erreicht!" & vbNewLine & "Bitte löschen Sie Profile oder setzen sich mit Digital Data in Verbindung!", MsgBoxStyle.Exclamation, "Achtung Lizenzhinweis:") Else Me.TBPM_PROFILEBindingSource.AddNew() End If End Sub Private Sub GUIDTextBox_TextChanged(sender As System.Object, e As System.EventArgs) Handles PROFILGUIDTextBox.TextChanged End Sub Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles tsbtnDesigner_open.Click If CInt(PROFILGUIDTextBox.Text) > 0 Then profile_guid = PROFILGUIDTextBox.Text CURRENT_ProfilGUID = PROFILGUIDTextBox.Text My.Settings.Save() CURRENT_OBJECTTYPE = cmbObjekttypen.Text CURRENT_ProfilName = NAMETextBox.Text frmFormDesigner.ProfileId = CURRENT_ProfilGUID frmFormDesigner.ProfileName = CURRENT_ProfilName frmFormDesigner.ProfileObjectType = cmbObjekttypen.Text frmFormDesigner.ShowDialog() Else MsgBox("Eindeutiges Profil konnte nicht an den FormDesigner weitergegeben werden:", MsgBoxStyle.Exclamation) End If End Sub Private Sub btnmovetoFolderDialog_Click(sender As System.Object, e As System.EventArgs) Handles btnmovetoFolderDialog.Click ' wenn im Formular der OK-Button geklickt wurde If Me.FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then ' den Speicherort der windream-Suche in die TextBox eintragen Me.MOVE2FOLDERTextBox.Text = Me.FolderBrowserDialog1.SelectedPath End If End Sub Private Sub ADDED_WHOLabel_Click(sender As System.Object, e As System.EventArgs) End Sub Dim zuordnungsprofil As Integer Sub FillProfile_User(ID As Integer) Try Me.TBPROFILE_USERTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPROFILE_USER, ID) Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der User zu Profil:") End Try End Sub Private Sub TBPM_USERBindingSource_AddingNew(sender As System.Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBDD_USERBindingSource.AddingNew DD_DMSLiteDataSet.TBDD_USER.ADDED_WHOColumn.DefaultValue = Environment.UserName End Sub Private Sub TBPM_PROFILE_ZuordnungDataGridView_SelectionChanged(sender As Object, e As System.EventArgs) Handles TBPM_PROFILE_ZuordnungDataGridView.SelectionChanged If TabControl1.SelectedIndex = 1 Then If formloaded = True Then Try Dim i As Integer i = TBPM_PROFILE_ZuordnungDataGridView.CurrentRow.Index If TBPM_PROFILE_ZuordnungDataGridView.Item(0, i).Value Is Nothing = False Then zuordnungsprofil = TBPM_PROFILE_ZuordnungDataGridView.Item(0, i).Value FillProfile_User(zuordnungsprofil) End If Catch ex As Exception End Try End If End If End Sub Private Sub TBPM_USERDataGridView_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles TBPM_USERDataGridView.Validating Save_User() End Sub Private Sub ToolStripButton11_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton11.Click Save_User() End Sub Sub Save_User() Try TBDD_USERBindingSource.EndEdit() If DD_DMSLiteDataSet.TBDD_USER.GetChanges Is Nothing = False Then CHANGED_WHOTextBox1.Text = Environment.UserName TBDD_USERBindingSource.EndEdit() TBPM_USERTableAdapter.Update(DD_DMSLiteDataSet.TBDD_USER) Me.lblSaveUser.Text = "Data saved successfully - " & Now.ToString Me.lblSaveUser.Visible = True Else Me.lblSaveUser.Visible = False End If Catch ex As Exception MsgBox("Fehler in Save_User:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub TBPM_USERDataGridView_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles TBPM_USERDataGridView.MouseDown If tsbtnworkUser.Text <> "Bearbeitung aktiv" Then Dim i As Integer i = TBPM_USERDataGridView.CurrentRow.Index If TBPM_USERDataGridView.Item(0, i).Value Is Nothing = False Then Dim p As Integer p = TBPM_PROFILE_ZuordnungDataGridView.CurrentRow.Index If TBPM_PROFILE_ZuordnungDataGridView.Item(0, p).Value Is Nothing = False Then zuordnungsprofil = TBPM_PROFILE_ZuordnungDataGridView.Item(0, p).Value FillProfile_User(zuordnungsprofil) End If Me.TBPM_USERDataGridView.DoDragDrop(TBPM_USERDataGridView.Item(0, i).Value.ToString, DragDropEffects.Copy) End If End If 'Dim hit As DataGridView.HitTestInfo = Me.TBPM_USERDataGridView.HitTest(e.X, e.Y) 'Dim guid = Me.TBPM_USERDataGridView.DoDragDrop(TBPM_USERDataGridView.Item(0, hit.RowIndex).Value, DragDropEffects.Copy) 'If guid <> Nothing Then ' Me.TBPM_USERDataGridView.DoDragDrop(guid.ToString, DragDropEffects.Copy) ' Cursor = Cursors.Hand 'End If End Sub Private Sub TBPROFILE_USERDataGridView_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles TBPROFILE_USERDataGridView.DragDrop Try Dim i As Integer i = TBPM_PROFILE_ZuordnungDataGridView.CurrentRow.Index If TBPM_PROFILE_ZuordnungDataGridView.Item(0, i).Value Is Nothing = False Then TBPROFILE_USERTableAdapter.CMDInsert(zuordnungsprofil, e.Data.GetData(DataFormats.Text), Environment.UserName) FillProfile_User(zuordnungsprofil) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen eines Users:") End Try End Sub Private Sub TBPROFILE_USERDataGridView_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles TBPROFILE_USERDataGridView.DragEnter ' Check the format of the data being dropped. If (e.Data.GetDataPresent(DataFormats.Text)) Then ' Display the copy cursor. e.Effect = DragDropEffects.Copy Else ' Display the no-drop cursor. e.Effect = DragDropEffects.None End If End Sub Private Sub BindingNavigatorDeleteItem_Click(sender As System.Object, e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click Dim i, ID As Integer i = TBPROFILE_USERDataGridView.CurrentRow.Index ID = TBPROFILE_USERDataGridView.Item(0, i).Value If ID > 0 Then TBPROFILE_USERTableAdapter.cmdDelete(ID) 'FillProfile_User(zuordnungsprofil) End If End Sub Private Sub btnlicensemanager_open_Click(sender As System.Object, e As System.EventArgs) Handles btnlicensemanager_open.Click frmLicense.ShowDialog() End Sub Sub Save_Konfiguration() TBPM_KONFIGURATIONBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_KONFIGURATION.GetChanges Is Nothing = False Then GEAENDERTWERTextBox.Text = Environment.UserName TBPM_KONFIGURATIONBindingSource.EndEdit() TBPM_KONFIGURATIONTableAdapter.Update(DD_DMSLiteDataSet.TBPM_KONFIGURATION) tstrpinfo.Text = "Konfiguration wurde erfolgreich gespeichert" tstrpinfo.Visible = True Else tstrpinfo.Visible = False End If End Sub Private Sub frmProfileDesigner_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown formloaded = True End Sub Private Sub btnSaveKonfig_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveKonfig.Click Save_Konfiguration() End Sub Private Sub TBPROFILE_USERDataGridView_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles TBPROFILE_USERDataGridView.CellContentClick End Sub Private Sub tsbtnworkUser_Click(sender As System.Object, e As System.EventArgs) Handles tsbtnworkUser.Click If tsbtnworkUser.Text = "User-Daten bearbeiten" Then tsbtnworkUser.Text = "Bearbeitung aktiv" 'tsbtnworkUser.BackColor = Color.OrangeRed TabControlUser.SelectedIndex = 1 Else tsbtnworkUser.Text = "User-Daten bearbeiten" 'tsbtnworkUser.BackColor = Color.Transparent TabControlUser.SelectedIndex = 0 End If End Sub Private Sub Refresh_Final_indexe() Try Me.lblSaveFinalIndex.Visible = False If formloaded = False Then Exit Sub If PROFILGUIDTextBox.Text <> String.Empty Then Me.TBPM_PROFILE_FINAL_INDEXINGTableAdapter.FillByID(Me.DD_DMSLiteDataSet.TBPM_PROFILE_FINAL_INDEXING, PROFILGUIDTextBox.Text) End If Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Refresh_Final_indexe:") End Try End Sub Private Sub TabControl2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles tabctrl_Profilkonfig.SelectedIndexChanged If tabctrl_Profilkonfig.SelectedIndex = 1 Then CURRENT_OBJECTTYPE = cmbObjekttypen.Text Refresh_Final_indexe() End If End Sub Private Sub TabControl1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged Select Case TabControl1.SelectedIndex Case 3 Refresh_log() End Select End Sub Private Sub BindingNavigatorDeleteItem1_Click(sender As System.Object, e As System.EventArgs) Handles BindingNavigatorDeleteItem1.Click Try TBPM_ERROR_LOGTableAdapter.CmdDelete() Refresh_log() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Delete Log:") End Try End Sub Sub Refresh_log() Try Me.TBPM_ERROR_LOGTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_ERROR_LOG) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Refresh Error:") End Try End Sub Private Sub cmbIndexe_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbIndexe.SelectedIndexChanged If cmbIndexe.SelectedIndex <> -1 Then 'MsgBox(_windreamPM.GetTypeOfIndex(cmbIndexe.Text)) btnInsert_FinalIndex.Enabled = True Me.btnStampDate.Visible = False Me.btnStampDate.Visible = False Dim type = _windreamPM.GetTypeOfIndex(cmbIndexe.Text) Select Case type Case 1 'String Me.lblIndex.Text = "Definieren Sie den festen Wert: (Text)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = True Me.btnStampDate.Visible = True Me.btnStampDate.Visible = True Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 2 'Integer Me.lblIndex.Text = "Definieren Sie den festen Wert: (Zahl)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = True Me.btnStampDate.Visible = True Me.btnStampDate.Visible = True Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 3 'Float Me.lblIndex.Text = "Definieren Sie den festen Wert: (Decimal)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4 ' Boolean Me.lblIndex.Text = "Wählen Sie den Boolean-Wert: (Ja/Nein)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = False Me.grbxSystemStamps.Visible = False Me.chkbxfinalIndex.CheckState = CheckState.Checked Me.chkbxfinalIndex.Visible = True Case 5 'Date Me.lblIndex.Text = "Definieren Sie den festen Wert: (Date)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4107 'Vektor Zahl Me.lblIndex.Text = "Definieren Sie den festen Wert - Vektorfeld: (Zahl)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4097 'Vektor String Me.lblIndex.Text = "Definieren Sie den festen Wert - Vektorfeld: (Text)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = True Me.btnStampDate.Visible = True Me.btnStampDate.Visible = True Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4100 'Vektor Bool Me.lblIndex.Text = "Definieren Sie den festen Wert - Vektorfeld: (Boolean)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = False Me.btnStampDate.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4101 'Vektor Date Me.lblIndex.Text = "Definieren Sie den festen Wert - Vektorfeld: (Date)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = True Me.btnStampDate.Visible = True Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case 4104 Me.lblIndex.Text = "Definieren Sie den festen Wert - Vektorfeld: (Currency)" Me.lblIndex.Visible = True Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Case Else btnInsert_FinalIndex.Enabled = False End Select End If End Sub Private Sub btnInsert_FinalIndex_Click(sender As System.Object, e As System.EventArgs) Handles btnInsert_FinalIndex.Click Me.lblSaveFinalIndex.Visible = False If CheckBoxPMVEKTOR.Checked = False Then If cmbIndexe.SelectedIndex <> -1 Then Dim indexwert As String = "" If txtindexwert_final.Visible = True Then indexwert = txtindexwert_final.Text Else If chkbxfinalIndex.CheckState = CheckState.Checked Then indexwert = 1 Else indexwert = 0 End If End If Try TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe.Text, indexwert, Environment.UserName, 0, "") Me.lblSaveFinalIndex.Text = "Der Index wurde erfolgreich angelegt - " & Now Me.lblSaveFinalIndex.Visible = True Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Anlage Final Index:") End Try End If Else If txtBezeichner.Text <> "" Then Dim indexwert As String = "" If txtindexwert_final.Visible = True Then indexwert = txtindexwert_final.Text Else If chkbxfinalIndex.CheckState = CheckState.Checked Then indexwert = "True" Else indexwert = "False" End If End If Try TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, "[%VKT" & txtBezeichner.Text, indexwert, Environment.UserName, 0, "") Me.lblSaveFinalIndex.Text = "Der Index wurde erfolgreich angelegt - " & Now Me.lblSaveFinalIndex.Visible = True Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Anlage Final Index in VEKTORFELD:") End Try End If End If Refresh_Final_indexe() INSERT_ACTIVE = False TabControlFinalIndices.Enabled = False End Sub Private Sub ToolStripButton1_Click_1(sender As System.Object, e As System.EventArgs) Handles ToolStripButton1.Click Refresh_Final_indexe() End Sub Private Sub tsbtnProfilkopieren_Click(sender As System.Object, e As System.EventArgs) Handles tsbtnProfilkopieren.Click Dim result As MsgBoxResult = MsgBox("Wollen Sie das gesamte Profil kopieren?" & vbNewLine & "Alle Einstellungen werden übernommen, das Profil wird angelegt und inaktiv gesetzt!", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then Try TBPM_PROFILETableAdapter.cmdInsert_Copy(Environment.UserName, PROFILGUIDTextBox.Text) Dim NewGUID As Integer = TBPM_PROFILETableAdapter.cmdMaxGuid If NewGUID > 0 Then Dim _sql = "INSERT INTO TBPM_PROFILE_CONTROLS " & "(NAME, PROFIL_ID, CTRL_TYPE, CTRL_TEXT, X_LOC, Y_LOC, ADDED_WHO, INDEX_NAME, TYP, VALIDATION, CHOICE_LIST, CONNECTION_ID, SQL_UEBERPRUEFUNG, HEIGHT, WIDTH, READ_ONLY, " & "LOAD_IDX_VALUE, FONT_STYLE, FONT_SIZE, FONT_FAMILY, FONT_COLOR) " & "SELECT LOWER(CTRL_TYPE + CONVERT(VARCHAR(4),ROW_NUMBER() OVER (ORDER BY CTRL_TYPE))),@NEW_PROFIL_ID, CTRL_TYPE, CTRL_TEXT, X_LOC, Y_LOC, '@User', INDEX_NAME, TYP, VALIDATION, CHOICE_LIST, CONNECTION_ID, SQL_UEBERPRUEFUNG, HEIGHT, WIDTH, " & "READ_ONLY, LOAD_IDX_VALUE, FONT_STYLE, FONT_SIZE, FONT_FAMILY, FONT_COLOR " & "FROM TBPM_PROFILE_CONTROLS AS TBPM_PROFILE_CONTROLS_1 " & "WHERE (PROFIL_ID = @Copy_profilId) " _sql = _sql.Replace("@NEW_PROFIL_ID", NewGUID) _sql = _sql.Replace("@User", Environment.UserName) _sql = _sql.Replace("@Copy_profilId", PROFILGUIDTextBox.Text) TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert_Copy(NewGUID, Environment.UserName, PROFILGUIDTextBox.Text) 'TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertCopy(NewGUID, Environment.UserName, PROFILGUIDTextBox.Text) Execute_SQL(_sql) MsgBox("Das Profil " & NAMETextBox.Text & " wurde erfolgreich kopiert!", MsgBoxStyle.Information, "Erfolgsmeldung") Refresh_Profildaten() End If Catch ex As Exception MsgBox("Fehler bei Anlage Profilkopie:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End If End Sub Private Function Execute_SQL(SQL As String) Try Dim SQLconnection As New SqlClient.SqlConnection(MyConnectionString) Dim SQLcommand As New SqlCommand(SQL, SQLconnection) SQLconnection.Open() SQLcommand.ExecuteNonQuery() SQLcommand.Dispose() SQLconnection.Close() Return True Catch ex As Exception MsgBox("Fehler in Execute_SQL: " & vbNewLine & ex.Message & vbNewLine & vbNewLine & " SQL: " & SQL) Return False End Try End Function Private Sub tsbtndeleteProfil_Click(sender As System.Object, e As System.EventArgs) Handles tsbtndeleteProfil.Click Dim result As MsgBoxResult = MsgBox("Sind Sie sicher, dass Sie das Profil " & NAMETextBox.Text & " löschen wollen?", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") ' wenn Speichern ja If result = MsgBoxResult.Yes Then Try Dim ID = PROFILGUIDTextBox.Text Dim del As String = "delete from TBPM_CONTROL_TABLE where CONTROL_ID in (SELECT GUID FROM TBPM_PROFILE_CONTROLS where PROFIL_ID = " & ID & ")" ClassDatabase.Execute_non_Query(del) TBPM_ERROR_LOGTableAdapter.DeletePROFIL(ID) TBPM_PROFILE_FILESTableAdapter.cmdDeleteProfilData(ID) TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdDelete_ProfilID(ID) TBPM_PROFILE_CONTROLSTableAdapter.cmdDeleteProfil(ID) TBPROFILE_USERTableAdapter.CmdDelete_ProfilID(ID) TBPM_PROFILETableAdapter.cmdDelete(ID) MsgBox("Das Profil " & NAMETextBox.Text & " wurde erfolgreich gelöscht!", MsgBoxStyle.Information, "Erfolgsmeldung") Refresh_Profildaten() Catch ex As Exception MsgBox("Fehler bei Löschen des Profils:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End If End Sub Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles btnTest_Email.Click If txtemailEmpfaenger.Text <> "" And EMAIL_FROMTextBox.Text <> "" And EMAIL_SMTPTextBox.Text <> "" And EMAIL_USERTextBox.Text <> "" And EMAIL_PWTextBox.Text <> "" Then email.Send_Log_Mail("Dies ist eine Testemail! Gesendet vom Softwaremodul Process-Manager DD.
", "Testemail Process-Manager", EMAIL_FROMTextBox.Text, EMAIL_SMTPTextBox.Text, EMAIL_USERTextBox.Text, EMAIL_PWTextBox.Text, txtemailEmpfaenger.Text, True) Save_Konfiguration() Else MsgBox("Bitte geben Sie in allen Pflichtfeldern einen Wert ein!", MsgBoxStyle.Exclamation) End If End Sub Private Sub EMAIL_ACTIVECheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles EMAIL_ACTIVECheckBox.CheckedChanged If EMAIL_ACTIVECheckBox.Checked Then Me.grpbxEmail.Enabled = True Else Me.grpbxEmail.Enabled = False End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnStampUser.Click Me.txtindexwert_final.Text = "vUserName" End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnStampDate.Click Me.txtindexwert_final.Text = "vDate" End Sub Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxPMVEKTOR.CheckedChanged If CheckBoxPMVEKTOR.Checked Then Me.txtBezeichner.Visible = True Me.cmbIndexe.Visible = False txtBezeichner.Text = "" Me.lblIndexPMVektor.Text = "Bezeichner für VektorIndex eingeben:" Me.lblIndex.Visible = True Me.lblIndex.Text = "Bitte den festen Wert als String eingeben:" Me.txtindexwert_final.Visible = True Me.grbxSystemStamps.Visible = True Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False Else Me.txtBezeichner.Visible = False Me.cmbIndexe.Visible = True Me.lblIndexPMVektor.Text = "Index wählen:" Me.lblIndex.Visible = False Me.txtindexwert_final.Visible = False Me.grbxSystemStamps.Visible = False Me.txtindexwert_final.Text = "" Me.chkbxfinalIndex.Visible = False End If End Sub Private Sub btnopen_SQLAdmin_Click(sender As Object, e As EventArgs) Handles btnopen_SQLAdmin.Click frmSQL_Admin.ShowDialog() End Sub Private Sub btnRefreshProfiles_Click(sender As Object, e As EventArgs) Handles btnRefreshProfiles.Click Refresh_Profildaten() End Sub Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click TabControlFinalIndices.Enabled = True Me.cmbIndexe.Items.Clear() cmbIndexe2.Items.Clear() Dim indexe = _windreamPM.GetIndicesByObjecttype(cmbObjekttypen.Text) If indexe IsNot Nothing Then For Each index As String In indexe Me.cmbIndexe.Items.Add(index) Me.cmbIndexe2.Items.Add(index) Next Me.cmbIndexe.SelectedIndex = -1 End If INSERT_ACTIVE = True End Sub Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click Dim i, ID As Integer i = TBPM_PROFILE_FINAL_INDEXINGDataGridView.CurrentRow.Index ID = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(0, i).Value If ID > 0 Then TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdDelete(ID) End If Refresh_Final_indexe() MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:") ' DD_DMSLiteDataSet.TBPM_PROFILE_FINAL_INDEXING.Clear() End Sub Private Sub ACTIVECheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ACTIVECheckBox.CheckedChanged If ACTIVECheckBox.Checked Then ACTIVECheckBox.BackColor = Color.Lime Else ACTIVECheckBox.BackColor = Color.Transparent End If End Sub Private Sub btnConnections_Click(sender As Object, e As EventArgs) Handles btnConnections.Click frmConnection.ShowDialog() End Sub Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Cursor = Cursors.WaitCursor frmUserKonfig_AddUsers.ShowDialog() Load_User() Cursor = Cursors.Default End Sub Private Sub ToolStripButton12_Click(sender As Object, e As EventArgs) Handles ToolStripButton12.Click Load_User() End Sub Sub Load_User() Try Me.TBPM_USERTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBDD_USER) Catch ex As Exception MsgBox("Fehler bei LoadUsers: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End Sub Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click Dim result As MsgBoxResult = MsgBox("Wollen Sie den Tabelleninhalt mit den Profil-Dateien wirklich löschen?" & vbNewLine & "Wenn ja müssen Sie auf die Aktualisierung des Jobs warten bis wieder Dateien zur Bearbeitung frei sind.", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then If ClassDatabase.Execute_non_Query("DELETE FROM TBPM_PROFILE_FILES") = True Then MsgBox("Der Inhalt der Tabelle TBPM_PROFILE_FILES wurde erfolgreich gelöscht!", MsgBoxStyle.Information) End If End If End Sub Private Sub cmbObjekttypen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbObjekttypen.SelectedIndexChanged If formloaded = False Then Exit Sub End If If cmbObjekttypen.SelectedIndex <> -1 Then Indexe_eintragen() End If End Sub Private Sub Button3_Click_1(sender As Object, e As EventArgs) Dim indexe = _windreamPM.GetIndicesByObjecttype(cmbObjekttypen.Text) If indexe IsNot Nothing Then For Each index As String In indexe MsgBox(index & vbNewLine & _windreamPM.GetTypeOfIndex(index)) Select Case _windreamPM.GetTypeOfIndex(index) Case 4107 'Vektor Zahl Case 4097 Case Else End Select Next End If End Sub Private Sub Button3_Click_2(sender As Object, e As EventArgs) Handles Button3.Click Dim result As MsgBoxResult = MsgBox("Wollen Sie die Dateien für dieses Profil wirklich entfernen?" & vbNewLine & "Wenn ja müssen Sie auf die Aktualisierung des Jobs warten bis wieder Dateien zur Bearbeitung frei sind.", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then If ClassDatabase.Execute_non_Query("DELETE FROM TBPM_PROFILE_FILES WHERE PROFIL_ID = " & PROFILGUIDTextBox.Text) = True Then MsgBox("Die Dateien zum Profil wurden erfolgreich gelöscht!", MsgBoxStyle.Information) End If End If End Sub Private Sub TBPROFILE_USERBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPROFILE_USERBindingSource.CurrentChanged Me.lblSaveUser.Visible = False End Sub Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click Dim i, ID As Integer i = TBPM_USERDataGridView.CurrentRow.Index ID = TBPM_USERDataGridView.Item(0, i).Value If ID > 0 Then Dim result As MsgBoxResult result = MessageBox.Show("Sind Sie sicher dass Sie diesen User löschen wollen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If result = MsgBoxResult.Yes Then Try Dim del As String = " EXEC PRPM_DELETE_USER " & ID If ClassDatabase.Execute_non_Query(del, True) = True Then Load_User() Load_User() End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in Delete User: ") End Try End If End If End Sub Private Sub TabControlFinalIndices_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControlFinalIndices.SelectedIndexChanged If TabControlFinalIndices.SelectedIndex = 1 Then Me.cmbIndexe2.Enabled = False If INSERT_ACTIVE = True Then Me.cmbIndexe2.Enabled = True End If End If End Sub Private Sub btnSaveSQLCommand_Click(sender As Object, e As EventArgs) Handles btnSaveSQLCommand.Click If INSERT_ACTIVE = True Then If cmbConnection.SelectedIndex = -1 Or SQL_COMMANDTextBox.Text = String.Empty Or cmbIndexe2.SelectedIndex = -1 Then MsgBox("Bitte wählen Sie eine Connection und definieren einen SQL-Befehl!", MsgBoxStyle.Exclamation) Exit Sub End If TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", Environment.UserName, cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text) INSERT_ACTIVE = False Else Dim i, ID As Integer i = TBPM_PROFILE_FINAL_INDEXINGDataGridView.CurrentRow.Index ID = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(0, i).Value If ID > 0 Then TBPM_PROFILE_FINAL_INDEXINGTableAdapter.cmdUpdateSQL(cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text, Environment.UserName, ID) End If End If Refresh_Final_indexe() End Sub Private Sub btnEditor_Click(sender As Object, e As EventArgs) Handles btnEditor.Click Dim CONID = 0 If cmbConnection.SelectedValue > 0 Then CONID = cmbConnection.SelectedValue End If If INSERT_ACTIVE = True Then If cmbIndexe2.SelectedIndex = -1 Then MsgBox("Bitte wählen Sie einen Index!", MsgBoxStyle.Exclamation) Exit Sub End If TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", Environment.UserName, CONID, SQL_COMMANDTextBox.Text) End If Dim i, ID As Integer i = TBPM_PROFILE_FINAL_INDEXINGDataGridView.CurrentRow.Index ID = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(0, i).Value If ID > 0 Then CURRENT_INDEX_ID = ID CURRENT_DESIGN_TYPE = "FINAL_INDEX" CURRENT_SQL_COMAMND = SQL_COMMANDTextBox.Text CURRENT_SQL_CON = CONID CURRENT_ProfilGUID = PROFILGUIDTextBox.Text frmSQL_DESIGNER.ShowDialog() End If Refresh_Final_indexe() End Sub Private Sub TBPM_PROFILE_FINAL_INDEXINGDataGridView_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles TBPM_PROFILE_FINAL_INDEXINGDataGridView.CellClick Try TabControlFinalIndices.Enabled = False TabControlFinalIndices.SelectedIndex = 0 Dim i, ID As Integer i = TBPM_PROFILE_FINAL_INDEXINGDataGridView.CurrentRow.Index ID = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(0, i).Value If ID > 0 Then Dim sql = String.Format("SELECT T.*, T1.BEZEICHNUNG AS CON_STRING FROM TBPM_PROFILE_FINAL_INDEXING T,TBDD_CONNECTION T1 WHERE T.GUID = {0} AND T.CONNECTION_ID = T1.GUID ", ID) CURRENT_DT_SQL_CONFIG_TABLE = ClassDatabase.Return_Datatable(sql, True) Dim Type = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(2, i).Value If Type = "SQL-Command" Then Dim Indexname = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(1, i).Value TabControlFinalIndices.Enabled = True TabControlFinalIndices.SelectedIndex = 1 cmbIndexe2.Text = Indexname cmbConnection.SelectedValue = CURRENT_DT_SQL_CONFIG_TABLE.Rows(0).Item("CONNECTION_ID") cmbConnection.FindStringExact(CURRENT_DT_SQL_CONFIG_TABLE.Rows(0).Item("CON_STRING")) SQL_COMMANDTextBox.Text = CURRENT_DT_SQL_CONFIG_TABLE.Rows(0).Item("SQL_COMMAND") End If End If Catch ex As Exception End Try End Sub Private Sub btnShowConnections_Click(sender As Object, e As EventArgs) Handles btnShowConnections.Click frmConnection.ShowDialog() End Sub Private Sub RIGHT_FILE_DELETECheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles RIGHT_FILE_DELETECheckBox.CheckedChanged If GUIDTextBox.Text <> "" Then Try Dim sql = String.Format("SELECT RIGHT1 FROM TBDD_USER_MODULES WHERE USER_ID = {0} AND MODULE_ID = (SELECT GUID FROM TBDD_MODULES WHERE SHORT_NAME = 'PM')", GUIDTextBox.Text) Dim RIGHT_FILE_DELETE = ClassDatabase.Execute_Scalar(sql, MyConnectionString) If CBool(RIGHT_FILE_DELETE) <> RIGHT_FILE_DELETECheckBox.Checked Then Dim upd = String.Format("UPDATE TBDD_USER_MODULES SET RIGHT1 = '{0}' WHERE USER_ID = {1} AND MODULE_ID = (SELECT GUID FROM TBDD_MODULES WHERE SHORT_NAME = 'PM')", RIGHT_FILE_DELETECheckBox.Checked, GUIDTextBox.Text) If ClassDatabase.Execute_non_Query(upd) = True Then lblSaveUser.Text = "Right was saved successfully - " & Now.ToString lblSaveUser.Visible = False End If End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Unexpected Error in RIGHT_FILE_DELETECheckBox.CheckedChanged: ") End Try End If End Sub Private Sub TBDD_USERBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBDD_USERBindingSource.CurrentChanged If GUIDTextBox.Text <> "" Then Try Dim sql = String.Format("SELECT RIGHT1 FROM TBDD_USER_MODULES WHERE USER_ID = {0} AND MODULE_ID = (SELECT GUID FROM TBDD_MODULES WHERE SHORT_NAME = 'PM')", GUIDTextBox.Text) Dim RIGHT_FILE_DELETE = ClassDatabase.Execute_Scalar(sql, MyConnectionString) RIGHT_FILE_DELETECheckBox.Checked = CBool(RIGHT_FILE_DELETE) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Unexpected Error in TBDD_USERBindingSource.CurrentChanged: ") End Try End If End Sub End Class