96 lines
4.9 KiB
VB.net
96 lines
4.9 KiB
VB.net
Imports System.Net
|
|
Imports System.Net.Http
|
|
Imports System.Net.Security
|
|
Imports Newtonsoft.Json
|
|
|
|
Public Class VAAPBC
|
|
Inherits System.Web.UI.Page
|
|
'Shared sessionUsuario As String
|
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
|
If Session("Persona") Is Nothing Then
|
|
Response.Redirect("default.aspx")
|
|
End If
|
|
If Session("modo") = "PERSONAL" Then
|
|
intPicadaBL.Visible = False
|
|
'bolsaDeHorasBL.Visible = False
|
|
'VAAPBCBL.Visible = False
|
|
'informPicadasBL.Visible = False
|
|
End If
|
|
If Session("modo") = "PROPIO" Then
|
|
Li1.Visible = False
|
|
End If
|
|
|
|
'sessionUsuario = Session("usuario")
|
|
inpAnyoVAAPBC.Value = DateTime.Now.ToString("yyyy")
|
|
End Sub
|
|
<System.Web.Services.WebMethod()>
|
|
Public Shared Async Function VacacionesAsuntos(anyo As String) As Threading.Tasks.Task(Of String)
|
|
Dim sessionUsuario As String = HttpContext.Current.Session("usuario")
|
|
'Dim url3 As String = "https://172.16.89.216:81/api/SituacionVAAPBC?Nif=28466610Q&Anno=2022"
|
|
' Dim url3 As String = "https://192.168.41.122/api/SituacionVAAPBC?Nif=28466610Q&Anno=2022"
|
|
Dim usuariosSeleccionados As List(Of String) = HttpContext.Current.Session("usuariosSeleccionados")
|
|
Dim consulta As New Models.ConsultaAnnoMes
|
|
consulta.listaNif = usuariosSeleccionados
|
|
consulta.Anno = anyo
|
|
|
|
'Dim url3 As String = ConfigurationManager.AppSettings("RutaRes").ToString + "/api/SituacionVAAPBC"
|
|
|
|
Dim jsonConsulta As String = JsonConvert.SerializeObject(consulta)
|
|
Dim url As String = ConfigurationManager.AppSettings("RutaRes").ToString + "/api/SituacionVAAPBC"
|
|
Dim clienteHTTP As New HttpClient
|
|
Dim contenidoConsultaHTTP As New StringContent(jsonConsulta, Encoding.UTF8, "application/json")
|
|
Debug.WriteLine("CargarListadodePicadasAsync:1===" + Now.ToLongTimeString)
|
|
Dim respuestaHTTP As HttpResponseMessage = Await clienteHTTP.PostAsync(url, contenidoConsultaHTTP).ConfigureAwait(False)
|
|
Debug.WriteLine("CargarListadodePicadasAsync:2===" + Now.ToLongTimeString)
|
|
Dim sRespuesta As String = Await respuestaHTTP.Content.ReadAsStringAsync().ConfigureAwait(False)
|
|
Debug.WriteLine("CargarListadodePicadasAsync:3===" + Now.ToLongTimeString)
|
|
Dim settings As New Newtonsoft.Json.JsonSerializerSettings()
|
|
settings.CheckAdditionalContent = True
|
|
|
|
|
|
'ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(Function() True)
|
|
'Dim clienteHTTP3 As New Net.WebClient()
|
|
'clienteHTTP3.Encoding = System.Text.Encoding.UTF8
|
|
'Dim respuesta3 As String
|
|
'respuesta3 = clienteHTTP3.DownloadString(url3)
|
|
|
|
Dim deserializador3 As New System.Web.Script.Serialization.JavaScriptSerializer()
|
|
deserializador3.MaxJsonLength = Integer.MaxValue
|
|
Dim listaNominas As Models.ResultadoSituacionVAAPBC =
|
|
deserializador3.Deserialize(Of Models.ResultadoSituacionVAAPBC)(sRespuesta)
|
|
Dim json = ""
|
|
Dim sbResultado As New Text.StringBuilder
|
|
|
|
|
|
|
|
If listaNominas.Resultado = 0 Then
|
|
Dim Dias = listaNominas.DiasVAB.First
|
|
Dias.ListadoVaApBc.Sort(Function(x, y) x.Fecha.CompareTo(y.Fecha))
|
|
json += "[{""resultado"":""" + listaNominas.Resultado.ToString + """,""ListadoVAAPBC"":["
|
|
Dim cont = 0
|
|
If Not Dias.ListadoVaApBc.Count = 0 Then
|
|
For Each listadoVAAPCBC As Models.VaApBc In Dias.ListadoVaApBc
|
|
If cont > 0 Then
|
|
json += ","
|
|
End If
|
|
cont += 1
|
|
json += "{""Descripcion"":""" + listadoVAAPCBC.Descripcion + """,""FechaIni"":""" + listadoVAAPCBC.Fecha + """,""FechaFin"":""" + listadoVAAPCBC.FechaFin + """,""TotalDias"":""" + listadoVAAPCBC.NumDias.ToString + """,""HorasManana"":""" + listadoVAAPCBC.HorasManana + """,""HorasTarde"":""" + listadoVAAPCBC.HorasTarde + """}"
|
|
Next
|
|
End If
|
|
json += "],"
|
|
json += """TotPerVa"":""" + Dias.TotPerVa + """,""TotDisVa"":""" + Dias.TotDisVa + """,""TotDifVa"":""" + Dias.TotDifVa + """," +
|
|
"""TotPerAp"":""" + Dias.TotPerAp + """,""TotDisAp"":""" + Dias.TotDisAp + """,""TotDifAp"":""" + Dias.TotDifAp + """," +
|
|
"""TotPerBc"":""" + Dias.TotPerBc + """,""TotDisBc"":""" + Dias.TotDisBc + """,""TotDifBc"":""" + Dias.TotDifBc + """," +
|
|
"""TotPerDr"":""" + Dias.TotPerDr + """,""TotDisDr"":""" + Dias.TotDisDr + """,""TotDifDr"":""" + Dias.TotDifDr + """," +
|
|
"""TotPerHr"":""" + Dias.TotPerHr + """,""TotDisHr"":""" + Dias.TotDisHr + """,""TotDifHr"":""" + Dias.TotDifHr + """}]"
|
|
Else
|
|
json += "[{""resultado"":""" + listaNominas.Resultado.ToString + """}]"
|
|
End If
|
|
|
|
Return json
|
|
|
|
|
|
|
|
|
|
End Function
|
|
End Class |