132 lines
4.9 KiB
VB.net
132 lines
4.9 KiB
VB.net
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class RH_CatChecadorEstaciones
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDdlChecadorTipo()
|
|
CargaDdlZonaHoraria()
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjRH As New ClsRH()
|
|
HdnID.Value = -1
|
|
If ObjRH.ChecadorEstacionesGet(HdnID.Value, UsuarioActual.CveEmpresa) Then
|
|
GvChecadorEstaciones.DataSource = ObjRH.DtResultados
|
|
GvChecadorEstaciones.DataBind()
|
|
End If
|
|
ObjRH.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaDdlChecadorTipo()
|
|
Dim ObjRH As New ClsRH()
|
|
If ObjRH.DdlChecadorTipoGet(UsuarioActual.CveEmpresa) Then
|
|
DdlChecadorTipo.DataSource = ObjRH.DtResultados
|
|
DdlChecadorTipo.DataBind()
|
|
|
|
End If
|
|
ObjRH.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaDdlZonaHoraria()
|
|
Dim ObjRH As New ClsRH()
|
|
If ObjRH.DdlZonaHorariaGet() Then
|
|
DdlZonaHoraria.DataSource = ObjRH.DtResultados
|
|
DdlZonaHoraria.DataBind()
|
|
|
|
End If
|
|
ObjRH.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub BtnAgregarChecadorEstaciones_Click(sender As Object, e As EventArgs) Handles BtnAgregarChecadorEstaciones.Click
|
|
Dim ObjRH As New ClsRH
|
|
Dim Estatus = 0
|
|
If ChkEstatus.Checked Then Estatus = 1
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjRH.ChecadorEstacionesAdd(DdlChecadorTipo.SelectedValue, DdlZonaHoraria.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtChecadorEstaciones.Text, TxtIp.Text, TxtPuerto.Text, Estatus) Then
|
|
CargaDatos()
|
|
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If ObjRH.ChecadorEstacionesUpdate(HdnID.Value, DdlChecadorTipo.SelectedValue, DdlZonaHoraria.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtChecadorEstaciones.Text, TxtIp.Text, TxtPuerto.Text, Estatus) Then
|
|
CargaDatos()
|
|
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddChecadorEstaciones"))
|
|
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("CveChecadorEstacion")
|
|
UpDatos.Update()
|
|
BtnAgregarChecadorEstaciones.Text = "Actualizar"
|
|
DdlChecadorTipo.SelectedValueExist(GvRow.DataKey("CveChecadorTipo"))
|
|
DdlZonaHoraria.SelectedValueExist(GvRow.DataKey("CveZonaHoraria"))
|
|
TxtChecadorEstaciones.Text = GvRow.DataKey("ChecadorEstacion")
|
|
TxtIp.Text = GvRow.DataKey("Ip")
|
|
TxtPuerto.Text = GvRow.DataKey("Puerto")
|
|
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
|
UpAddChecadorEstaciones.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChecadorEstaciones"))
|
|
|
|
End Sub
|
|
|
|
Public Sub Agregar()
|
|
HdnModalidad.Value = "A"
|
|
UpDatos.Update()
|
|
BtnAgregarChecadorEstaciones.Text = "Agregar"
|
|
TxtChecadorEstaciones.Text = ""
|
|
TxtIp.Text = ""
|
|
TxtPuerto.Text = ""
|
|
CargaDdlChecadorTipo()
|
|
CargaDdlZonaHoraria()
|
|
ChkEstatus.Checked = False
|
|
UpAddChecadorEstaciones.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddChecadorEstaciones"))
|
|
|
|
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("CveChecadorEstacion")
|
|
UpDatos.Update()
|
|
If ObjRH.ChecadorEstacionesRemove(HdnID.Value) Then
|
|
CargaDatos()
|
|
|
|
End If
|
|
ObjRH.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub LnkChecadorEstaciones_Click(sender As Object, e As EventArgs) Handles LnkChecadorEstaciones.Click
|
|
Agregar()
|
|
End Sub
|
|
|
|
Private Sub GvChecadorEstaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvChecadorEstaciones.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("Estatus") = True 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
|