Imports Extensiones Imports System.Data Partial Class GPS_PlanesDatos Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaDdlProveedorComunicacion() CargaDatos() End If End Sub Private Sub CargaDdlProveedorComunicacion() Dim ObjGps As New ClsGPS() If ObjGps.DdlProveedoresComunicacionGet() Then DdlProveedorComunicacion.DataSource = ObjGps.DtResultados DdlProveedorComunicacion.DataBind() End If ObjGps.Dispose() DdlProveedorComunicacion.Items.Insert(0, New ListItem("Seleccione", -1)) UpDatos.Update() End Sub Private Sub CargaDatos() Dim ObjGps As New ClsGPS() If ObjGps.PlanesDatosGet(UsuarioActual.CveEmpresa) Then GvPlanesDatos.DataSource = ObjGps.DtResultados GvPlanesDatos.DataBind() End If ObjGps.Dispose() UpDatos.Update() End Sub Private Sub BtnAgregarPlanDatos_Click(sender As Object, e As EventArgs) Handles BtnAgregarPlanDatos.Click Dim ObjGps As New ClsGPS Dim Estatus = 0 If ChkEstatus.Checked Then Estatus = 1 If HdnModalidad.Value = "A" Then If ObjGps.PlanesDatosAdd(DdlProveedorComunicacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, TxtPlanDatos.Text, TxtImporte.Text, Estatus, TxtCapacidad.Text, DDLTipoDatos.SelectedValue, TxtCostoAdicional.Text, TxtTechoFacturacion.Text, UsuarioActual.CveEmpresa) Then CargaDatos() Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion) End If ElseIf HdnModalidad.Value = "U" Then If ObjGps.PlanesDatosUpdate(HdnID.Value, DdlProveedorComunicacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, TxtPlanDatos.Text, TxtImporte.Text, Estatus, TxtCapacidad.Text, DDLTipoDatos.SelectedValue, TxtCostoAdicional.Text, TxtTechoFacturacion.Text) Then CargaDatos() Alert("Actualizado Correctamente.", TipoMensaje.MsgInformacion) End If End If RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddPlanesDatos")) 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("CvePlanDato") UpDatos.Update() BtnAgregarPlanDatos.Text = "Actualizar" myModalLabel.InnerText = "Actualizar Plan de Datos" DdlProveedorComunicacion.SelectedValueExist(GvRow.DataKey("CveProveedorComunicacion")) TxtPlanDatos.Text = GvRow.DataKey("PlanDato") TxtImporte.Text = GvRow.DataKey("Importe").ToString().FormatoNumero TxtCapacidad.Text = GvRow.DataKey("Capacidad") DDLTipoDatos.SelectedValueExist(GvRow.DataKey("TipoPlan")) TxtCostoAdicional.Text = GvRow.DataKey("CostoAdicional") TxtTechoFacturacion.Text = GvRow.DataKey("TechoFacturacion") divEstatus.Visible = True ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus")) UpAddPlanesDatos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "divAddPlanesDatos")) End Sub Public Sub Agregar() HdnModalidad.Value = "A" UpDatos.Update() BtnAgregarPlanDatos.Text = "Agregar" myModalLabel.InnerText = "Agregar Plan de Datos" TxtPlanDatos.Text = "" TxtImporte.Text = "" TxtCapacidad.Text = "" TxtCostoAdicional.Text = "" TxtTechoFacturacion.Text = "" CargaDdlProveedorComunicacion() ChkEstatus.Checked = True divEstatus.Visible = False UpAddPlanesDatos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "divAddPlanesDatos")) 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("CvePlanDato") UpDatos.Update() If ObjGps.PlanesDatosRemove(HdnID.Value) Then CargaDatos() Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion) End If ObjGps.Dispose() UpDatos.Update() End Sub Private Sub LnkPlanesDatos_Click(sender As Object, e As EventArgs) Handles LnkPlanesDatos.Click Agregar() End Sub Private Sub GvPlanesDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPlanesDatos.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 If e.Row.DBCampo("Importe") = True Then e.Row.FCLabel("LblImporte").Text = "$" + e.Row.FCLabel("LblImporte").Text.FormatoNumero() End If End If End Sub End Class