118 lines
3.7 KiB
VB.net
118 lines
3.7 KiB
VB.net
Option Strict On
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class RH_CatCaptaciones
|
|
Inherits ClsPaginas
|
|
|
|
Property CveCaptacion As Integer
|
|
Get
|
|
If ViewState("CveCaptacion") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
|
|
Return DirectCast(ViewState("CveCaptacion"), Integer)
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCaptacion") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
Private Sub RH_CatCaptaciones_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.CaptacionCatalogoGet(-1, -1, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = objRH.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
Private Sub LimpiaModalCaptacion()
|
|
TxtCaptacion.Text = ""
|
|
ChkModalEstatus.Checked = False
|
|
UpModalCaptacion.Update()
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
LtlTituloModalCaptacion.Text = "Actualizar medio de captacion"
|
|
LnkModalCaptacionAgregar.Text = "Actualizar"
|
|
LimpiaModalCaptacion()
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
CveCaptacion = GvRow.DataKey("CveCaptacion").ToEntero
|
|
TxtCaptacion.Text = GvRow.DataKey("Captacion").ToString
|
|
|
|
If Boolean.Parse(GvRow.DataKey("Estatus")) = True Then
|
|
ChkModalEstatus.Checked = True
|
|
Else
|
|
ChkModalEstatus.Checked = False
|
|
End If
|
|
RegistraScript("$('#DivModaMedio').modal({ backdrop: 'static', keyboard: false});", "MCaptaciones")
|
|
End Sub
|
|
|
|
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
CveCaptacion = GvRow.DataKey("CveCaptacion").ToEntero
|
|
|
|
Dim objRH As New ClsRH
|
|
|
|
If objRH.CaptacionCatalogoRemove(CveCaptacion, UsuarioActual.CveEmpresa) Then
|
|
Alert("Se elimino el medio de captación correctamente.")
|
|
End If
|
|
|
|
CveCaptacion = -1
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub LnkNuevoMedioCaptacion_Click(sender As Object, e As EventArgs) Handles LnkNuevoMedioCaptacion.Click
|
|
LtlTituloModalCaptacion.Text = "Agregar medio de captacion"
|
|
LnkModalCaptacionAgregar.Text = "Agregar"
|
|
|
|
LimpiaModalCaptacion()
|
|
RegistraScript("$('#DivModaMedio').modal({ backdrop: 'static', keyboard: false});", "MCaptaciones")
|
|
End Sub
|
|
|
|
Private Sub LnkModalCaptacionAgregar_Click(sender As Object, e As EventArgs) Handles LnkModalCaptacionAgregar.Click
|
|
|
|
|
|
Dim objRH As New ClsRH
|
|
Dim Estatus As Integer = If(ChkModalEstatus.Checked, 1, 0)
|
|
|
|
If CveCaptacion < 0 Then
|
|
If objRH.CaptacionCatalogoAddUpdate(-1, TxtCaptacion.Text.Trim, Estatus, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("El medio de captación se agrego correctamente")
|
|
RegistraScript("$('#DivModaMedio').modal('hide');", "MCaptaciones")
|
|
End If
|
|
Else
|
|
If objRH.CaptacionCatalogoAddUpdate(CveCaptacion, TxtCaptacion.Text.Trim, Estatus, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("El medio de captación se actualizo correctamente")
|
|
RegistraScript("$('#DivModaMedio').modal('hide');", "MCaptaciones")
|
|
End If
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
|
|
CveCaptacion = -1
|
|
CargaDatos()
|
|
End Sub
|
|
End Class
|