TimasAPI, Uberstunden, Mailvorlagen, etc,
This commit is contained in:
@@ -165,7 +165,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
Else
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
failureDesc = rest.ResponseStatusText
|
||||
failureDesc = rest.ResponseStatusText & IIf(responseJson <> "", vbNewLine & responseJson, "")
|
||||
Return failureDesc
|
||||
Else
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ Public Class cTimasAPI
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getTimeSaldo(maid As Integer, ByRef info As String, kindofbalance As String, ByRef Optional isEndpointRunning As Boolean = True) As Double
|
||||
Public Function getTimeSaldo(maid As Integer, ByRef info As String, kindofbalance As String, ByRef Optional isEndpointRunning As Boolean = True, Optional datetimeformat As String = "seconds") As Double
|
||||
Try
|
||||
Dim returnText As String = ""
|
||||
Dim failureText As String = ""
|
||||
@@ -80,8 +80,10 @@ Public Class cTimasAPI
|
||||
|
||||
|
||||
Dim success As Boolean
|
||||
rest.ClearAllQueryParams()
|
||||
|
||||
rest.IdleTimeoutMs = 5000
|
||||
rest.AddQueryParam("format", datetimeformat)
|
||||
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
@@ -92,7 +94,6 @@ Public Class cTimasAPI
|
||||
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
Debug.WriteLine(rest.ResponseHeader)
|
||||
'lblTimas.Text = rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
Return timesaldo
|
||||
End If
|
||||
|
||||
@@ -107,11 +108,6 @@ Public Class cTimasAPI
|
||||
|
||||
Debug.WriteLine(json)
|
||||
|
||||
'"overallBalance" 101580,
|
||||
'"dailyBalance": -17340,
|
||||
'"monthlyBalance": -328380,
|
||||
'"actualTimeOfDay": 4260,
|
||||
|
||||
If kindofbalance = "" Then
|
||||
info = "kindOfBalance nicht definiert! "
|
||||
Return timesaldo
|
||||
@@ -119,13 +115,29 @@ Public Class cTimasAPI
|
||||
Dim saldo = json.StringOf(kindofbalance) 'Tagessaldo (gestern) in Sekunden
|
||||
If saldo IsNot Nothing Then
|
||||
Dim saldoAsDouble = CDbl(saldo)
|
||||
saldoAsDouble = Math.Round(saldoAsDouble / 3600, 2)
|
||||
Dim infoBuilder As New StringBuilder
|
||||
'infoBuilder.Append("Vortag ")
|
||||
infoBuilder.Append(saldoAsDouble)
|
||||
infoBuilder.Append(" h")
|
||||
info = infoBuilder.ToString()
|
||||
timesaldo = saldoAsDouble
|
||||
Select Case datetimeformat
|
||||
Case "seconds"
|
||||
saldoAsDouble = Math.Round(saldoAsDouble / 3600, 2)
|
||||
infoBuilder.Append(saldoAsDouble)
|
||||
infoBuilder.Append(" h")
|
||||
info = infoBuilder.ToString()
|
||||
timesaldo = saldoAsDouble
|
||||
Case "minutes"
|
||||
saldoAsDouble = Math.Round(saldoAsDouble / 3600, 2)
|
||||
infoBuilder.Append(saldoAsDouble)
|
||||
infoBuilder.Append(" min")
|
||||
info = infoBuilder.ToString()
|
||||
timesaldo = saldoAsDouble
|
||||
|
||||
Case "time"
|
||||
infoBuilder.Append(saldoAsDouble)
|
||||
infoBuilder.Append(" Zeit")
|
||||
info = infoBuilder.ToString()
|
||||
timesaldo = saldoAsDouble
|
||||
|
||||
End Select
|
||||
|
||||
Return timesaldo
|
||||
End If
|
||||
Return timesaldo
|
||||
@@ -1005,8 +1017,8 @@ Public Class cTimasAPI
|
||||
R("Ausweis-Nr") = employee.IntOf("card")
|
||||
R("Info") = employee.StringOf("info")
|
||||
dt.Rows.Add(R)
|
||||
j = j + 1
|
||||
End While
|
||||
j = j + 1
|
||||
End While
|
||||
|
||||
|
||||
Catch ex As WebException
|
||||
@@ -1194,9 +1206,9 @@ Public Class cTimasAPI
|
||||
jsonArr.AddObjectAt(-1)
|
||||
Dim Json As Chilkat.JsonObject = jsonArr.ObjectAt(jsonArr.Size - 1)
|
||||
Json.UpdateInt("accountid", ae.Item("accountid"))
|
||||
json.UpdateInt("employeeid", mitarbeiter.mit_timasId)
|
||||
json.UpdateString("date", accountdate.ToString("yyyy-MM-dd"))
|
||||
json.UpdateString("value", ae.Item("value"))
|
||||
Json.UpdateInt("employeeid", mitarbeiter.mit_timasId)
|
||||
Json.UpdateString("date", accountdate.ToString("yyyy-MM-dd"))
|
||||
Json.UpdateString("value", ae.Item("value"))
|
||||
|
||||
Next
|
||||
|
||||
|
||||
Reference in New Issue
Block a user