128 lines
4.9 KiB
VB.net
128 lines
4.9 KiB
VB.net
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class GPS_CatProveedorComunicacion
|
|
|
|
Inherits ClsPaginas
|
|
|
|
#Region " PROPIEDADES"
|
|
|
|
#End Region
|
|
|
|
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 ObjGps As New ClsGPS()
|
|
If ObjGps.TipoComunicacionGet() Then
|
|
DdlTipoComunicacion.DataSource = ObjGps.DtResultados.FiltraParametros("Estatus = 1")
|
|
End If
|
|
If ObjGps.ProveedorComunicacion_Get() Then
|
|
GvProveedorComunicacion.DataSource = ObjGps.DtResultados
|
|
Else
|
|
GvProveedorComunicacion.DataSource = Nothing
|
|
End If
|
|
ObjGps.Dispose()
|
|
GvProveedorComunicacion.DataBind()
|
|
DdlTipoComunicacion.DataBind()
|
|
DdlTipoComunicacion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub BtnAgregarProveedor_Click(sender As Object, e As EventArgs) Handles BtnAgregarProveedor.Click
|
|
Dim ObjGps As New ClsGPS
|
|
Dim Estatus = 0
|
|
Dim correo As String = TxtMail.Text
|
|
If ChkEstatus.Checked Then Estatus = 1
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjGps.ProveedorComunicacion_Add(TxtProveedor.Text, Estatus, UsuarioActual.CveUsuario, DdlTipoComunicacion.SelectedValue.ToEntero(), TxtAPNIP.Text, TxtAPNUser.Text, TxtAPNPass.Text, correo) Then
|
|
CargaDatos()
|
|
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If ObjGps.ProveedorComunicacion_Update(HdnID.Value, TxtProveedor.Text, Estatus, UsuarioActual.CveUsuario, DdlTipoComunicacion.SelectedValue.ToEntero(), TxtAPNIP.Text, TxtAPNUser.Text, TxtAPNPass.Text, correo) Then
|
|
CargaDatos()
|
|
Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProveedorComunicacion"))
|
|
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"
|
|
HdnID.Value = GvRow.DataKey("CveProveedorComunicacion")
|
|
UpDatos.Update()
|
|
BtnAgregarProveedor.Text = "Actualizar"
|
|
myModalLabel.InnerText = "Actualizar Proveedor de Comunicacion"
|
|
TxtProveedor.Text = GvRow.DataKey("ProveedorComunicacion")
|
|
TxtMail.Text = GvRow.DataKey("Correo")
|
|
TxtAPNIP.Text = GvRow.DataKey("APNIP")
|
|
TxtAPNUser.Text = GvRow.DataKey("APNUSER")
|
|
TxtAPNPass.Text = GvRow.DataKey("APNPASS")
|
|
DdlTipoComunicacion.SelectedValueExist(GvRow.DataKey("CveTipoComunicacion"))
|
|
dvEstatusEv.Visible = True
|
|
chkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
|
UpAddProveedorComunicacion.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddProveedorComunicacion"))
|
|
|
|
End Sub
|
|
|
|
Public Sub Agregar()
|
|
HdnModalidad.Value = "A"
|
|
UpDatos.Update()
|
|
BtnAgregarProveedor.Text = "Agregar"
|
|
myModalLabel.InnerText = "Agregar Proveedor de Comunicacion"
|
|
TxtProveedor.Text = ""
|
|
TxtMail.Text = ""
|
|
TxtAPNIP.Text = ""
|
|
TxtAPNUser.Text = ""
|
|
TxtAPNPass.Text = ""
|
|
chkEstatus.Checked = True
|
|
dvEstatusEv.Visible = False
|
|
UpAddProveedorComunicacion.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddProveedorComunicacion"))
|
|
|
|
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("CveProveedorComunicacion")
|
|
UpDatos.Update()
|
|
If ObjGps.Proveedor_Delete(HdnID.Value) Then
|
|
CargaDatos()
|
|
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
ObjGps.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub LnkProveedor1_Click(sender As Object, e As EventArgs) Handles LnkProveedor1.Click
|
|
Agregar()
|
|
End Sub
|
|
|
|
Private Sub GvTipoComunicacion_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProveedorComunicacion.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
|