Imports DevExpress.Web

Public Class ucPostulante
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub gridPostulanteEspecialidades_DataBound(sender As Object, e As EventArgs) Handles gridPostulanteEspecialidades.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridPostulanteIdioma_CustomUnboundColumnData(sender As Object, e As ASPxGridViewColumnDataEventArgs) Handles gridPostulanteIdioma.CustomUnboundColumnData
        If e.Column.FieldName = "calidad" Then
            e.Value = CInt(e.GetListSourceFieldValue("IDI_Lee")) + CInt(e.GetListSourceFieldValue("IDI_Escribe")) + CInt(e.GetListSourceFieldValue("IDI_Habla"))
        End If
    End Sub



    Protected Sub gridPostulanteExperiencia_CustomUnboundColumnData(sender As Object, e As ASPxGridViewColumnDataEventArgs) Handles gridPostulanteExperiencia.CustomUnboundColumnData
        If e.Column.FieldName = "tiempo" Then
            Dim inicio As New Date(e.GetListSourceFieldValue("inicioAnio"), e.GetListSourceFieldValue("inicioMes"), 1)
            Dim fin As Date

            If Not e.GetListSourceFieldValue("activo").ToString = "" Then
                If CBool(e.GetListSourceFieldValue("activo")) Then
                    fin = Date.Now
                Else
                    fin = New Date(e.GetListSourceFieldValue("finAnio"), e.GetListSourceFieldValue("finMes"), 1)
                End If
            Else

                fin = New Date(e.GetListSourceFieldValue("finAnio"), e.GetListSourceFieldValue("finMes"), 1)
            End If

            Dim anios As Integer = DateDiff(DateInterval.Year, inicio, fin)
            Dim meses As Integer = DateDiff(DateInterval.Month, inicio, fin)
            meses = meses Mod 12

            e.Value = String.Format("{0} año(s), {1} mes(es)", anios, meses)
        End If
    End Sub



    Protected Sub gridPostulanteIdioma_DataBound(sender As Object, e As EventArgs) Handles gridPostulanteIdioma.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridPostulanteCapacitaciones_DataBound(sender As Object, e As EventArgs) Handles gridPostulanteCapacitaciones.DataBound, gridConocimientos.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridPostulanteExperiencia_DataBound(sender As Object, e As EventArgs) Handles gridPostulanteExperiencia.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridRefLaborales_DataBound(sender As Object, e As EventArgs) Handles gridRefLaborales.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridReferencias_DataBound(sender As Object, e As EventArgs) Handles gridReferencias.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub

    Protected Sub gridDiscapacidad_DataBound(sender As Object, e As EventArgs) Handles gridDiscapacidad.DataBound
        Dim g As ASPxGridView = TryCast(sender, ASPxGridView)
        If g.VisibleRowCount = 0 Then
            g.ClientVisible = False
        End If
    End Sub
End Class