Torna al Thread
Public Shared Function getsource_Arrivi_Partenze(ByVal codalbergo As Integer, ByVal dalgiorno As Date, ByVal algiorno As Date) As IEnumerable(Of IStampeIstat)
Dim arrivi, partenze As Integer
Dim nomestruttura As String
Dim comunemovimento_arrivo, provinciamovimento_arrivo, statomovimento_arrivo As String
Dim comunemovimento_partenza, provinciamovimento_partenza, statomovimento_partenza As String
Dim datamovimento_arrivo, datamovimento_partenza As String
Dim lista As New List(Of IStampeIstat.Arrivi)
Try
Dim conString = ConfigurationManager.ConnectionStrings("DB_GESTIONE_ALBERGHI")
Dim strConnString As String = conString.ConnectionString
Using db As New SqlConnection(strConnString)
db.Open()
Using sqlcmd As New SqlCommand("Get_Arrivi_Partenze", db)
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.AddWithValue("@codicealbergo", SqlDbType.DateTime).Value = codalbergo
sqlcmd.Parameters.AddWithValue("@data1", SqlDbType.DateTime).Value = dalgiorno
sqlcmd.Parameters.AddWithValue("@data2", SqlDbType.DateTime).Value = algiorno
Using sqldr As SqlDataReader = sqlcmd.ExecuteReader
While sqldr.Read
nomestruttura = sqldr.GetSqlValue(1).Value
If sqldr.GetSqlValue(2).Value = "01-01-1900" Then
datamovimento_arrivo = ""
Else
datamovimento_arrivo = CStr(sqldr.GetSqlValue(2).Value)
End If
arrivi = sqldr.GetSqlValue(3).Value
comunemovimento_arrivo = sqldr.GetSqlValue(4).Value
provinciamovimento_arrivo = sqldr.GetSqlValue(5).Value
statomovimento_arrivo = sqldr.GetSqlValue(6).Value
If sqldr.GetSqlValue(7).Value = "01-01-1900" Then
datamovimento_partenza = ""
Else
datamovimento_partenza = CStr(sqldr.GetSqlValue(7).Value)
End If
partenze = sqldr.GetSqlValue(8).Value
comunemovimento_partenza = sqldr.GetSqlValue(9).Value
provinciamovimento_partenza = sqldr.GetSqlValue(10).Value
statomovimento_partenza = sqldr.GetSqlValue(11).Value
lista.Add(New IStampeIstat.Arrivi With {.NomeStruttura = nomestruttura, _
.NrMovimentiArrivo = arrivi, _
.DataMovimentoArrivo = datamovimento_arrivo, _
.ComuneMovimentoArrivo = comunemovimento_arrivo, _
.ProvinciaMovimentoArrivo = provinciamovimento_arrivo, _
.StatoMovimentoArrivo = statomovimento_arrivo})
End While
End Using
End Using
End Using
Catch ex As SqlException
MsgBox(ex.Message)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Return lista