This commit is contained in:
2023-09-27 12:57:29 +02:00
parent 842aee93f1
commit 47ad49ba44
5 changed files with 87 additions and 219 deletions

View File

View File

@@ -145,8 +145,8 @@ Public Class frmMain
Dim timas As New cTimasAPI Dim timas As New cTimasAPI
Dim infoMessage As String = "" Dim infoMessage As String = ""
Dim timeEntryExisting As Boolean = False Dim timeEntryExisting As Boolean = False
timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, infoMessage, timeEntryExisting) timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, Nothing, timeEntryExisting)
If Not timeEntryExisting Then If Not timeEntryExisting Then
Dim a As MsgBoxResult = MsgBox("Für " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME & " wurde heute noch keine Zeit erfasst!" & vbNewLine & Now.ToString() & " als Startzeit erfassen?", vbYesNo) Dim a As MsgBoxResult = MsgBox("Für " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME & " wurde heute noch keine Zeit erfasst!" & vbNewLine & Now.ToString() & " als Startzeit erfassen?", vbYesNo)
If a = vbYes Then If a = vbYes Then
Dim info Dim info

View File

@@ -28,7 +28,6 @@ Partial Class frmMitarbeitersuche
Me.Button4 = New System.Windows.Forms.Button() Me.Button4 = New System.Windows.Forms.Button()
Me.btnClose = New System.Windows.Forms.Button() Me.btnClose = New System.Windows.Forms.Button()
Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.PictureBox2 = New System.Windows.Forms.PictureBox()
Me.sbMitarbeiter = New VERAG_PROG_ALLGEMEIN.MySearchBox()
Me.pnlMain = New System.Windows.Forms.Panel() Me.pnlMain = New System.Windows.Forms.Panel()
Me.pnl = New System.Windows.Forms.Panel() Me.pnl = New System.Windows.Forms.Panel()
Me.lblMAId = New System.Windows.Forms.Label() Me.lblMAId = New System.Windows.Forms.Label()
@@ -60,6 +59,7 @@ Partial Class frmMitarbeitersuche
Me.pnlGeburtstag = New System.Windows.Forms.Panel() Me.pnlGeburtstag = New System.Windows.Forms.Panel()
Me.lblGeburtstag = New System.Windows.Forms.Label() Me.lblGeburtstag = New System.Windows.Forms.Label()
Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.pnlZeiten = New System.Windows.Forms.Panel()
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components) Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
Me.Panel1 = New System.Windows.Forms.Panel() Me.Panel1 = New System.Windows.Forms.Panel()
Me.lblPosition = New System.Windows.Forms.Label() Me.lblPosition = New System.Windows.Forms.Label()
@@ -70,6 +70,7 @@ Partial Class frmMitarbeitersuche
Me.lblFirma = New System.Windows.Forms.Label() Me.lblFirma = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label()
Me.sbMitarbeiter = New VERAG_PROG_ALLGEMEIN.MySearchBox()
Me.pnlSrch.SuspendLayout() Me.pnlSrch.SuspendLayout()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlMain.SuspendLayout() Me.pnlMain.SuspendLayout()
@@ -82,6 +83,7 @@ Partial Class frmMitarbeitersuche
CType(Me.pic, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.pic, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlGeburtstag.SuspendLayout() Me.pnlGeburtstag.SuspendLayout()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlZeiten.SuspendLayout()
Me.MyPanel1.SuspendLayout() Me.MyPanel1.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
@@ -140,50 +142,25 @@ Partial Class frmMitarbeitersuche
Me.PictureBox2.TabIndex = 18 Me.PictureBox2.TabIndex = 18
Me.PictureBox2.TabStop = False Me.PictureBox2.TabStop = False
' '
'sbMitarbeiter
'
Me.sbMitarbeiter._allowFreitext = False
Me.sbMitarbeiter._AllowSetValue = False
Me.sbMitarbeiter._allowSpaceAsSplitter = True
Me.sbMitarbeiter._autoSizeGross = False
Me.sbMitarbeiter._hideIfListEmpty = True
Me.sbMitarbeiter._value = Nothing
Me.sbMitarbeiter.conn_art = "FMZOLL"
Me.sbMitarbeiter.dgvpos = "LEFT"
Me.sbMitarbeiter.DISPLAY_PARAM = Nothing
Me.sbMitarbeiter.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!)
Me.sbMitarbeiter.INVISIBLE_COLUMNS = Nothing
Me.sbMitarbeiter.key_visible = False
Me.sbMitarbeiter.KEYPARAM = Nothing
Me.sbMitarbeiter.Location = New System.Drawing.Point(45, 11)
Me.sbMitarbeiter.Name = "sbMitarbeiter"
Me.sbMitarbeiter.searchActive = True
Me.sbMitarbeiter.Size = New System.Drawing.Size(582, 29)
Me.sbMitarbeiter.SQL_ORDER_BY = Nothing
Me.sbMitarbeiter.SQL_SELECT = Nothing
Me.sbMitarbeiter.SQL_WHERE = Nothing
Me.sbMitarbeiter.SQL_WhereParamList = Nothing
Me.sbMitarbeiter.TabIndex = 0
Me.sbMitarbeiter.usrcntl = Nothing
'
'pnlMain 'pnlMain
' '
Me.pnlMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.pnlMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.pnlMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnlMain.Controls.Add(Me.pnl) Me.pnlMain.Controls.Add(Me.pnl)
Me.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill Me.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnlMain.Location = New System.Drawing.Point(0, 48) Me.pnlMain.Location = New System.Drawing.Point(0, 48)
Me.pnlMain.Name = "pnlMain" Me.pnlMain.Name = "pnlMain"
Me.pnlMain.Size = New System.Drawing.Size(776, 439) Me.pnlMain.Size = New System.Drawing.Size(776, 456)
Me.pnlMain.TabIndex = 1 Me.pnlMain.TabIndex = 1
' '
'pnl 'pnl
' '
Me.pnl.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.pnl.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer)) Me.pnl.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer))
Me.pnl.Controls.Add(Me.pnlZeiten)
Me.pnl.Controls.Add(Me.lblMAId) Me.pnl.Controls.Add(Me.lblMAId)
Me.pnl.Controls.Add(Me.Label5) Me.pnl.Controls.Add(Me.Label5)
Me.pnl.Controls.Add(Me.btnSettings) Me.pnl.Controls.Add(Me.btnSettings)
Me.pnl.Controls.Add(Me.PictureBox9)
Me.pnl.Controls.Add(Me.lblTimasSaldo)
Me.pnl.Controls.Add(Me.lblTimasZeiten) Me.pnl.Controls.Add(Me.lblTimasZeiten)
Me.pnl.Controls.Add(Me.pnlWohnadresse) Me.pnl.Controls.Add(Me.pnlWohnadresse)
Me.pnl.Controls.Add(Me.lblSpitzname) Me.pnl.Controls.Add(Me.lblSpitzname)
@@ -206,7 +183,7 @@ Partial Class frmMitarbeitersuche
Me.pnl.Dock = System.Windows.Forms.DockStyle.Fill Me.pnl.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnl.Location = New System.Drawing.Point(0, 0) Me.pnl.Location = New System.Drawing.Point(0, 0)
Me.pnl.Name = "pnl" Me.pnl.Name = "pnl"
Me.pnl.Size = New System.Drawing.Size(774, 437) Me.pnl.Size = New System.Drawing.Size(774, 454)
Me.pnl.TabIndex = 24 Me.pnl.TabIndex = 24
' '
'lblMAId 'lblMAId
@@ -237,7 +214,7 @@ Partial Class frmMitarbeitersuche
Me.btnSettings.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnSettings.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnSettings.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.wheel_s Me.btnSettings.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.wheel_s
Me.btnSettings.ImageAlign = System.Drawing.ContentAlignment.TopLeft Me.btnSettings.ImageAlign = System.Drawing.ContentAlignment.TopLeft
Me.btnSettings.Location = New System.Drawing.Point(650, 386) Me.btnSettings.Location = New System.Drawing.Point(641, 396)
Me.btnSettings.Name = "btnSettings" Me.btnSettings.Name = "btnSettings"
Me.btnSettings.Size = New System.Drawing.Size(125, 35) Me.btnSettings.Size = New System.Drawing.Size(125, 35)
Me.btnSettings.TabIndex = 29 Me.btnSettings.TabIndex = 29
@@ -249,7 +226,7 @@ Partial Class frmMitarbeitersuche
'PictureBox9 'PictureBox9
' '
Me.PictureBox9.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green Me.PictureBox9.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green
Me.PictureBox9.Location = New System.Drawing.Point(7, 393) Me.PictureBox9.Location = New System.Drawing.Point(10, 7)
Me.PictureBox9.Name = "PictureBox9" Me.PictureBox9.Name = "PictureBox9"
Me.PictureBox9.Size = New System.Drawing.Size(34, 27) Me.PictureBox9.Size = New System.Drawing.Size(34, 27)
Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
@@ -259,9 +236,9 @@ Partial Class frmMitarbeitersuche
'lblTimasSaldo 'lblTimasSaldo
' '
Me.lblTimasSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) Me.lblTimasSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!)
Me.lblTimasSaldo.Location = New System.Drawing.Point(45, 396) Me.lblTimasSaldo.Location = New System.Drawing.Point(50, 7)
Me.lblTimasSaldo.Name = "lblTimasSaldo" Me.lblTimasSaldo.Name = "lblTimasSaldo"
Me.lblTimasSaldo.Size = New System.Drawing.Size(152, 24) Me.lblTimasSaldo.Size = New System.Drawing.Size(189, 24)
Me.lblTimasSaldo.TabIndex = 30 Me.lblTimasSaldo.TabIndex = 30
Me.lblTimasSaldo.Visible = False Me.lblTimasSaldo.Visible = False
' '
@@ -270,7 +247,7 @@ Partial Class frmMitarbeitersuche
Me.lblTimasZeiten.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) Me.lblTimasZeiten.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!)
Me.lblTimasZeiten.Location = New System.Drawing.Point(203, 396) Me.lblTimasZeiten.Location = New System.Drawing.Point(203, 396)
Me.lblTimasZeiten.Name = "lblTimasZeiten" Me.lblTimasZeiten.Name = "lblTimasZeiten"
Me.lblTimasZeiten.Size = New System.Drawing.Size(563, 25) Me.lblTimasZeiten.Size = New System.Drawing.Size(78, 25)
Me.lblTimasZeiten.TabIndex = 12 Me.lblTimasZeiten.TabIndex = 12
Me.lblTimasZeiten.Visible = False Me.lblTimasZeiten.Visible = False
' '
@@ -323,7 +300,7 @@ Partial Class frmMitarbeitersuche
' '
Me.Panel3.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Panel3.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel3.Location = New System.Drawing.Point(0, 424) Me.Panel3.Location = New System.Drawing.Point(0, 441)
Me.Panel3.Name = "Panel3" Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(774, 13) Me.Panel3.Size = New System.Drawing.Size(774, 13)
Me.Panel3.TabIndex = 26 Me.Panel3.TabIndex = 26
@@ -502,6 +479,15 @@ Partial Class frmMitarbeitersuche
Me.PictureBox1.TabIndex = 13 Me.PictureBox1.TabIndex = 13
Me.PictureBox1.TabStop = False Me.PictureBox1.TabStop = False
' '
'pnlZeiten
'
Me.pnlZeiten.Controls.Add(Me.PictureBox9)
Me.pnlZeiten.Controls.Add(Me.lblTimasSaldo)
Me.pnlZeiten.Location = New System.Drawing.Point(8, 393)
Me.pnlZeiten.Name = "pnlZeiten"
Me.pnlZeiten.Size = New System.Drawing.Size(619, 40)
Me.pnlZeiten.TabIndex = 22
'
'MyPanel1 'MyPanel1
' '
Me.MyPanel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer)) Me.MyPanel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer))
@@ -615,12 +601,39 @@ Partial Class frmMitarbeitersuche
Me.Label3.Text = "Niederlassung:" Me.Label3.Text = "Niederlassung:"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
' '
'sbMitarbeiter
'
Me.sbMitarbeiter._allowFreitext = False
Me.sbMitarbeiter._AllowSetValue = False
Me.sbMitarbeiter._allowSpaceAsSplitter = True
Me.sbMitarbeiter._autoSizeGross = False
Me.sbMitarbeiter._hideIfListEmpty = True
Me.sbMitarbeiter._value = Nothing
Me.sbMitarbeiter.conn_art = "FMZOLL"
Me.sbMitarbeiter.dgvpos = "LEFT"
Me.sbMitarbeiter.DISPLAY_PARAM = Nothing
Me.sbMitarbeiter.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!)
Me.sbMitarbeiter.INVISIBLE_COLUMNS = Nothing
Me.sbMitarbeiter.key_visible = False
Me.sbMitarbeiter.KEYPARAM = Nothing
Me.sbMitarbeiter.Location = New System.Drawing.Point(45, 11)
Me.sbMitarbeiter.Name = "sbMitarbeiter"
Me.sbMitarbeiter.searchActive = True
Me.sbMitarbeiter.Size = New System.Drawing.Size(582, 29)
Me.sbMitarbeiter.SQL_ORDER_BY = Nothing
Me.sbMitarbeiter.SQL_SELECT = Nothing
Me.sbMitarbeiter.SQL_WHERE = Nothing
Me.sbMitarbeiter.SQL_WhereParamList = Nothing
Me.sbMitarbeiter.TabIndex = 0
Me.sbMitarbeiter.usrcntl = Nothing
'
'frmMitarbeitersuche 'frmMitarbeitersuche
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.BackColor = System.Drawing.Color.WhiteSmoke Me.BackColor = System.Drawing.Color.WhiteSmoke
Me.ClientSize = New System.Drawing.Size(776, 487) Me.ClientSize = New System.Drawing.Size(776, 504)
Me.Controls.Add(Me.pnlMain) Me.Controls.Add(Me.pnlMain)
Me.Controls.Add(Me.pnlSrch) Me.Controls.Add(Me.pnlSrch)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
@@ -643,6 +656,7 @@ Partial Class frmMitarbeitersuche
Me.pnlGeburtstag.ResumeLayout(False) Me.pnlGeburtstag.ResumeLayout(False)
Me.pnlGeburtstag.PerformLayout() Me.pnlGeburtstag.PerformLayout()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.pnlZeiten.ResumeLayout(False)
Me.MyPanel1.ResumeLayout(False) Me.MyPanel1.ResumeLayout(False)
Me.ResumeLayout(False) Me.ResumeLayout(False)
@@ -694,4 +708,5 @@ Partial Class frmMitarbeitersuche
Friend WithEvents PictureBox9 As Windows.Forms.PictureBox Friend WithEvents PictureBox9 As Windows.Forms.PictureBox
Friend WithEvents lblMAId As Windows.Forms.Label Friend WithEvents lblMAId As Windows.Forms.Label
Friend WithEvents Label5 As Windows.Forms.Label Friend WithEvents Label5 As Windows.Forms.Label
Friend WithEvents pnlZeiten As Windows.Forms.Panel
End Class End Class

View File

@@ -64,7 +64,7 @@ Public Class frmMitarbeitersuche
Sub initMA() Sub initMA()
btn.Visible = False btn.Visible = False
pnl.Visible = False pnl.Visible = False
lblTimasZeiten.Visible = False 'lblTimasZeiten.Visible = False
lblTimasSaldo.Visible = False lblTimasSaldo.Visible = False
Panel1.Visible = False Panel1.Visible = False
btnSettings.Visible = False btnSettings.Visible = False
@@ -166,13 +166,24 @@ Public Class frmMitarbeitersuche
If VERAG_PROG_ALLGEMEIN.cAllgemein.USRID = MA.mit_id Then If VERAG_PROG_ALLGEMEIN.cAllgemein.USRID = MA.mit_id Then
btn.Visible = True btn.Visible = True
'Eintrag für Zeitübersicht 'Eintrag für Zeitübersicht
lblTimasZeiten.Visible = True 'lblTimasZeiten.Visible = True
lblTimasSaldo.Visible = True lblTimasSaldo.Visible = True
If Not requestDone Then If Not requestDone Then
Dim dtZeiten As New DataTable
If timas IsNot Nothing Then If timas IsNot Nothing Then
timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text) timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text)
timas.getTimeEntries(MA.mit_timasId, lblTimasZeiten.Text, requestDone) If timas.getTimeEntries(MA.mit_timasId, dtZeiten, requestDone) Then
PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green
Else
PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_red
End If
If dtZeiten.Rows.Count > 0 Then
pnlZeiten.Visible = True
Else
pnlZeiten.Visible = False
End If
End If End If
End If End If
@@ -233,171 +244,12 @@ Public Class frmMitarbeitersuche
initMA() initMA()
End Sub End Sub
Private Sub getTime(maid)
Try
Dim returnText As String = ""
lblTimasZeiten.Text = ""
If maid Is Nothing Then
Exit Sub
End If
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
Dim rest As New Chilkat.Rest
Dim API_STRING As String
API_STRING = "https://zeit.verag.ag"
Dim success As Boolean
rest.VerboseLogging = True
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
If (success <> True) Then
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
'lblTimas.Text = rest.LastErrorText
End If
success = rest.SetAuthBasic("admin", "BmWr501956")
If (success <> True) Then
Debug.WriteLine("BAFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
'lblTimas.Text = rest.LastErrorText
End If
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance")
If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
If (rest.ResponseStatusCode <> 200) Then
Debug.WriteLine(rest.ResponseHeader)
'lblTimas.Text = rest.ResponseStatusCode & " " & rest.ResponseStatusText
Exit Sub
End If
Debug.WriteLine(responseJson)
Dim json As New Chilkat.JsonObject
success = json.Load(responseJson)
If (success <> True) Then
Debug.WriteLine(json.LastErrorText)
End If
Debug.WriteLine(json)
'"overallBalance" 101580,
'"dailyBalance": -17340,
'"monthlyBalance": -328380,
'"actualTimeOfDay": 4260,
Dim saldo = json.StringOf("dailyBalanceYesterday") 'Tagessaldo (gestern) in Sekunden
If saldo IsNot Nothing Then
Dim saldoAsDouble = CDbl(saldo)
saldoAsDouble = Math.Round(saldoAsDouble / 3600, 2)
returnText = "Saldo Vortag: " & saldoAsDouble & "h"
End If
lblTimasSaldo.Text = returnText
Dim yesterdayMidnight As DateTime
yesterdayMidnight = Today().AddDays(-5)
rest.AddQueryParam("id", maid)
rest.AddQueryParam("from", yesterdayMidnight.ToString("yyyy-MM-ddThh:mm:ss"))
rest.AddQueryParam("to", Now().ToString("yyyy-MM-ddThh:mm:ss"))
Dim Response As String
Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings")
If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
If (rest.ResponseStatusCode <> 200) Then
Debug.WriteLine(rest.ResponseHeader)
'rest.ResponseStatusCode & " " & rest.ResponseStatusText
Exit Sub
End If
Debug.WriteLine(Response)
Dim jsonArray As New Chilkat.JsonArray
success = jsonArray.Load(Response)
If (success <> True) Then
Debug.WriteLine(jsonArray.LastErrorText)
Exit Sub
End If
If jsonArray.Size = -1 Then
Exit Sub
End If
'Dim dt As New DataTable
'dt.Columns.Add("statusid", GetType(Integer))
'dt.Columns.Add("stamp", GetType(DateTime))
'dt.Columns.Add("type", GetType(String))
Dim j As Integer = 0
While j < jsonArray.Size
Dim timeEntry As Chilkat.JsonObject = jsonArray.ObjectAt(j)
If IsDate(timeEntry.StringOf("stamp")) Then
If CDate(timeEntry.StringOf("stamp")) >= Today() Then
'Dim R As DataRow = dt.NewRow
'R("statusid") = timeEntry.StringOf("statusid")
'R("stamp") = timeEntry.StringOf("stamp")
'R("type") = timeEntry.StringOf("type")
'dt.Rows.Add(R)
lblTimasZeiten.Text &= " " & IIf(timeEntry.StringOf("type") = "in", "+", " - ") & CDate(timeEntry.StringOf("stamp")).ToString("hh:mm:ss")
If jsonArray.Size - 1 = j Then
lblTimasZeiten.Text &= " Status: " & IIf(timeEntry.StringOf("type") = "in", "Anwesend", "Abwesend")
End If
End If
End If
j = j + 1
End While
requestDone = True
rest.ClearAllQueryParams()
Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
Private Sub PictureBox9_Click(sender As Object, e As EventArgs) Handles PictureBox9.Click Private Sub PictureBox9_Click(sender As Object, e As EventArgs) Handles PictureBox9.Click
Dim webAddress As String = "https://zeit.verag.ag/webterminal/" Dim webAddress As String = "https://zeit.verag.ag/webterminal/"
Process.Start(webAddress) Process.Start(webAddress)
End Sub End Sub
Sub setBGPic(art, MA) Sub setBGPic(art, MA)
HOVER_ART = art HOVER_ART = art
If art = "" Or MA Is Nothing Then If art = "" Or MA Is Nothing Then
@@ -456,5 +308,4 @@ Public Class frmMitarbeitersuche
End If End If
End Sub End Sub
End Class End Class

View File

@@ -112,19 +112,19 @@ Public Class cTimasAPI
End Sub End Sub
Public Sub getTimeEntries(ByVal maid As Integer, ByRef info As String, Optional ByRef entryExistingToday As Boolean = True, Optional ByRef requestDone As Boolean = False) Public Function getTimeEntries(ByVal maid As Integer, ByRef dtZeiten As DataTable, Optional ByRef entryExistingToday As Boolean = True, Optional ByRef requestDone As Boolean = False) As Boolean
Try Try
Dim returnText As String = "" Dim isPresent = False
Dim failureText As String = "" Dim failureText As String = ""
If maid < 1 Then If maid < 1 Then
Exit Sub Return isPresent
End If End If
If Not checkConnectionTImas(failureText) Then If Not checkConnectionTImas(failureText) Then
Exit Sub Return isPresent
End If End If
Dim success As Boolean Dim success As Boolean
@@ -139,13 +139,13 @@ Public Class cTimasAPI
Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings") Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings")
If (rest.LastMethodSuccess <> True) Then If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText) Debug.WriteLine(rest.LastErrorText)
Exit Sub Return isPresent
End If End If
If (rest.ResponseStatusCode <> 200) Then If (rest.ResponseStatusCode <> 200) Then
Debug.WriteLine(rest.ResponseHeader) Debug.WriteLine(rest.ResponseHeader)
'rest.ResponseStatusCode & " " & rest.ResponseStatusText 'rest.ResponseStatusCode & " " & rest.ResponseStatusText
Exit Sub Return isPresent
End If End If
Debug.WriteLine(Response) Debug.WriteLine(Response)
@@ -153,16 +153,16 @@ Public Class cTimasAPI
success = jsonArray.Load(Response) success = jsonArray.Load(Response)
If (success <> True) Then If (success <> True) Then
Debug.WriteLine(jsonArray.LastErrorText) Debug.WriteLine(jsonArray.LastErrorText)
Exit Sub Return isPresent
End If End If
If jsonArray.Size = -1 Then If jsonArray.Size = -1 Then
Exit Sub Return isPresent
End If End If
Dim dt As New DataTable Dim dt As New DataTable
dt.Columns.Add("statusid", GetType(Integer)) 'dt.Columns.Add("statusid", GetType(Integer))
dt.Columns.Add("stamp", GetType(DateTime)) dt.Columns.Add("stamp", GetType(DateTime))
dt.Columns.Add("type", GetType(String)) dt.Columns.Add("type", GetType(String))
@@ -178,14 +178,16 @@ Public Class cTimasAPI
Dim R As DataRow = dt.NewRow Dim R As DataRow = dt.NewRow
R("statusid") = timeEntry.StringOf("statusid") 'R("statusid") = timeEntry.StringOf("statusid")
R("stamp") = timeEntry.StringOf("stamp") R("stamp") = timeEntry.StringOf("stamp")
R("type") = timeEntry.StringOf("type") R("type") = timeEntry.StringOf("type")
dt.Rows.Add(R) dt.Rows.Add(R)
entryExistingToday = True entryExistingToday = True
info &= " " & IIf(timeEntry.StringOf("type") = "in", "+", " - ") & CDate(timeEntry.StringOf("stamp")).ToString("HH:mm:ss") 'info &= " " & IIf(timeEntry.StringOf("type") = "in", "+", " - ") & CDate(timeEntry.StringOf("stamp")).ToString("HH:mm:ss")
If jsonArray.Size - 1 = j Then If jsonArray.Size - 1 = j Then
info &= " Status: " & IIf(timeEntry.StringOf("type") = "in", "Anwesend", "Abwesend") If timeEntry.StringOf("type") = "in" Then
isPresent = True
End If
End If End If
End If End If
@@ -193,16 +195,16 @@ Public Class cTimasAPI
j = j + 1 j = j + 1
End While End While
If dtZeiten IsNot Nothing Then dtZeiten = dt
requestDone = True requestDone = True
rest.ClearAllQueryParams() rest.ClearAllQueryParams()
Return isPresent
Catch ex As WebException Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try End Try
End Sub End Function
Public Function createEmployee(ByVal mitarbeiter As cMitarbeiter, ByRef info As String, ByRef datatableTimas As DataTable, Optional ByRef requestDone As Boolean = False) Public Function createEmployee(ByVal mitarbeiter As cMitarbeiter, ByRef info As String, ByRef datatableTimas As DataTable, Optional ByRef requestDone As Boolean = False)
Try Try