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

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