ModaltransAPI
This commit is contained in:
@@ -527,14 +527,6 @@ Public Class cATEZ_NCTS_IN
|
||||
Dim sbResponseBody As New Chilkat.StringBuilder
|
||||
success = rest.FullRequestSb("POST", "/api/integrations/verag", sbRequestBody, sbResponseBody)
|
||||
|
||||
'Dim bdRequest As New Chilkat.BinData
|
||||
'success = rest.GetLastDebugRequest(bdRequest)
|
||||
'Debug.WriteLine("----")
|
||||
'Debug.WriteLine(bdRequest.GetString("utf-8"))
|
||||
'Debug.WriteLine("----")
|
||||
|
||||
|
||||
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
failureDesc = rest.LastErrorText
|
||||
@@ -556,9 +548,6 @@ Public Class cATEZ_NCTS_IN
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Catch ex As WebException
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
@@ -606,7 +595,6 @@ Public Class cATEZ_NCTS_IN
|
||||
Next
|
||||
|
||||
|
||||
|
||||
For Each r As DataGridViewRow In dgv.Rows
|
||||
Dim isSelected = IIf(DBNull.Value Is r.Cells("anh_selekt").Value, False, r.Cells("anh_selekt").Value)
|
||||
If isSelected Then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,6 @@ Public Class cTimasAPI
|
||||
Dim rest As New Chilkat.Rest
|
||||
|
||||
|
||||
|
||||
Sub New()
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
End Sub
|
||||
@@ -201,7 +200,7 @@ Public Class cTimasAPI
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function createMA(ByVal mitarbeiter As cMitarbeiter, ByRef info As String, ByRef dgvData As MyDatagridview, Optional ByRef requestDone As Boolean = False)
|
||||
Public Function createMA(ByVal mitarbeiter As cMitarbeiter, ByRef info As String, ByRef datatableTimas As DataTable, Optional ByRef requestDone As Boolean = False)
|
||||
Try
|
||||
|
||||
rest.ClearAllHeaders()
|
||||
@@ -229,31 +228,34 @@ Public Class cTimasAPI
|
||||
success = json.UpdateString("lastname", mitarbeiter.mit_nname)
|
||||
success = json.UpdateString("gender", IIf(mitarbeiter.mit_geschlecht = "m", "male", "female"))
|
||||
'success = json.UpdateInt("card", 42)
|
||||
'success = json.UpdateString("info", "Gebäude 2, 1. OG, Büro 54")
|
||||
success = json.UpdateString("info", mitarbeiter.mit_firma & " - " & mitarbeiter.mit_abteilung)
|
||||
'success = json.UpdateString("clientNumber", "5600-02")
|
||||
'success = json.UpdateInt("rfid", 178230359)
|
||||
success = json.UpdateString("birthday", CDate(mitarbeiter.mit_gebdat).ToString("yyyy-MM-dd"))
|
||||
If mitarbeiter.mit_gebdat <> "" And IsDate(mitarbeiter.mit_gebdat) Then
|
||||
success = json.UpdateString("birthday", CDate(mitarbeiter.mit_gebdat).ToString("yyyy-MM-dd"))
|
||||
End If
|
||||
|
||||
success = json.UpdateString("entry", CDate(mitarbeiter.mit_einstiegsdatum).ToString("yyyy-MM-dd"))
|
||||
success = json.UpdateNull("exit")
|
||||
success = json.UpdateString("importSign", "AX-034511")
|
||||
success = json.UpdateString("importSign", "Iimport from Aviso")
|
||||
success = json.UpdateString("login", mitarbeiter.mit_AliasAD_Username)
|
||||
success = json.UpdateBool("loginActive", 0)
|
||||
success = json.UpdateBool("loginActive", 1)
|
||||
success = json.UpdateString("email", mitarbeiter.mit_email)
|
||||
success = json.UpdateString("street", mitarbeiter.mit_strasse)
|
||||
success = json.UpdateString("city", mitarbeiter.mit_ort)
|
||||
success = json.UpdateString("zipcode", mitarbeiter.mit_plz)
|
||||
success = json.UpdateString("phone1", mitarbeiter.mit_telefonnr & " " & mitarbeiter.mit_durchwahl)
|
||||
success = json.UpdateString("phone2", mitarbeiter.mit_mobiltel)
|
||||
success = json.UpdateString("password", "password")
|
||||
success = json.UpdateBool("resetPassword", 1)
|
||||
success = json.UpdateString("password", mitarbeiter.mit_pwd)
|
||||
success = json.UpdateBool("resetPassword", 0)
|
||||
|
||||
For Each r In dgvData.Rows
|
||||
Dim i As Integer = 0
|
||||
If r.Cells("set").Value = True Then
|
||||
success = json.UpdateInt("groups[" & i & "]", r.Cells("id").Value)
|
||||
Dim i As Integer = 0
|
||||
For Each r As DataRow In datatableTimas.Rows
|
||||
If r("set") = True Then
|
||||
success = json.UpdateInt("groups[" & i & "]", r("id"))
|
||||
i = i + 1
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
Debug.WriteLine(json.Emit())
|
||||
@@ -283,7 +285,7 @@ Public Class cTimasAPI
|
||||
End If
|
||||
Return timasEmployeeCreated
|
||||
Else
|
||||
info = "Mitarbeiter angelegt!"
|
||||
info = "Mitarbeiter angelegt!" & vbNewLine
|
||||
|
||||
Dim jsonResult As New Chilkat.JsonObject
|
||||
success = jsonResult.LoadSb(sbResponseBody)
|
||||
@@ -355,7 +357,7 @@ Public Class cTimasAPI
|
||||
info &= IIf(json.StringOf("info") <> "", "Info: " & json.StringOf("info") & vbNewLine, "")
|
||||
info &= IIf(json.StringOf("id") <> "", "Timas-ID: " & json.StringOf("id") & vbNewLine, "")
|
||||
If json.BoolOf("loginActive") Then
|
||||
info &= IIf(json.StringOf("login") <> "", "Login: " & vbNewLine & json.StringOf("login") & vbNewLine, "")
|
||||
info &= IIf(json.StringOf("login") <> "", "Login: " & json.StringOf("login") & vbNewLine, "")
|
||||
info &= IIf(json.StringOf("password") <> "", "PW: " & json.StringOf("password"), "")
|
||||
End If
|
||||
|
||||
@@ -376,11 +378,6 @@ Public Class cTimasAPI
|
||||
End If
|
||||
|
||||
|
||||
dt.Columns.Add("id", GetType(Integer))
|
||||
dt.Columns.Add("name", GetType(String))
|
||||
dt.Columns.Add("info", GetType(String))
|
||||
dt.Columns.Add("set", GetType(Boolean))
|
||||
|
||||
Dim responseBody As String = rest.FullRequestNoBody("GET", API_STRING & "/rest/web-api/groups3")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
@@ -407,22 +404,37 @@ Public Class cTimasAPI
|
||||
|
||||
|
||||
Dim j As Integer = 0
|
||||
While j < num
|
||||
|
||||
Dim groups As Chilkat.JsonObject = jsonArray.ObjectAt(j)
|
||||
If dt IsNot Nothing And Not dt.Columns.Contains("id") Then
|
||||
|
||||
Dim R As DataRow = dt.NewRow
|
||||
R("id") = groups.IntOf("id")
|
||||
R("name") = groups.StringOf("name")
|
||||
R("info") = groups.StringOf("info")
|
||||
If R("id") = "19" Or R("id") = "129" Then 'Typ Mitarbeiter und Standardgruppe für Mitarbeiter Default true
|
||||
R("set") = True
|
||||
Else
|
||||
R("set") = False
|
||||
End If
|
||||
dt.Rows.Add(R)
|
||||
j = j + 1
|
||||
End While
|
||||
dt.Columns.Add("id", GetType(Integer))
|
||||
dt.Columns.Add("name", GetType(String))
|
||||
dt.Columns.Add("groupType", GetType(String))
|
||||
dt.Columns.Add("info", GetType(String))
|
||||
dt.Columns.Add("set", GetType(Boolean))
|
||||
|
||||
While j < num
|
||||
|
||||
Dim groups As Chilkat.JsonObject = jsonArray.ObjectAt(j)
|
||||
|
||||
Dim R As DataRow = dt.NewRow
|
||||
R("id") = groups.IntOf("id")
|
||||
R("name") = groups.StringOf("name")
|
||||
R("groupType") = groups.StringOf("groupType")
|
||||
R("info") = groups.StringOf("info")
|
||||
If R("id") = "19" Or R("id") = "129" Then 'Typ Mitarbeiter und Standardgruppe für Mitarbeiter Default true
|
||||
R("set") = True
|
||||
Else
|
||||
R("set") = False
|
||||
End If
|
||||
dt.Rows.Add(R)
|
||||
j = j + 1
|
||||
End While
|
||||
|
||||
dt.DefaultView.Sort = " groupType asc, name asc"
|
||||
dt = dt.DefaultView.ToTable()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As WebException
|
||||
@@ -492,7 +504,7 @@ Public Class cTimasAPI
|
||||
Return timeEntryCreated
|
||||
Else
|
||||
|
||||
info = "Zeiteintrag " & entryType & " angelegt!"
|
||||
info = "Zeiteintrag " & entryType & " angelegt!" & timeEntry.ToString("HH:mm:ss")
|
||||
|
||||
'Dim jsonResult As New Chilkat.JsonObject
|
||||
'success = jsonResult.LoadSb(sbResponseBody)
|
||||
@@ -506,5 +518,79 @@ Public Class cTimasAPI
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getEmployeeList(ByRef dt As DataTable) As String
|
||||
|
||||
Dim failureText As String = ""
|
||||
|
||||
Try
|
||||
|
||||
If Not checkConnectionTImas(failureText) Then
|
||||
Return failureText
|
||||
|
||||
End If
|
||||
|
||||
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
Return rest.LastErrorText
|
||||
End If
|
||||
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
Debug.WriteLine(rest.ResponseHeader)
|
||||
failureText = rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
Return rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
End If
|
||||
|
||||
Debug.WriteLine(responseJson)
|
||||
|
||||
Dim jsonArray As New Chilkat.JsonArray
|
||||
Dim success As Boolean = jsonArray.Load(responseJson)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine(jsonArray.LastErrorText)
|
||||
Return jsonArray.LastErrorText
|
||||
End If
|
||||
|
||||
|
||||
Dim num As Integer = jsonArray.Size
|
||||
If num = -1 Then
|
||||
Return "Array Failure"
|
||||
End If
|
||||
|
||||
If dt IsNot Nothing And Not dt.Columns.Contains("id") Then
|
||||
dt.Columns.Add("id", GetType(Integer))
|
||||
dt.Columns.Add("externid", GetType(String))
|
||||
dt.Columns.Add("pnr1", GetType(String))
|
||||
dt.Columns.Add("firstname", GetType(String))
|
||||
dt.Columns.Add("lastname", GetType(String))
|
||||
dt.Columns.Add("gender", GetType(String))
|
||||
dt.Columns.Add("card", GetType(Integer))
|
||||
dt.Columns.Add("info", GetType(String))
|
||||
|
||||
|
||||
|
||||
Dim j As Integer = 0
|
||||
While j < num
|
||||
|
||||
Dim employee As Chilkat.JsonObject = jsonArray.ObjectAt(j)
|
||||
|
||||
Dim R As DataRow = dt.NewRow
|
||||
R("id") = employee.IntOf("id")
|
||||
R("externid") = employee.StringOf("externid")
|
||||
R("pnr1") = employee.StringOf("pnr1")
|
||||
R("firstname") = employee.StringOf("firstname")
|
||||
R("lastname") = employee.StringOf("lastname")
|
||||
R("gender") = employee.StringOf("gender")
|
||||
R("card") = employee.IntOf("card")
|
||||
R("info") = employee.StringOf("info")
|
||||
dt.Rows.Add(R)
|
||||
j = j + 1
|
||||
End While
|
||||
End If
|
||||
|
||||
Catch ex As WebException
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user