Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' Wenn der Aufruf dieses Webdiensts aus einem Skript zulässig sein soll, heben Sie mithilfe von ASP.NET AJAX die Kommentarmarkierung für die folgende Zeile auf.
<System.Web.Script.Services.ScriptService()>
<WebService(Namespace:="http://veragserviceswebhub/")>
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
    Inherits System.Web.Services.WebService

    <WebMethod()>
    Public Function ShowLKWs(ByVal sLookUP As String) As List(Of String)
        Dim lstCountries As New List(Of String)()
        Dim Connectionstring As String = String.Empty

        If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
            'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
            Connectionstring = "Server=DEVELOPER\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
        Else
            Connectionstring = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
            'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
        End If

        Dim myConn As New SqlConnection(Connectionstring)
        Dim objComm As New SqlCommand("SELECT 'LKW Kennzeichen' FROM [VERAG].[dbo].[Rechnungsausgang] " &
            "WHERE 'LKW Kennzeichen' LIKE '%'+@LookUP+'%' ORDER BY 'LKW Kennzeichen' ASC", myConn)
        myConn.Open()

        objComm.Parameters.AddWithValue("@LookUP", sLookUP)
        Dim reader As SqlDataReader = objComm.ExecuteReader()

        While reader.Read()
            lstCountries.Add(reader("LKW Kennzeichen").ToString())
        End While

        myConn.Close() : Return lstCountries
    End Function

    <WebMethod()>
    Public Function ShowKdNrAuftrag(ByVal sLookUP As String) As List(Of String)
        Dim lstCountries As New List(Of String)()
        Dim Connectionstring As String = String.Empty

        If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
            'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
            Connectionstring = "Server=DEVELOPER\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
        Else
            Connectionstring = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
            'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
        End If

        Dim myConn As New SqlConnection(Connectionstring)
        Dim objComm As New SqlCommand("SELECT AbsenderKundenNr FROM [VERAG].[dbo].[Rechnungsausgang] " &
            "WHERE AbsenderKundenNr LIKE '%'+@LookUP+'%' ORDER BY AbsenderKundenNr ASC", myConn)
        myConn.Open()

        objComm.Parameters.AddWithValue("@LookUP", sLookUP)
        Dim reader As SqlDataReader = objComm.ExecuteReader()

        While reader.Read()
            lstCountries.Add(reader("AbsenderKundenNr").ToString())
        End While

        myConn.Close() : Return lstCountries
    End Function

    <WebMethod()>
    Public Function ShowAbsender(ByVal sLookUP As String) As List(Of String)
        Dim lstCountries As New List(Of String)()
        Dim Connectionstring As String = String.Empty

        If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
            'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
            Connectionstring = "Server=DEVELOPER\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
        Else
            Connectionstring = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
            'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
        End If

        Dim myConn As New SqlConnection(Connectionstring)
        Dim objComm As New SqlCommand("SELECT 'AbsenderName 1' FROM [VERAG].[dbo].[Rechnungsausgang] " &
            "WHERE 'AbsenderName 1' LIKE '%'+@LookUP+'%' ORDER BY [AbsenderName 1] ASC", myConn)
        myConn.Open()

        objComm.Parameters.AddWithValue("@LookUP", sLookUP)
        Dim reader As SqlDataReader = objComm.ExecuteReader()

        While reader.Read()
            lstCountries.Add(reader("AbsenderName 1").ToString())
        End While

        myConn.Close() : Return lstCountries
    End Function

    <WebMethod()>
    Public Function ShowEmpfaenger(ByVal sLookUP As String) As List(Of String)
        Dim lstCountries As New List(Of String)()
        Dim Connectionstring As String = String.Empty

        If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
            'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
            Connectionstring = "Server=DEVELOPER\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
        Else
            Connectionstring = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
            'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
        End If

        Dim myConn As New SqlConnection(Connectionstring)
        Dim objComm As New SqlCommand("SELECT 'EmpfängerName 1' FROM [VERAG].[dbo].[Rechnungsausgang] " &
            "WHERE 'EmpfängerName 1' LIKE '%'+@LookUP+'%' ORDER BY [EmpfängerName 1] ASC", myConn)
        myConn.Open()

        objComm.Parameters.AddWithValue("@LookUP", sLookUP)
        Dim reader As SqlDataReader = objComm.ExecuteReader()

        While reader.Read()
            lstCountries.Add(reader("EmpfängerName 1").ToString())
        End While

        myConn.Close() : Return lstCountries
    End Function

    <WebMethod()>
    Public Function ShowRENr(ByVal sLookUP As String) As List(Of String)
        Dim lstCountries As New List(Of String)()
        Dim Connectionstring As String = String.Empty

        If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
            'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
            Connectionstring = "Server=DEVELOPER\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
        Else
            Connectionstring = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
            'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
        End If

        Dim myConn As New SqlConnection(Connectionstring)
        Dim objComm As New SqlCommand("SELECT RechnungsNr FROM [VERAG].[dbo].[Rechnungsausgang] " &
            "WHERE RechnungsNr LIKE '%'+@LookUP+'%' ORDER BY RechnungsNr", myConn)
        myConn.Open()

        objComm.Parameters.AddWithValue("@LookUP", sLookUP)
        Dim reader As SqlDataReader = objComm.ExecuteReader()

        While reader.Read()
            lstCountries.Add(reader("RechnungsNr").ToString())
        End While

        myConn.Close() : Return lstCountries
    End Function
End Class