155 lines
4.3 KiB
VB.net
155 lines
4.3 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.Linq
|
|
Imports Extensiones
|
|
|
|
Partial Class RH_CatRegistroPatronal
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveRegistroPatronal() As Integer
|
|
Get
|
|
If ViewState("CveRegistroPatronal") Is Nothing Then
|
|
ViewState("CveRegistroPatronal") = -1
|
|
End If
|
|
Return ViewState("CveRegistroPatronal").ToString.ToEntero
|
|
End Get
|
|
Set
|
|
ViewState("CveRegistroPatronal") = Value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
Protected Sub CatRegistroPatronal_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
Dim ObjRH As New ClsRH
|
|
|
|
If ObjRH.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvDatos.DataSource = ObjRH.DtResultados
|
|
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjRH.Dispose()
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub BtnAgregarPuestoModal_Click(sender As Object, e As EventArgs) Handles BtnModalAgregarRegistroPatronal.Click
|
|
|
|
Dim ObjRH As New ClsRH
|
|
Dim ErrorProceso As Boolean = True
|
|
|
|
If CveRegistroPatronal = -1 Then
|
|
If ObjRH.AddRegistrosPatronales(TxtRegistroPatronal.Text, ChkModalEstatus.Checked, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
|
|
Alert("Registro Patronal correctamente.")
|
|
ErrorProceso = False
|
|
End If
|
|
Else
|
|
If ObjRH.UpdateRegistrosPatronales(CveRegistroPatronal, TxtRegistroPatronal.Text, ChkModalEstatus.Checked, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
|
|
Alert("Registro Patronal actualizado correctamente.")
|
|
ErrorProceso = False
|
|
End If
|
|
End If
|
|
|
|
|
|
CveRegistroPatronal = -1
|
|
ObjRH.Dispose()
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
CargaDatos()
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalRegistroPatronal"))
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickRegistroPatronal(sender As Object, e As EventArgs)
|
|
|
|
Dim Errorelimiancion As Boolean = True
|
|
Dim objRH As New ClsRH
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
Dim CveRegistroPatronalEliminar As Integer = GvRow.DataKey("CveRegistroPatronal").ToEntero
|
|
|
|
If objRH.RemoveRegistrosPatronales(CveRegistroPatronalEliminar, UsuarioActual.CveEmpresa) Then
|
|
Alert("Registro Patronal Eliminado correctamente.")
|
|
Errorelimiancion = False
|
|
End If
|
|
|
|
objRH.Dispose()
|
|
|
|
If Not Errorelimiancion Then
|
|
CargaDatos()
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickRegistroPAtronal(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
|
|
|
|
CveRegistroPatronal = GvRow.DataKey("CveRegistroPatronal").ToEntero
|
|
TxtRegistroPatronal.Text = GvRow.DataKey("RegistroPatronal")
|
|
|
|
LtlTituloModalAgregaRegsitroPatronal.Text = "Editar Registro Patronal"
|
|
|
|
|
|
ChkModalEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString)
|
|
|
|
BtnModalAgregarRegistroPatronal.Text = "Actualizar"
|
|
|
|
UpModalRegistroPAtronal.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DVModalRegistroPatronal"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub LnkAgregarRegistroPatronal_Click(sender As Object, e As EventArgs) Handles LnkAgregarRegistroPatronal.Click
|
|
|
|
|
|
CveRegistroPatronal = -1
|
|
TxtRegistroPatronal.Text = ""
|
|
LtlTituloModalAgregaRegsitroPatronal.Text = "Agregar Registro Patronal"
|
|
ChkModalEstatus.Checked = True
|
|
|
|
|
|
BtnModalAgregarRegistroPatronal.Text = "Agregar"
|
|
|
|
'Combos
|
|
|
|
UpModalRegistroPAtronal.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DVModalRegistroPatronal"))
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
End Class
|