Imports DevExpress.Web

Public Class ucListadoPuesto
    Inherits ucBase

    Public ReadOnly Property idIns() As String
        Get
            Return Session("idIns")
        End Get
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim oIns As New InstitucionBusinessObject(Me.idIns)
            lblInstitucion.Text = String.Format("Institución: <b>{0}</b>", oIns.Entity.nombreInstitucion)
            'gridHistorialPuestos.DataBind()

        End If
    End Sub

    Protected Sub gridPuestos_CustomButtonInitialize(sender As Object, e As DevExpress.Web.ASPxGridViewCustomButtonEventArgs) Handles gridPuestos.CustomButtonInitialize
        If (e.VisibleIndex = -1) Then Return
        If e.ButtonID = "btnEdit" Or e.ButtonID = "btnEliminar" Then
            If CriterioVisible(CType(sender, ASPxGridView), e.VisibleIndex) = False Then e.Visible = DevExpress.Utils.DefaultBoolean.False
        End If
    End Sub

    Private Function CriterioVisible(g As ASPxGridView, i As Integer) As Boolean
        'If Not String.IsNullOrEmpty(g.GetRowValues(i, "idEstadoPlaza")) Then
        'AndAlso (STP.BL.RolBusinessObject.IsInRole(CInt(Page.User.Identity.Name), 2))
        If g.GetRowValues(i, "idInstitucion").ToString.Equals(Me.idIns) Then
            Return True
        Else
            Return False
        End If
        'Else
        'Return True
        'End If

    End Function
End Class