Imports System.Net.Http
Imports System.Net.Http.Headers
Imports WebIntranet.ClasesDatosAdmin

Public Class GradoPersonal
    Inherits System.Web.UI.Page

    Protected Async Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim token As String = Session("token")
        Dim client As New HttpClient()
        client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", token)
        client.BaseAddress = New Uri(ConfigurationManager.AppSettings("SwaggerVB"))
        Dim idPers = Session("persona").Personas(0).idPersona
        Dim url As String = "/api/CONSOLIDACION_GRADO/GetWithIncludes/" & idPers
        Dim puestosItems = Await UtilAntifraude.ObtenerObjeto(Of List(Of CONSOLIDACION_GRADO))(client, url)
        Dim htmlTabla = ""
        htmlTabla += "<table class='tablaPicadas'>" +
"<tr><th>Nivel</th>" +
"<th>Fecha efecto</th>" +
"<th>Fecha resolución</th></tr>"

        For Each itm As CONSOLIDACION_GRADO In puestosItems
            htmlTabla += "<tr>" +
                    "<td>" + itm.IDNIVELNavigation.DESCRIPCION + "</td>" +
                    "<td>" + If(itm.FECHA_EFECTO IsNot Nothing, itm.FECHA_EFECTO.ToString.Substring(0, 10), "") + "</td>" +
                    "<td>" + If(itm.FECHA_RESOLUCION IsNot Nothing, itm.FECHA_RESOLUCION.ToString.Substring(0, 10), "") + "</td></tr>"
        Next
        htmlTabla += "</table>"
        divTabla.InnerHtml = htmlTabla
    End Sub

End Class