- Get link
- X
- Other Apps
Imports System.Data
Partial Class CVSCadastrados
Inherits BasePage
Private Contador As Integer
Private objTB As DataTable
Private objRow As DataRow
Dim mDTCurriculos As Data.DataTable
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not (Me.IsPostBack) Then
mSessionClass.dtCurriculos = Nothing
BuscarDados(0)
Me.lblMensagem.Text = ""
End If
End Sub
#Region "Pega o Tipo da QueryString"
Private ReadOnly Property Tipo() As Integer
Get
If Not (Request("Tipo") Is Nothing) AndAlso IsNumeric(Request("Tipo")) Then
Return CInt(Request("Tipo"))
Else
Return 0
End If
End Get
End Property
#End Region
Private Sub BuscarDados(ByVal vIndexPagina As Integer)
Dim vDTCurriculos As Data.DataTable = mDTCurriculos
If vDTCurriculos Is Nothing Then
mDTCurriculos = mCT.CurriculosBuscarTodos()
vDTCurriculos = mDTCurriculos
End If
If Not (vDTCurriculos Is Nothing) AndAlso vDTCurriculos.Rows.Count > 0 Then
Me.dtgDados.Visible = True
Me.lblMensagem.Visible = False
Me.dtgDados.DataSource = vDTCurriculos
If IsNumeric(WcFiltros1.cmbItens_SelectedValue) Then
dtgDados.PageSize = WcFiltros1.cmbItens_SelectedValue
Else
dtgDados.PageSize = 100
End If
dtgDados.CurrentPageIndex = vIndexPagina
Me.dtgDados.DataBind()
Else
Me.dtgDados.Visible = False
Me.lblMensagem.Visible = True
Me.lblMensagem.Text = "Não existem curriculos para o filtro atual."
End If
lblTotal.Text = "Total: (" & dtgDados.Items.Count & ")"
lblTituloSecao.Text = "Pesquisar Talentos"
End Sub
Private Sub BuscarFiltros(ByVal vPageIndex As Integer)
Dim vTodos As String = "-- TODOS --"
Dim vStatus As String = IIf(WcFiltros1.ddlStatus_SelectedItem_Text.Trim = vTodos, "", WcFiltros1.ddlStatus_SelectedItem_Text.Trim)
Dim vAgente As String = IIf(WcFiltros1.ddlAgente_SelectedItem_Text.Trim = vTodos, "", WcFiltros1.ddlAgente_SelectedItem_Text.Trim)
Dim vHoje As String = Format(Date.Today.Day, "00") & "/" & Format(Date.Today.Month, "00") & "/" & Date.Today.Year
If vUF <> "" Or vStatus <> "" Or vAgente <> "" Or vTrabalhou <> "" Or vInvestiu <> "" Or vCliente <> "" Or vSala <> "" Or vNome <> "" Or vLocal <> "" Or vFormacao <> "" Or vVisualizar <> "" Or vCargo <> "" Or (vCidade <> "" AndAlso vCidade <> "(NÃO TENHO INTERESSE)") Or (vMeioContato <> "" AndAlso vMeioContato <> "OUTROS") Then
mDTCurriculos = Nothing
If mDTCurriculos Is Nothing Then
BuscarDados(0)
End If
Dim vDT As Data.DataTable = mDTCurriculos.Copy
Dim vFilter As Data.DataView = vDT.DefaultView
If vNome <> "" Then
'HOJE
If vVisualizar = "HOJE" Then
vFilter.RowFilter = " DT_ENTRADA ='" & vHoje & "'"
End If
If vStatus <> "" Then
vFilter.RowFilter = vFilter.RowFilter & " AND STATUS_ATUAL = '" & vStatus & "'"
End If
If vAgente <> "" Then
vFilter.RowFilter = vFilter.RowFilter & " AND AGENTE_XP = '" & vAgente & "'"
End If
End If
Me.lblMensagem.Text = ""
If Not (vFilter Is Nothing) Then
dtgDados.Visible = True
Me.dtgDados.DataSource = vFilter
If IsNumeric(WcFiltros1.cmbItens_SelectedValue) Then
dtgDados.PageSize = WcFiltros1.cmbItens_SelectedValue
Else
dtgDados.PageSize = 50
End If
dtgDados.CurrentPageIndex = vPageIndex
Me.dtgDados.DataBind()
Else
dtgDados.Visible = False
Me.lblMensagem.Visible = True
Me.lblMensagem.Text = "Não foram localizados registros com os filtros informados"
End If
Else
BuscarDados(vPageIndex)
End If
lblTotal.Text = "Total: (" & dtgDados.Items.Count & ")"
End Sub
#Region " Eventos do dtgCurriculos"
Protected Sub dtgDados_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dtgDados.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.AlternatingItem, ListItemType.Item
Dim vICOAcao As ImageButton
vICOAcao = CType(e.Item.Cells(9).FindControl("btnEditarDados"), ImageButton)
vICOAcao.PostBackUrl = "CurriculoDados.aspx?IDCurriculo=" & e.Item.Cells(0).Text
vICOAcao.DataBind()
Dim vICOAcao2 As ImageButton
vICOAcao2 = CType(e.Item.Cells(10).FindControl("btnLog"), ImageButton)
vICOAcao2.PostBackUrl = "CurriculoLog.aspx?IDCurriculo=" & e.Item.Cells(0).Text
vICOAcao2.DataBind()
End Select
End Sub
Private Sub dgConsulta_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dtgDados.PageIndexChanged
BuscarFiltros(e.NewPageIndex)
End Sub
#End Region
Protected Sub btnBuscar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles WcFiltros1.btnBuscar_Click
BuscarFiltros(0)
End Sub
End Class
Partial Class CVSCadastrados
Inherits BasePage
Private Contador As Integer
Private objTB As DataTable
Private objRow As DataRow
Dim mDTCurriculos As Data.DataTable
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not (Me.IsPostBack) Then
mSessionClass.dtCurriculos = Nothing
BuscarDados(0)
Me.lblMensagem.Text = ""
End If
End Sub
#Region "Pega o Tipo da QueryString"
Private ReadOnly Property Tipo() As Integer
Get
If Not (Request("Tipo") Is Nothing) AndAlso IsNumeric(Request("Tipo")) Then
Return CInt(Request("Tipo"))
Else
Return 0
End If
End Get
End Property
#End Region
Private Sub BuscarDados(ByVal vIndexPagina As Integer)
Dim vDTCurriculos As Data.DataTable = mDTCurriculos
If vDTCurriculos Is Nothing Then
mDTCurriculos = mCT.CurriculosBuscarTodos()
vDTCurriculos = mDTCurriculos
End If
If Not (vDTCurriculos Is Nothing) AndAlso vDTCurriculos.Rows.Count > 0 Then
Me.dtgDados.Visible = True
Me.lblMensagem.Visible = False
Me.dtgDados.DataSource = vDTCurriculos
If IsNumeric(WcFiltros1.cmbItens_SelectedValue) Then
dtgDados.PageSize = WcFiltros1.cmbItens_SelectedValue
Else
dtgDados.PageSize = 100
End If
dtgDados.CurrentPageIndex = vIndexPagina
Me.dtgDados.DataBind()
Else
Me.dtgDados.Visible = False
Me.lblMensagem.Visible = True
Me.lblMensagem.Text = "Não existem curriculos para o filtro atual."
End If
lblTotal.Text = "Total: (" & dtgDados.Items.Count & ")"
lblTituloSecao.Text = "Pesquisar Talentos"
End Sub
Private Sub BuscarFiltros(ByVal vPageIndex As Integer)
Dim vTodos As String = "-- TODOS --"
Dim vStatus As String = IIf(WcFiltros1.ddlStatus_SelectedItem_Text.Trim = vTodos, "", WcFiltros1.ddlStatus_SelectedItem_Text.Trim)
Dim vAgente As String = IIf(WcFiltros1.ddlAgente_SelectedItem_Text.Trim = vTodos, "", WcFiltros1.ddlAgente_SelectedItem_Text.Trim)
Dim vHoje As String = Format(Date.Today.Day, "00") & "/" & Format(Date.Today.Month, "00") & "/" & Date.Today.Year
If vUF <> "" Or vStatus <> "" Or vAgente <> "" Or vTrabalhou <> "" Or vInvestiu <> "" Or vCliente <> "" Or vSala <> "" Or vNome <> "" Or vLocal <> "" Or vFormacao <> "" Or vVisualizar <> "" Or vCargo <> "" Or (vCidade <> "" AndAlso vCidade <> "(NÃO TENHO INTERESSE)") Or (vMeioContato <> "" AndAlso vMeioContato <> "OUTROS") Then
mDTCurriculos = Nothing
If mDTCurriculos Is Nothing Then
BuscarDados(0)
End If
Dim vDT As Data.DataTable = mDTCurriculos.Copy
Dim vFilter As Data.DataView = vDT.DefaultView
If vNome <> "" Then
'HOJE
If vVisualizar = "HOJE" Then
vFilter.RowFilter = " DT_ENTRADA ='" & vHoje & "'"
End If
If vStatus <> "" Then
vFilter.RowFilter = vFilter.RowFilter & " AND STATUS_ATUAL = '" & vStatus & "'"
End If
If vAgente <> "" Then
vFilter.RowFilter = vFilter.RowFilter & " AND AGENTE_XP = '" & vAgente & "'"
End If
End If
Me.lblMensagem.Text = ""
If Not (vFilter Is Nothing) Then
dtgDados.Visible = True
Me.dtgDados.DataSource = vFilter
If IsNumeric(WcFiltros1.cmbItens_SelectedValue) Then
dtgDados.PageSize = WcFiltros1.cmbItens_SelectedValue
Else
dtgDados.PageSize = 50
End If
dtgDados.CurrentPageIndex = vPageIndex
Me.dtgDados.DataBind()
Else
dtgDados.Visible = False
Me.lblMensagem.Visible = True
Me.lblMensagem.Text = "Não foram localizados registros com os filtros informados"
End If
Else
BuscarDados(vPageIndex)
End If
lblTotal.Text = "Total: (" & dtgDados.Items.Count & ")"
End Sub
#Region " Eventos do dtgCurriculos"
Protected Sub dtgDados_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dtgDados.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.AlternatingItem, ListItemType.Item
Dim vICOAcao As ImageButton
vICOAcao = CType(e.Item.Cells(9).FindControl("btnEditarDados"), ImageButton)
vICOAcao.PostBackUrl = "CurriculoDados.aspx?IDCurriculo=" & e.Item.Cells(0).Text
vICOAcao.DataBind()
Dim vICOAcao2 As ImageButton
vICOAcao2 = CType(e.Item.Cells(10).FindControl("btnLog"), ImageButton)
vICOAcao2.PostBackUrl = "CurriculoLog.aspx?IDCurriculo=" & e.Item.Cells(0).Text
vICOAcao2.DataBind()
End Select
End Sub
Private Sub dgConsulta_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dtgDados.PageIndexChanged
BuscarFiltros(e.NewPageIndex)
End Sub
#End Region
Protected Sub btnBuscar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles WcFiltros1.btnBuscar_Click
BuscarFiltros(0)
End Sub
End Class
Comments