201 lines
6.1 KiB
VB.net
201 lines
6.1 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
Imports Extensiones
|
|
|
|
Partial Class General_CatPSCaracteristicas
|
|
Inherits ClsPaginas
|
|
|
|
#Region "PROPIEDADES"
|
|
|
|
#End Region
|
|
|
|
Private Sub General_CatPSCaracteristicas_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaDatos()
|
|
CargaDdlIndicadores()
|
|
CargaDdlModulos()
|
|
CargaDdlEmpresas()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " CARGAS "
|
|
Private Sub CargaDatos()
|
|
Dim Objeto As New ClsIndicadores
|
|
If Objeto.GetIndicadores() Then
|
|
GvIndicadores.DataSource = Objeto.DtResultados
|
|
End If
|
|
GvIndicadores.DataBind()
|
|
|
|
If Objeto.GetIndicadoresEmpresas() Then
|
|
GvEmpresas.DataSource = Objeto.DtResultados
|
|
End If
|
|
GvEmpresas.DataBind()
|
|
|
|
|
|
Objeto.Dispose()
|
|
|
|
End Sub
|
|
|
|
|
|
Public Sub CargaDdlIndicadores()
|
|
DdlIndicador.Items.Clear()
|
|
Dim Objeto As New ClsIndicadores
|
|
If Objeto.GetIndicadores() Then
|
|
DdlIndicador.DataSource = Objeto.DtResultados
|
|
End If
|
|
DdlIndicador.DataBind()
|
|
Objeto.Dispose()
|
|
End Sub
|
|
|
|
|
|
Public Sub CargaDdlModulos()
|
|
DdlModulo.Items.Clear()
|
|
Dim Objeto As New ClsIndicadores
|
|
If Objeto.GetModulos(UsuarioActual.CveEmpresa) Then
|
|
DdlModulo.DataSource = Objeto.DtResultados
|
|
End If
|
|
DdlModulo.DataBind()
|
|
Objeto.Dispose()
|
|
End Sub
|
|
|
|
Public Sub CargaDdlEmpresas()
|
|
DdlEmpresa.Items.Clear()
|
|
DdlEmpresa.DataSource = GlobalDTEmpresas
|
|
DdlEmpresa.DataBind()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " GV INDICADORES Y AGREGAR "
|
|
Private Sub LbAgregarC_Click(sender As Object, e As EventArgs) Handles LbAgregarC.Click
|
|
Dim Objeto As New ClsIndicadores
|
|
Dim Indicador = TxtIndicador.Text
|
|
Dim Modulo = DdlModulo.SelectedValue.ToEntero
|
|
Dim TipoModulo = DdlTipoModulo.SelectedValue.ToEntero
|
|
|
|
If Objeto.AddIndicador(Indicador, Modulo, TipoModulo) Then
|
|
TxtIndicador.Text = ""
|
|
CargaDatos()
|
|
UpIndicadores.Update()
|
|
End If
|
|
|
|
CargaDdlIndicadores()
|
|
UpEmpresas.Update()
|
|
|
|
Objeto.Dispose()
|
|
Alert("El Indicador se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End Sub
|
|
|
|
|
|
Protected Sub GvIndicadores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvIndicadores.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
'ESTATUS NORMAL
|
|
If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then
|
|
If e.Row.DBCampo("TipoModulo") = "1" Then
|
|
e.Row.FCLabel("LtlTipoModulo").Text = "Indicador"
|
|
Else
|
|
e.Row.FCLabel("LtlTipoModulo").Text = "Gráfica"
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Protected Sub GVCarac_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvIndicadores.RowEditing
|
|
GvIndicadores.EditIndex = e.NewEditIndex
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub GvDatosCaracteristicas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvIndicadores.RowUpdating
|
|
|
|
Dim Update As New ClsIndicadores
|
|
Dim Indicador = GvIndicadores.Rows(e.RowIndex).FCTextBox("TxtIndicador").Text.Trim
|
|
Dim CveModulo = GvIndicadores.Rows(e.RowIndex).FCDropDownList("DdlModulo").SelectedValue.ToEntero
|
|
Dim TipoModulo = GvIndicadores.Rows(e.RowIndex).FCCheckBox("TipoModulo").Checked
|
|
Dim Clave = GvIndicadores.Rows(e.RowIndex).DataKey("CveIndicador").ToEntero
|
|
|
|
|
|
If Update.UpdateIndicador(Indicador, CveModulo, TipoModulo, Clave) Then
|
|
Alert("Se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
GvIndicadores.EditIndex = -1
|
|
CargaDatos()
|
|
UpIndicadores.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvIndicadores_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvIndicadores.RowCancelingEdit
|
|
GvIndicadores.EditIndex = -1
|
|
CargaDatos()
|
|
Alert("Se canceló la edición de los campos.")
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub GvIndicadores_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvIndicadores.RowDeleting
|
|
Dim Objeto As New ClsIndicadores
|
|
Dim Clave = GvIndicadores.Rows(e.RowIndex).DataKey("CveIndicador").ToEntero
|
|
|
|
If Objeto.RemoveIndicadores(Clave) Then
|
|
Alert("Se borró correctamente de la base de Datos.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
Objeto.Dispose()
|
|
GvIndicadores.EditIndex = -1
|
|
CargaDatos()
|
|
CargaDdlIndicadores()
|
|
UpIndicadores.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " GV OPCIONES Y AGREGAR "
|
|
|
|
Protected Sub GvDatosOpciones_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEmpresas.RowDeleting
|
|
Dim Objeto As New ClsIndicadores
|
|
Dim Cveindicador = GvEmpresas.Rows(e.RowIndex).DataKey("CveIndicador").ToEntero
|
|
Dim CveEmpresa = GvEmpresas.Rows(e.RowIndex).DataKey("CveEmpresa").ToEntero
|
|
|
|
If Objeto.RemoveIndicadoresEmpresas(Cveindicador, CveEmpresa) Then
|
|
Alert("Se borró correctamente de la base de Datos.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
GvEmpresas.EditIndex = -1
|
|
CargaDatos()
|
|
UpEmpresas.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub LbAgregarO_Click(sender As Object, e As EventArgs) Handles LbAgregarO.Click
|
|
Dim Objeto As New ClsIndicadores
|
|
Dim Indicador = DdlIndicador.SelectedValue.toEntero
|
|
Dim Empresa = DdlEmpresa.SelectedValue.toEntero
|
|
|
|
If Objeto.AddIndicadorEmpresa(Indicador, Empresa) Then
|
|
End If
|
|
|
|
CargaDatos()
|
|
UpDatosempresas.Update()
|
|
UpTitulosO.Update()
|
|
|
|
Objeto.Dispose()
|
|
Alert("El valor del Indicador se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
End Class
|