diff --git a/UID/ADMIN.vbproj b/UID/ADMIN.vbproj index fdfca64..f5c2f99 100644 --- a/UID/ADMIN.vbproj +++ b/UID/ADMIN.vbproj @@ -443,6 +443,12 @@ Form + + frmAPIEinstellungen.vb + + + Form + frmERS.vb @@ -727,6 +733,9 @@ frmAPI.vb + + frmAPIEinstellungen.vb + frmERS.vb diff --git a/UID/Mitarbeiter/frmMitarbDetails.vb b/UID/Mitarbeiter/frmMitarbDetails.vb index 29cdc9f..56f5f2f 100644 --- a/UID/Mitarbeiter/frmMitarbDetails.vb +++ b/UID/Mitarbeiter/frmMitarbDetails.vb @@ -908,7 +908,7 @@ Public Class frmMitarbDetails ZOLLDATENBEARB = True ElseIf tbcntr.SelectedIndex = 3 Then - timas = New VERAG_PROG_ALLGEMEIN.cTimasAPI() + timas = New VERAG_PROG_ALLGEMEIN.cTimasAPI("timas") If IsNothing(mitarbeiter.mit_timasId) Then cbxTimasAngelegt.Checked = False @@ -921,6 +921,7 @@ Public Class frmMitarbDetails btnMAanlegen.Visible = Not cbxTimasAngelegt.Checked txtLohnNr.Enabled = Not cbxTimasAngelegt.Checked + txtClientNr.Enabled = Not cbxTimasAngelegt.Checked dgvData.Visible = Not cbxTimasAngelegt.Checked TabControl1.Visible = Not cbxTimasAngelegt.Checked rtfInfoTimas.Visible = cbxTimasAngelegt.Checked @@ -964,7 +965,7 @@ Public Class frmMitarbDetails Exit Sub End If - Dim cs = New cCreditSafeAPI + Dim cs = New cCreditSafeAPI("creditsafe") Dim statuscode = cs.authenticate(txtCSUser.Text, txtCSPW.Text) Select Case statuscode @@ -1210,6 +1211,7 @@ Public Class frmMitarbDetails btnMAanlegen.Visible = Not cbxTimasAngelegt.Checked txtLohnNr.Enabled = Not cbxTimasAngelegt.Checked + txtClientNr.Enabled = Not cbxTimasAngelegt.Checked dgvData.Visible = Not cbxTimasAngelegt.Checked rtfInfoTimas.Visible = cbxTimasAngelegt.Checked btngetInfo.Visible = cbxTimasAngelegt.Checked @@ -1252,7 +1254,7 @@ Public Class frmMitarbDetails If txtLohnNr.Text = "" Then - If Not vbYes = MsgBox("Möchten Sie den Mitarbeiter ohne Lohnnummer anlegen?" & vbNewLine & "Ohne Lohnnummer kann kein Ableich ins Lohnsystem erfolgen!", vbYesNoCancel) Then + If Not vbYes = MsgBox("Möchten Sie den Mitarbeiter ohne Lohnnummer anlegen?" & vbNewLine & "Ohne Lohnnummer kann kein Abgleich ins Lohnsystem erfolgen!", vbYesNoCancel) Then Return False End If @@ -1301,10 +1303,6 @@ Public Class frmMitarbDetails End Sub - Private Sub PictureBox9_Click_1(sender As Object, e As EventArgs) - Dim webAddress As String = "https://zeit.verag.ag/" - Process.Start(webAddress) - End Sub Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged If dgvData Is Nothing And dgvData.Rows.Count < 1 Then Exit Sub diff --git a/UID/Mitarbeiter/frmMitarbTimas.vb b/UID/Mitarbeiter/frmMitarbTimas.vb index 12f80a6..9a55efc 100644 --- a/UID/Mitarbeiter/frmMitarbTimas.vb +++ b/UID/Mitarbeiter/frmMitarbTimas.vb @@ -41,7 +41,7 @@ Public Class frmMitarbTimas End Sub Private Sub initMitarbeiter(mid As Integer, Optional _isUpdate As Boolean = False) - timas = New cTimasAPI + timas = New cTimasAPI("timas") emp = timas.getEmployee(mid) avisoEmp = New VERAG_PROG_ALLGEMEIN.cMitarbeiter(emp.externid) diff --git a/UID/Mitarbeiter/usrCntlMitarbeiter.vb b/UID/Mitarbeiter/usrCntlMitarbeiter.vb index 94da4c2..c168bd8 100644 --- a/UID/Mitarbeiter/usrCntlMitarbeiter.vb +++ b/UID/Mitarbeiter/usrCntlMitarbeiter.vb @@ -212,7 +212,7 @@ Public Class usrCntlMitarbeiter dgvTimasNew.DataSource = dt Else - Dim timas As New cTimasAPI() + Dim timas As New cTimasAPI("timas") timas.getEmployeeList(dt) dgvTimasNew.DataSource = dt @@ -715,7 +715,6 @@ Public Class usrCntlMitarbeiter Private Sub uploadToWiki() Me.Cursor = Cursors.WaitCursor - Dim token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGkiOjEsImdycCI6MSwiaWF0IjoxNjg3OTMzNDU3LCJleHAiOjE3MTk0OTEwNTcsImF1ZCI6InVybjp3aWtpLmpzIiwiaXNzIjoidXJuOndpa2kuanMifQ.ul2loFYVHdco2Ia2LcS4nme4PdgcuU6QKrunucECebX5LhcsSyuEg-lKiP2X3JXW57Ym4oCBjamDd5-5uqbQd9hOQ5CDO6yqK2r8TPNxivK29oAl2wfcHaKOe7QNti0yRlMpomJjc_5qaegeeLjN5w-lYbbqtSz_6y8GkPPr0P3l4coIk5IzngGazj8XLYGGN6y5qT4s8IR0sNhfz0hJAlIeVTeFKl8KFZMpFKvBnOjkL0GYOYjrHzPLSUAhe8hCGVcA7rWsweVjjvOclFDDFwZ0SwOY0TZqvz-LOsZ3V7ucQaT3flAjuHiEhODGJguQRBs67U8lVO2cxbJJyR3FUA" Dim dgv As New DataGridView If TabControl1.SelectedIndex = 0 Then @@ -748,11 +747,25 @@ Public Class usrCntlMitarbeiter End If + Dim SQL As New SQL + Dim API As New DataTable + Dim apiSettingsloaded As Boolean = False + Dim API_STRING + + API = SQL.loadDgvBySql("SELECT top(1) * FROM tblAPIEinstellungen WHERE api_program='WIKI' and api_productive ='" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "0", "1") & "'", "ADMIN") + If API.Rows.Count = 0 Then + MsgBox("keine gültigen API-Einstellungen für WIKI gefunden!") + Else + apiSettingsloaded = True + API_STRING = API.Rows(0).Item("api_url") + End If + + If apiSettingsloaded = False Then Exit Sub For Each row As DataGridViewRow In dgv.Rows If row.Cells("mit_foto_DocId").Value > 0 Then Dim file = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(row.Cells("mit_foto_DocId").Value) - Dim succeess = uploadPictureToWIKI(token, 4, file) 'Folder 4 -> Mitarbeiterfotos + Dim succeess = uploadPictureToWIKI(API, 4, file) 'Folder 4 -> Mitarbeiterfotos End If Next @@ -768,12 +781,13 @@ Public Class usrCntlMitarbeiter - Private Function uploadPictureToWIKI(authenticationToken As String, folderIDx As Integer, image As String) As String + Private Function uploadPictureToWIKI(API As DataTable, folderIDx As Integer, image As String) As String Try VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() - Dim API_STRING = "https://wiki.verag.ag" + Dim API_String = API.Rows(0).Item("api_url") + Dim rest As New Chilkat.Rest Dim success As Boolean Dim failureDesc As String @@ -782,7 +796,7 @@ Public Class usrCntlMitarbeiter Dim bTls As Boolean = True Dim port As Integer = 443 Dim bAutoReconnect As Boolean = True - success = rest.Connect(API_STRING, port, bTls, bAutoReconnect) + success = rest.Connect(API_String, port, bTls, bAutoReconnect) If (success <> True) Then Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason) Debug.WriteLine(rest.LastErrorText) @@ -792,7 +806,7 @@ Public Class usrCntlMitarbeiter API_STRING &= "/u" - rest.AddHeader("Authorization", "Bearer " & authenticationToken) + rest.AddHeader("Authorization", "Bearer " & API.Rows(0).Item("api_token")) rest.AddHeader("Content-Type", "multipart/form-data") Dim filename = New IO.FileInfo(image).Name diff --git a/UID/frmAPIEinstellungen.Designer.vb b/UID/frmAPIEinstellungen.Designer.vb new file mode 100644 index 0000000..6f0e4e2 --- /dev/null +++ b/UID/frmAPIEinstellungen.Designer.vb @@ -0,0 +1,116 @@ + _ +Partial Class frmAPIEinstellungen + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.Label2 = New System.Windows.Forms.Label() + Me.txtSuche = New System.Windows.Forms.TextBox() + Me.btnOK = New System.Windows.Forms.Button() + Me.DataGridView = New System.Windows.Forms.DataGridView() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + CType(Me.DataGridView, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(9, 7) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(41, 13) + Me.Label2.TabIndex = 21 + Me.Label2.Text = "Suche:" + ' + 'txtSuche + ' + Me.txtSuche.Location = New System.Drawing.Point(12, 23) + Me.txtSuche.Name = "txtSuche" + Me.txtSuche.Size = New System.Drawing.Size(176, 20) + Me.txtSuche.TabIndex = 22 + ' + 'btnOK + ' + Me.btnOK.Location = New System.Drawing.Point(863, 454) + Me.btnOK.Name = "btnOK" + Me.btnOK.Size = New System.Drawing.Size(109, 23) + Me.btnOK.TabIndex = 20 + Me.btnOK.Text = "Speichern" + Me.btnOK.UseVisualStyleBackColor = True + Me.btnOK.Visible = False + ' + 'DataGridView + ' + Me.DataGridView.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.DataGridView.Location = New System.Drawing.Point(12, 49) + Me.DataGridView.MultiSelect = False + Me.DataGridView.Name = "DataGridView" + Me.DataGridView.Size = New System.Drawing.Size(1134, 399) + Me.DataGridView.TabIndex = 19 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(661, 7) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(485, 13) + Me.Label1.TabIndex = 23 + Me.Label1.Text = "Produktiv: werden nur in Produktivumgebung durchgeführt, nicht in der Developer-U" & + "mgebung (TEST)" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(661, 26) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(265, 13) + Me.Label3.TabIndex = 24 + Me.Label3.Text = "Token:Für Authentifizierung werden Token verwendet!" + ' + 'frmAPIEinstellungen + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(1158, 485) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.txtSuche) + Me.Controls.Add(Me.btnOK) + Me.Controls.Add(Me.DataGridView) + Me.Name = "frmAPIEinstellungen" + Me.Text = "API Verwaltung" + CType(Me.DataGridView, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents Label2 As Label + Friend WithEvents txtSuche As TextBox + Friend WithEvents btnOK As Button + Friend WithEvents DataGridView As DataGridView + Friend WithEvents Label1 As Label + Friend WithEvents Label3 As Label +End Class diff --git a/UID/frmAPIEinstellungen.resx b/UID/frmAPIEinstellungen.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UID/frmAPIEinstellungen.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UID/frmAPIEinstellungen.vb b/UID/frmAPIEinstellungen.vb new file mode 100644 index 0000000..41a8266 --- /dev/null +++ b/UID/frmAPIEinstellungen.vb @@ -0,0 +1,132 @@ +Imports VERAG_PROG_ALLGEMEIN + +Public Class frmAPIEinstellungen + + Dim APIBind As cEasyBinding + Public table + Public BIND_DB + Private EditRow As Integer = -1 + Sub New(table, BIND_DB) + Me.table = table + Me.BIND_DB = BIND_DB + InitializeComponent() + End Sub + + Private Sub frmAPIEinstellungen_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + loadDGV() + btnOK.Visible = True + + + End Sub + + Private Sub loadDGV(Optional sqlwhere As String = "") + + Try + APIBind = New cEasyBinding(BIND_DB) + + + If sqlwhere = "" Then + + APIBind.initBinding("SELECT [api_active],[api_productive], [api_program],[api_id],[api_url] ,[api_user],[api_password] ,[api_UseToken],[api_token] ,[api_description] FROM " & table, table) + Else + + APIBind.initBinding("SELECT [api_active],[api_productive], [api_program], [api_id],[api_url] ,[api_user],[api_password] ,[api_useToken],[api_token] ,[api_description] FROM " & table & " WHERE " & sqlwhere, table) + + End If + + DataGridView.DataSource = APIBind.bindingdataTable + + With DataGridView + + If .Columns.Count > 0 Then + + .Columns("api_id").Visible = False + .Columns("api_active").HeaderText = "Aktiv" + .Columns("api_active").Width = 50 + .Columns("api_productive").HeaderText = "Produktiv" + .Columns("api_productive").Width = 70 + .Columns("api_program").HeaderText = "Programm" + .Columns("api_program").Width = 80 + .Columns("api_url").HeaderText = "URL" + .Columns("api_url").Width = 150 + .Columns("api_user").HeaderText = "User" + .Columns("api_user").Width = 100 + .Columns("api_password").HeaderText = "PW" + .Columns("api_password").Width = 100 + .Columns("api_useToken").HeaderText = "Token" + .Columns("api_useToken").Width = 40 + .Columns("api_Token").HeaderText = "Token-Key" + .Columns("api_Token").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .Columns("api_description").HeaderText = "Beschreibung" + .Columns("api_description").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + + End If + + End With + + + + Catch ex As Exception + MsgBox(ex.Message) + End Try + + End Sub + + Private Sub TextBox1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtSuche.PreviewKeyDown + + Dim sqladdon As String = "" + + If e.KeyCode = Keys.Enter Then + If txtSuche.Text <> "" Then + sqladdon &= " [api_program] like '%" & txtSuche.Text & "%' or [api_url] like '%" & txtSuche.Text & "%'" + End If + loadDGV(sqladdon) + End If + + + + End Sub + + + Private Sub DataGridView_DefaultValuesNeeded(sender As Object, e As DataGridViewRowEventArgs) Handles DataGridView.DefaultValuesNeeded + Try + + e.Row.Cells("api_active").Value = True + e.Row.Cells("api_productive").Value = False + e.Row.Cells("api_token").Value = False + + Catch ex As Exception + MsgBox(ex.Message) + End Try + End Sub + + + Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click + + If DataGridView.Columns.Count = 0 Or DataGridView.SelectedRows.Count = 0 Then 'alles gelöscht oder markierte Zeile gelöscht + APIBind.updateBinding() + Exit Sub + End If + + If DataGridView.CurrentRow.Cells("api_url").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("api_user").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("api_password").ToString <> "" AndAlso EditRow >= 0 Then + APIBind.updateBinding() + End If + + End Sub + + + Private Sub DataGridView_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView.EditingControlShowing + EditRow = DataGridView.CurrentRow.Index + End Sub + + Private Sub DataGridView_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView.SelectionChanged + If EditRow >= 0 Then + Dim new_row As Integer = EditRow + EditRow = -1 + DataGridView.CurrentCell = DataGridView.Rows(new_row).Cells( + DataGridView.CurrentCell.ColumnIndex) + End If + End Sub + +End Class \ No newline at end of file diff --git a/UID/usrCntlAPI.vb b/UID/usrCntlAPI.vb index ac1d491..a7d9b60 100644 --- a/UID/usrCntlAPI.vb +++ b/UID/usrCntlAPI.vb @@ -270,7 +270,8 @@ Public Class usrCntlAPI End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - + Dim f = New frmAPIEinstellungen("tblAPIEinstellungen", "ADMIN") + f.Show() End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click