102 lines
3.9 KiB
VB.net
102 lines
3.9 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class GPS_TipoComunicacion
|
|
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 BtnAgregarTipoComunicacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarTipoComunicacion.Click
|
|
Dim ObjGps As New ClsGPS
|
|
Dim Estatus = 0
|
|
If ChkEstatus.Checked Then Estatus = 1
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjGps.TipoComunicacionAdd(TxtTipoComunicacion.Text, Estatus, UsuarioActual.CveUsuario) Then
|
|
CargaDatos()
|
|
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If ObjGps.TipoComunicacionUpdate(HdnID.Value, TxtTipoComunicacion.Text, Estatus, UsuarioActual.CveUsuario) Then
|
|
CargaDatos()
|
|
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
dvEstatus.Style.Add("display", "none")
|
|
End If
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddTipoComunicacion"))
|
|
ObjGps.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjGps As New ClsGPS()
|
|
If ObjGps.TipoComunicacionGet() Then
|
|
GvTipoComunicacion.DataSource = ObjGps.DtResultados
|
|
GvTipoComunicacion.DataBind()
|
|
End If
|
|
ObjGps.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"
|
|
dvEstatus.Style.Add("display", "")
|
|
HdnID.Value = GvRow.DataKey("CveTipoComunicacion")
|
|
UpDatos.Update()
|
|
myModalLabel.InnerHtml = "Actualizar Tipo de Comunicación"
|
|
BtnAgregarTipoComunicacion.Text = "Actualizar"
|
|
TxtTipoComunicacion.Text = GvRow.DataKey("TipoComunicacion")
|
|
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
|
UpAddTipoComunicacion.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddTipoComunicacion"))
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub LnkTipoComunicacion_Click(sender As Object, e As EventArgs) Handles LnkTipoComunicacion.Click
|
|
Agregar()
|
|
End Sub
|
|
|
|
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
|
Dim ObjGps As New ClsGPS()
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnID.Value = GvRow.DataKey("CveTipoComunicacion")
|
|
UpDatos.Update()
|
|
If ObjGps.TipoComunicacionDelete(HdnID.Value) Then
|
|
CargaDatos()
|
|
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjGps.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Public Sub Agregar()
|
|
dvEstatus.Style.Add("display", "none")
|
|
HdnModalidad.Value = "A"
|
|
UpDatos.Update()
|
|
BtnAgregarTipoComunicacion.Text = "Agregar"
|
|
myModalLabel.InnerHtml = "Agregar Tipo de Comunicación"
|
|
TxtTipoComunicacion.Text = ""
|
|
ChkEstatus.Checked = True
|
|
UpAddTipoComunicacion.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddTipoComunicacion"))
|
|
End Sub
|
|
|
|
Private Sub GvTipoComunicacion_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvTipoComunicacion.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
|