Imports DevExpress.Web

Public Class ucEvaluarPostulacion
    Inherits System.Web.UI.UserControl

    Private _calificar As Boolean
    Public Property Calificar() As Boolean

        Set(ByVal value As Boolean)
            _calificar = value
        End Set
        Get
            Return _calificar
        End Get
    End Property


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

        ucFormularioEvaluacion1.Calificar = _calificar
        ucPostulantes1.Calificar = _calificar
        If _calificar = False Then
            cmbConcursoEvaluar.DataSourceID = "SqlConcursoEvaluado"
            'SqlConcursoAEvaluar.SelectParameters("idEstadoPlaza").DefaultValue = 5

            pcEvaluacion.ClientSideEvents.ActiveTabChanging = "function(s,e){" + _
                "var tabName = (pcEvaluacion.GetActiveTab()).name; " + _
                "e.cancel = !ASPxClientEdit.ValidateGroup('group' + tabName);" + _
                "}"
        Else
            pcEvaluacion.ClientSideEvents.ActiveTabChanging = "function(s,e){" + _
                "var tabName = (pcEvaluacion.GetActiveTab()).name; " + _
                "e.cancel = !ASPxClientEdit.ValidateGroup('group' + tabName);" + _
                "if (typeof gridPostulantes == 'undefined') { " + _
                "   if (e.tab.name == 'TabAprobados') " + _
                "       e.cancel = True " + _
                "   } " + _
                "   else { " + _
                "       if (gridPostulantes.cpSummary > 0) { " + _
                "           alert('Tiene que calificar todos los postulantes para este Paso 3.'); " + _
                "           e.cancel = True " + _
                "       } " + _
                "   } " + _
                "}"
            pcEvaluacion.ClientSideEvents.ActiveTabChanged = "function(s, e) { " + _
                            "if (s.GetActiveTabIndex() == 2)" + _
                            " 	gridPreSeleccionados.Refresh();" + _
                            "}"
        End If
        SqlConcursoAEvaluar.SelectParameters("idUser").DefaultValue = CInt(Page.User.Identity.Name)



    End Sub

    Protected Sub cmbConcursoEvaluar_ValueChanged(sender As Object, e As EventArgs) Handles cmbConcursoEvaluar.ValueChanged
        Session("plaza") = cmbConcursoEvaluar.Value
    End Sub

    'Protected Sub SqlConcursoAEvaluar_Selecting(sender As Object, e As SqlDataSourceSelectingEventArgs) Handles SqlConcursoAEvaluar.Selecting
    '    SqlConcursoAEvaluar.SelectParameters("idUser").DefaultValue = CInt(Page.User.Identity.Name)
    'End Sub

    Protected Sub cmbConcursoEvaluar_DataBound(sender As Object, e As EventArgs) Handles cmbConcursoEvaluar.DataBound
        CType(sender, ASPxComboBox).NullText = CType(sender, ASPxComboBox).Items.Count & " concursos disponibles."
    End Sub
End Class