Files
SIG/RH/CatChecadorTipo.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

100 lines
3.7 KiB
VB.net

Option Strict On
Imports Extensiones
Partial Class RH_ChecadorTipo
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim ObjRH As New ClsRH()
If ObjRH.ChecadorTipoGet(-1, UsuarioActual.Empresa.CveEmpresa) Then
GvChecadorTipo.DataSource = ObjRH.DtResultados
GvChecadorTipo.DataBind()
End If
ObjRH.Dispose()
UpDatos.Update()
End Sub
Private Sub BtnAgregarChecadorTipo_Click(sender As Object, e As EventArgs) Handles BtnAgregarChecadorTipo.Click
Dim ObjRH As New ClsRH
Dim Estatus As Integer = 0
If ChkEstatus.Checked Then Estatus = 1
If HdnModalidad.Value = "A" Then
If ObjRH.ChecadorTipoAdd(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, TxtChecadorTipo.Text, TxtDescripcion.Text, Estatus) Then
CargaDatos()
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
End If
ElseIf HdnModalidad.Value = "U" Then
If ObjRH.ChecadorTipoUpdate(HdnID.Value.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, TxtChecadorTipo.Text, TxtDescripcion.Text, Estatus, Date.Now) Then
CargaDatos()
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
End If
End If
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddChecadorTipo"))
ObjRH.Dispose()
UpDatos.Update()
End Sub
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
HdnModalidad.Value = "U"
HdnID.Value = GvRow.DataKey("CveChecadorTipo")
UpDatos.Update()
BtnAgregarChecadorTipo.Text = "Actualizar"
TxtChecadorTipo.Text = GvRow.DataKey("ChecadorTipo")
TxtDescripcion.Text = GvRow.DataKey("Descripcion")
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
UpAddChecadorTipo.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChecadorTipo"))
End Sub
Private Sub LnkChecadorTipo_Click(sender As Object, e As EventArgs) Handles LnkChecadorTipo.Click
Agregar()
End Sub
Public Sub Delete_Click(sender As Object, e As EventArgs)
Dim ObjRH As New ClsRH()
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
HdnID.Value = GvRow.DataKey("CveChecadorTipo")
UpDatos.Update()
If ObjRH.ChecadorTipoRemove(HdnID.Value.ToEntero) Then
CargaDatos()
End If
ObjRH.Dispose()
UpDatos.Update()
End Sub
Public Sub Agregar()
HdnModalidad.Value = "A"
UpDatos.Update()
BtnAgregarChecadorTipo.Text = "Agregar"
TxtChecadorTipo.Text = ""
TxtDescripcion.Text = ""
ChkEstatus.Checked = False
UpAddChecadorTipo.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChecadorTipo"))
End Sub
Private Sub GvChecadorTipo_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvChecadorTipo.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Estatus") = True.ToString Then
e.Row.FCLabel("LblEstatus").Text = "Activo"
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Green
Else
e.Row.FCLabel("LblEstatus").Text = "Inactivo"
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Red
End If
End If
End Sub
End Class