97 lines
5.0 KiB
VB.net
97 lines
5.0 KiB
VB.net
Imports System.Net
|
|
Imports System.Net.Http
|
|
Imports System.Net.Security
|
|
Imports DevExpress.Drawing.Internal.Images
|
|
Imports Newtonsoft.Json
|
|
Imports WebIntranet.Models
|
|
|
|
Public Class estadoInciPicada
|
|
Inherits System.Web.UI.Page
|
|
|
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
|
|
|
If Session("persona").Personas(0).Dni <> "44286377S" AndAlso Session("modo") <> "PERSONAL" Then
|
|
Response.Redirect("/Default.aspx")
|
|
Else
|
|
Dim usuario As String = "tecnosis"
|
|
Dim contraseña As String = "patata2022"
|
|
Dim url3 As String = ConfigurationManager.AppSettings("RutaRes").ToString + "/api/IncidenciasControlHorario"
|
|
' Dim url3 As String = "http://192.168.41.14:81/api/IncidenciasControlHorario"
|
|
Dim credenciales3 As New Net.CredentialCache()
|
|
credenciales3.Add(New Uri(url3), "Basic", New Net.NetworkCredential(usuario, contraseña))
|
|
Dim clienteHTTP3 As New Net.WebClient()
|
|
clienteHTTP3.Encoding = System.Text.Encoding.UTF8
|
|
clienteHTTP3.Credentials = credenciales3
|
|
Dim respuesta3 As String = clienteHTTP3.DownloadString(url3)
|
|
Dim deserializador3 As New System.Web.Script.Serialization.JavaScriptSerializer()
|
|
deserializador3.MaxJsonLength = Integer.MaxValue
|
|
Dim listaPicada As List(Of Incidencia) =
|
|
deserializador3.Deserialize(Of List(Of Incidencia))(respuesta3)
|
|
Dim ListIncidenciasNoReloj = listaPicada.Where(Function(x) x.EsInciReloj = False).OrderBy(Function(x) x.descripcionWeb).ToList
|
|
|
|
Dim html = "<table class=""tablaPicadas"">"
|
|
html += "<tr>" +
|
|
"<th><input type=""button"" value=""Marcar todas"" id=""btnCheckAll"" class=""btnOAAFGris"" onclick=""checkall()""></th>" +
|
|
"<th>Descripción</th>" +
|
|
"</tr>"
|
|
For Each itm As Incidencia In ListIncidenciasNoReloj
|
|
html += "<tr class=""itmList"" id=""" + itm.descripcionWeb.Replace(" ", "-") + """>" +
|
|
"<td style=""width:100px; text-align:center""><input class=""chkList"" type=""checkbox"" value=""" + itm.idIncidencias + """></td>" +
|
|
"<td>" + itm.descripcionWeb + "</td></tr>"
|
|
Next
|
|
html += "</table>"
|
|
tablaincidencias.InnerHtml = html
|
|
End If
|
|
End Sub
|
|
|
|
<System.Web.Services.WebMethod()>
|
|
Public Shared Async Function obtenerEstado(chPi As String, chTe As String, liId As List(Of Integer), feIn As String, feFi As String) As Threading.Tasks.Task(Of String)
|
|
Try
|
|
|
|
Dim listSeleccionados As New List(Of String)
|
|
listSeleccionados = HttpContext.Current.Session("usuariosSeleccionados")
|
|
If listSeleccionados.Contains(HttpContext.Current.Session("persona").Personas(0).Dni) = False Then
|
|
listSeleccionados.Add(HttpContext.Current.Session("persona").Personas(0).Dni)
|
|
End If
|
|
Dim objetoConsulta As New ObtenerEstado
|
|
objetoConsulta.Picada = chPi
|
|
objetoConsulta.Teletrabajo = chTe
|
|
objetoConsulta.listaIncidencia = liId
|
|
objetoConsulta.listaPersonas = listSeleccionados
|
|
objetoConsulta.feIn = Date.Parse(feIn)
|
|
objetoConsulta.feFi = Date.Parse(feFi)
|
|
Dim jsonConsulta As String = JsonConvert.SerializeObject(objetoConsulta)
|
|
Dim url As String = ConfigurationManager.AppSettings("RutaRes").ToString + "/api/ObtenEstadoInciPicada" ''meter nombre de la funcion
|
|
Dim clienteHTTP As New HttpClient
|
|
clienteHTTP.Timeout = TimeSpan.FromMinutes(10)
|
|
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
|
|
Dim objetoDatos As ResultadoExcelResumenAsistencia =
|
|
Newtonsoft.Json.JsonConvert.DeserializeObject(Of ResultadoExcelResumenAsistencia)(sRespuesta, settings)
|
|
Return sRespuesta
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
End Function
|
|
|
|
End Class
|
|
Public Class ObtenerEstado
|
|
Public Property Picada As Boolean
|
|
Public Property Teletrabajo As Boolean
|
|
Public Property listaIncidencia As List(Of Integer)
|
|
Public Property listaPersonas As List(Of String)
|
|
Public Property feIn As Date
|
|
Public Property feFi As Date
|
|
|
|
End Class
|
|
|
|
'Public Class RespuestaObtenerEstado
|
|
|
|
'End Class |