Imports System.Net Imports System.Web.Http Imports Microsoft.Web.Http Namespace api_CustomsDeclaration.Controllers Public Class CustomsDeclaration2Controller Inherits System.Web.Http.ApiController Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza Dim EZA As New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza EZA.POSITIONS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position) EZA.POSITIONS(0).DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position_document) 'EZA.DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_document) EZA.ADDRESS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_Adressen) Return EZA End Function '' GET api/CustomsDeclaration_V001/ 'Public Function GetValues() As IEnumerable(Of String) ' Return New String() {"value1", "value2"} 'End Function '' GET api/CustomsDeclaration_V001//5 'Public Function GetValue(ByVal id As Integer) As String ' Return "value" 'End Function ' POST api/CustomsDeclaration_V001/ 'Public Function PostValue( ByVal value As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza) As Boolean ' Dim EZA As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza = value 'End Function 'Public Function PostValue(ByVal value As String) As String ' 'Dim file As System.IO.StreamWriter ' 'file = My.Computer.FileSystem.OpenTextFileWriter("G:\test.txt", True) ' 'file.WriteLine(value) ' 'file.Close() ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False ' Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL ' SQL.doSQL("insert into tbltest (test) Values('000')", "FMZOLL") ' Return "asd" & value 'End Function Public Function PostValue(ByVal EZA_FREMD As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza) As String ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cREST_Options.isTESTSSTEM(Request) VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL = VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim ip = Request.Properties("MS_HttpContext").Request.UserHostAddress() SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_START_001_ " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "','" & ip & "')", "FMZOLL") Try Dim resultJson2 = jsonString.FromClass(EZA_FREMD) SQL.doSQL("insert into tbltest (test) Values('EZA_" & resultJson2 & "')", "FMZOLL") Catch ex As Exception End Try PostValue = "EZA_ERR" Try If EZA_FREMD Is Nothing Then Return EZA_Exceptions.ERR_01_Wrong_Format ' If EZA_FREMD.TransportBorderLicensePlate = "" Then Return EZA_Exceptions.ERR_07_Missing_PlateNr ' If EZA_FREMD.Reference = "" Then Return EZA_Exceptions.ERR_08_Missing_Reference Dim Reference = If(EZA_FREMD.Reference, "") Dim EZA_TR = VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL.LOADByReference("ATEZ", Reference, True) If EZA_TR Is Nothing Then EZA_TR = New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL(EZA_FREMD) Else EZA_TR.setEZA(EZA_FREMD) End If EZA_TR.shTr_Partnersystem = "ATEZ" EZA_TR.shTr_Status = 5 'EZA_TR.shTr_Status_KEWILL_Equivalent = 5 EZA_TR.EZA.Company = "VERAG" EZA_TR.EZA.Department = "SUB" 'EZA_TR.Reference = "" If EZA_TR.SAVE_ALL Then 'PostValue = "EZA_OK " & Now.ToShortDateString & "-" & Now.ToShortTimeString 'Dim resultJson = jsonString.FromClass(EZA_FREMD) 'SQL.doSQL("insert into tbltest (test) Values('EZA_" & resultJson & "')", "FMZOLL") 'SQL.doSQL("insert into tbltest (test) Values('ATEZ_EZA_TEST: " & EZA_FREMD.TransportBorderLicensePlate & " - " & EZA_FREMD.Reference & "')", "FMZOLL") SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_OK - ID: " & EZA_TR.shTr_id & "','" & ip & "')", "FMZOLL") Return "OK" Else PostValue = EZA_Exceptions.ERR_04_InternalSave End If ' Return "TEST3" 'SQL.doSQL("insert into tbltest (test) Values('" & "OK " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "')", "FMZOLL") 'MsgBox(resultJson) 'Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("INTERFACE", "ATEZ", "IN", "EZA_FREMD") 'DS.uploadDataToDATENSERVER_fromBytes() 'Dim client = New RestClient(_baseURI) 'Dim request = New RestRequest("/datasources/{identifier}/data", Method.GET) 'request.AddUrlSegment("identifier", _identifier) 'request.AddHeader("Authorization", "Basic " + _token) 'Dim jstr = client.Execute(request).Content 'Dim allDATA As List(Of GeneralInfo) = JsonConvert.DeserializeObject(Of List(Of GeneralInfo))(jstr) Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & EZA_Exceptions.ERR_03_InternalVerarb, System.Reflection.MethodInfo.GetCurrentMethod.Name) SQL.doSQL("insert into tbltest (test) Values('" & EZA_Exceptions.ERR_03_InternalVerarb & ex.Message & "')", "FMZOLL") Return EZA_Exceptions.ERR_03_InternalVerarb End Try ' SQL.doSQL("insert into tbltest (test) Values('" & PostValue & "')", "FMZOLL") Return PostValue 'VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False 'Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL 'SQL.doSQL("insert into tbltest (test) Values('C_START " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "')", "FMZOLL") 'PostValue = "ERR" 'Try ' If EZA Is Nothing Then ' PostValue = "ERR " & Now.ToShortDateString & "-" & Now.ToShortTimeString ' Else ' PostValue = "OK " & Now.ToShortDateString & "-" & Now.ToShortTimeString ' 'SQL.doSQL("insert into tbltest (test) Values('" & "OK " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "')", "FMZOLL") ' Dim resultJson = jsonString.FromClass(EZA) ' 'PostValue = resultJson ' SQL.doSQL("insert into tbltest (test) Values('" & resultJson & "')", "FMZOLL") ' 'MsgBox(resultJson) ' 'Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("INTERFACE", "ATEZ", "IN", "EZA") ' 'DS.uploadDataToDATENSERVER_fromBytes() ' 'Dim client = New RestClient(_baseURI) ' 'Dim request = New RestRequest("/datasources/{identifier}/data", Method.GET) ' 'request.AddUrlSegment("identifier", _identifier) ' 'request.AddHeader("Authorization", "Basic " + _token) ' 'Dim jstr = client.Execute(request).Content ' 'Dim allDATA As List(Of GeneralInfo) = JsonConvert.DeserializeObject(Of List(Of GeneralInfo))(jstr) ' End If 'Catch ex As Exception ' ' SQL.doSQL("insert into tbltest (test) Values('" & "ERRNOTHING " & ex.Message & "')", "FMZOLL") 'End Try '' SQL.doSQL("insert into tbltest (test) Values('" & PostValue & "')", "FMZOLL") 'Return PostValue End Function '' POST api/CustomsDeclaration_V001/ 'Public Sub PostValue( ByVal value As String) 'End Sub '' PUT api/CustomsDeclaration_V001//5 'Public Sub PutValue(ByVal id As Integer, ByVal value As String) 'End Sub '' DELETE api/CustomsDeclaration_V001//5 'Public Sub DeleteValue(ByVal id As Integer) 'End Sub End Class ' ' 'Public Class CustomsDeclarationV101Controller ' Inherits System.Web.Http.ApiController ' Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza ' Dim EZA As New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza ' EZA.POSITIONS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position) ' EZA.POSITIONS(0).DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position_document) ' 'EZA.DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_document) ' EZA.ADDRESS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_Adressen) ' Return EZA ' End Function ' Public Function PostValue(ByVal EZA_FREMD As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza) As String ' ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cREST_Options.isTESTSSTEM(Request) ' VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL = VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL ' Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL ' Dim ip = Request.Properties("MS_HttpContext").Request.UserHostAddress() ' SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_START_101 " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "','" & ip & "')", "FMZOLL") ' Try ' Dim resultJson2 = jsonString.FromClass(EZA_FREMD) ' SQL.doSQL("insert into tbltest (test) Values('EZA_" & resultJson2 & "')", "FMZOLL") ' Catch ex As Exception ' SQL.doSQL("insert into tbltest (test) Values('ERR:EZA_101_" & ex.Message & "')", "FMZOLL") ' End Try ' SQL.doSQL("insert into tbltest (test) Values('EZA_101_')", "FMZOLL") ' PostValue = "EZA_ERR" ' Try ' If EZA_FREMD Is Nothing Then Return EZA_Exceptions.ERR_01_Wrong_Format ' ' If EZA_FREMD.TransportBorderLicensePlate = "" Then Return EZA_Exceptions.ERR_07_Missing_PlateNr ' ' If EZA_FREMD.Reference = "" Then Return EZA_Exceptions.ERR_08_Missing_Reference ' Dim Reference = If(EZA_FREMD.Reference, "") ' Dim EZA_TR = VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL.LOADByReference("ATEZ", Reference, True) ' If EZA_TR Is Nothing Then ' EZA_TR = New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL(EZA_FREMD) ' Else ' EZA_TR.setEZA(EZA_FREMD) ' End If ' EZA_TR.shTr_Partnersystem = "ATEZ" ' EZA_TR.shTr_Status = 5 ' 'EZA_TR.shTr_Status_KEWILL_Equivalent = 5 ' EZA_TR.EZA.Company = "VERAG" ' EZA_TR.EZA.Department = "SUB" ' 'EZA_TR.Reference = "" ' If EZA_TR.SAVE_ALL Then ' 'PostValue = "EZA_OK " & Now.ToShortDateString & "-" & Now.ToShortTimeString ' 'Dim resultJson = jsonString.FromClass(EZA_FREMD) ' 'SQL.doSQL("insert into tbltest (test) Values('EZA_" & resultJson & "')", "FMZOLL") ' 'SQL.doSQL("insert into tbltest (test) Values('ATEZ_EZA_TEST: " & EZA_FREMD.TransportBorderLicensePlate & " - " & EZA_FREMD.Reference & "')", "FMZOLL") ' SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_OK - ID: " & EZA_TR.shTr_id & "','" & ip & "')", "FMZOLL") ' Return "OK" ' Else ' PostValue = EZA_Exceptions.ERR_04_InternalSave ' End If ' Catch ex As Exception ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & EZA_Exceptions.ERR_03_InternalVerarb, System.Reflection.MethodInfo.GetCurrentMethod.Name) ' SQL.doSQL("insert into tbltest (test) Values('" & EZA_Exceptions.ERR_03_InternalVerarb & ex.Message & "')", "FMZOLL") ' Return EZA_Exceptions.ERR_03_InternalVerarb ' End Try ' ' SQL.doSQL("insert into tbltest (test) Values('" & PostValue & "')", "FMZOLL") ' Return PostValue ' End Function 'End Class '-------------------------------------------------------------------- '----------------------------------TEST---------------------------------- '------------------------------------------------------------------------ ' ' 'Public Class CustomsDeclarationV001_TESTController ' Inherits System.Web.Http.ApiController ' Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza ' Dim EZA As New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza ' EZA.POSITIONS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position) ' EZA.POSITIONS(0).DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_position_document) ' 'EZA.DOCUMENTS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_document) ' EZA.ADDRESS.Add(New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_Adressen) ' Return EZA ' End Function ' Public Function PostValue(ByVal EZA_FREMD As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza) As String ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True ' VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = Debugger.IsAttached ' VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL = VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL ' Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL ' Dim ip = Request.Properties("MS_HttpContext").Request.UserHostAddress() ' SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_START " & Now.ToShortDateString & "-" & Now.ToShortTimeString & "','" & ip & "')", "FMZOLL") ' Try ' Dim resultJson2 = jsonString.FromClass(EZA_FREMD) ' SQL.doSQL("insert into tbltest (test) Values('EZA_" & resultJson2 & "')", "FMZOLL") ' Catch ex As Exception ' End Try ' PostValue = "EZA_ERR" ' Try ' If EZA_FREMD Is Nothing Then Return EZA_Exceptions.ERR_01_Wrong_Format ' Dim Reference = If(EZA_FREMD.Reference, "") ' Dim EZA_TR = VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL.LOADByReference("ATEZ", Reference, True) ' If EZA_TR Is Nothing Then ' EZA_TR = New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL(EZA_FREMD) ' Else ' EZA_TR.setEZA(EZA_FREMD) ' End If ' EZA_TR.shTr_Partnersystem = "ATEZ" ' EZA_TR.shTr_Status = 5 ' 'EZA_TR.shTr_Status_KEWILL_Equivalent = 5 ' EZA_TR.EZA.Company = "VERAG" ' EZA_TR.EZA.Department = "SUB" ' If EZA_TR.SAVE_ALL Then ' SQL.doSQL("insert into tbltest (test,ipaddress) Values('ATEZ_EZA_OK - ID: " & EZA_TR.shTr_id & "','" & ip & "')", "FMZOLL") ' Return "OK" ' Else ' PostValue = EZA_Exceptions.ERR_04_InternalSave ' End If ' Catch ex As Exception ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & EZA_Exceptions.ERR_03_InternalVerarb, System.Reflection.MethodInfo.GetCurrentMethod.Name) ' SQL.doSQL("insert into tbltest (test) Values('" & EZA_Exceptions.ERR_03_InternalVerarb & ex.Message & "')", "FMZOLL") ' Return EZA_Exceptions.ERR_03_InternalVerarb ' End Try ' Return PostValue ' End Function 'End Class End Namespace