275 lines
13 KiB
VB.net
275 lines
13 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Partial Class AF_CatClasificacionesCaracteristicas
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaGridClasificaciones()
|
|
CargaGridCaracteristicas()
|
|
CargaDdlCaracteristica()
|
|
CargaDdlModulo()
|
|
CargaDdlCaracteristicaOpciones()
|
|
CargaGridOpciones()
|
|
End If
|
|
End Sub
|
|
|
|
#Region " C L A S I F I C A C I O N E S"
|
|
Protected Sub CargaGridClasificaciones()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicasClasificaciones(UsuarioActual.CveEmpresa) Then
|
|
GvClasificaciones.DataSource = Objeto.DtResultados
|
|
GvClasificaciones.DataBind()
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub LbAgregarClasificacion_Click(sender As Object, e As EventArgs) Handles LbAgregarClasificacion.Click
|
|
Dim Objeto As New ClsGenerales
|
|
If HdnModalidadClasificacion.Value = "I" Then
|
|
If Objeto.AddClasificacionesCaracteristicas(TxtClasificaciones.Text, TxtOrdenClasif.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("La clasificación se agregó correctamente.")
|
|
OcultaDiv("ModalClasificaciones")
|
|
CargaGridClasificaciones()
|
|
CargaDdlCaracteristica()
|
|
UpDatos.Update()
|
|
End If
|
|
Else
|
|
If Objeto.UpdateClasificacionesCaracteristicas(HdnIDClasificacion.Value.ToEntero, TxtClasificaciones.Text, TxtOrdenClasif.Text.ToEntero, UsuarioActual.CveUsuario,
|
|
UsuarioActual.CveEmpresa) Then
|
|
Alert("Se Actualizó correctamente.")
|
|
OcultaDiv("ModalClasificaciones")
|
|
CargaGridClasificaciones()
|
|
CargaDdlCaracteristica()
|
|
UpDatos.Update()
|
|
End If
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Protected Sub GvClasificaciones_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvClasificaciones.RowDeleting
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.RemoveClasificacionesCaracteristicas(GvClasificaciones.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
|
CargaGridClasificaciones()
|
|
Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Protected Sub GvClasificaciones_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvClasificaciones.RowUpdating
|
|
Dim Objeto As New ClsGenerales
|
|
Dim Clave = GvClasificaciones.DataKeys(e.RowIndex).Value.ToString.ToEntero
|
|
|
|
End Sub
|
|
Public Sub ActualizaModalClasif(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnModalidadClasificacion.Value = "U"
|
|
TxtClasificaciones.Text = GvRow.DataKey("CaracteristicaClasificacion")
|
|
TxtOrdenClasif.Text = GvRow.DataKey("Orden")
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalClasificaciones"))
|
|
HdnIDClasificacion.Value = GvRow.DataKey("CveCaracteristicaClasificacion")
|
|
UpModalClasificaciones.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "C A R A C T E R I S T I C A"
|
|
Private Sub CargaDdlCaracteristica()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicasClasificaciones(UsuarioActual.CveEmpresa) Then
|
|
DdlCaracteristica.Items.Clear()
|
|
DdlCaracteristica.DataSource = Objeto.DtResultados
|
|
DdlCaracteristica.DataBind()
|
|
DdlCaracteristica.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub LbAgregarCaracteristica_Click(sender As Object, e As EventArgs) Handles LbAgregarCaracteristica.Click
|
|
Dim Objeto As New ClsGenerales
|
|
|
|
If HFModalidadCaracteristica.Value = "I" Then
|
|
If Objeto.AddCaracteristica(TxtCaracteristica.Text, DdlCaracteristica.SelectedValue.ToEntero, DdlTipoCampo.SelectedValue.ToEntero, DdlModulo.SelectedValue.ToEntero,
|
|
ChkRequerido.Checked, ChkEsSeparador.Checked, ChkEstatusCaracteristica.Checked, TxtOrdenCaracteristica.Text.ToEntero, TxtLongitud.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("La Caracteristica se agregó correctamente.")
|
|
OcultaDiv("ModalCaracteristicas")
|
|
CargaGridCaracteristicas()
|
|
CargaDdlCaracteristicaOpciones()
|
|
UpDatos.Update()
|
|
End If
|
|
|
|
Else
|
|
If Objeto.UpdateCaracteristica(HFIdCaracteristica.Value.ToEntero, TxtCaracteristica.Text, DdlCaracteristica.SelectedValue.ToEntero, DdlTipoCampo.SelectedValue.ToEntero, DdlModulo.SelectedValue.ToEntero,
|
|
ChkRequerido.Checked, ChkEsSeparador.Checked, ChkEstatusCaracteristica.Checked, TxtOrdenCaracteristica.Text.ToEntero, TxtLongitud.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Alert("La Caracteristica se actualizó correctamente.")
|
|
OcultaDiv("ModalCaracteristicas")
|
|
CargaGridCaracteristicas()
|
|
CargaDdlCaracteristicaOpciones()
|
|
UpDatos.Update()
|
|
End If
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub CargaDdlModulo()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicasModulos() Then
|
|
DdlModulo.DataSource = Objeto.DtResultados
|
|
DdlModulo.DataBind()
|
|
DdlModulo.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub CargaGridCaracteristicas()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicas(-1, -1, UsuarioActual.CveEmpresa) Then
|
|
GvCaracteristicas.DataSource = Objeto.DtResultados
|
|
GvCaracteristicas.DataBind()
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Protected Sub GvCaracteristicas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvCaracteristicas.RowDeleting
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.RemoveCaracteristica(GvCaracteristicas.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
|
Alert("La Caracteristica se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
CargaGridCaracteristicas()
|
|
UpDatos.Update()
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Public Sub ActualizaModalCaracteristicas(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HFModalidadCaracteristica.Value = "U"
|
|
HFIdCaracteristica.Value = GvRow.DataKey("CveCaracteristica")
|
|
DdlModulo.SelectedValueExist(GvRow.DataKey("CveCaracteristicaModulo"))
|
|
TxtLongitud.Text = GvRow.DataKey("Longitud")
|
|
DdlCaracteristica.SelectedValueExist(GvRow.DataKey("CveCaracteristicaClasificacion"))
|
|
ChkEstatusCaracteristica.Checked = CBool(IIf(GvRow.DataKey("Estatus").ToString = "Activo", True, False))
|
|
ChkRequerido.Checked = CBool(IIf(GvRow.DataKey("Requerido").ToString = "SI", True, False))
|
|
ChkEsSeparador.Checked = CBool(IIf(GvRow.DataKey("EsSeparador").ToString = "SI", True, False))
|
|
DdlTipoCampo.SelectedValueExist(GvRow.DataKey("TipoCampo"))
|
|
TxtCaracteristica.Text = GvRow.DataKey("Caracteristica")
|
|
TxtOrdenCaracteristica.Text = GvRow.DataKey("Orden")
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalCaracteristicas"))
|
|
UpModalCaracteristicas.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "O P C I O N E S "
|
|
Private Sub CargaDdlCaracteristicaOpciones()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicas(-1, -1, UsuarioActual.CveEmpresa) Then
|
|
DdlCaracteristicasOpciones.Items.Clear()
|
|
DdlCaracteristicasOpciones.DataSource = Objeto.DtResultados
|
|
DdlCaracteristicasOpciones.DataBind()
|
|
DdlCaracteristicasOpciones.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub LbAgregarOpciones_Click(sender As Object, e As EventArgs) Handles LbAgregarOpciones.Click
|
|
Dim Objeto As New ClsGenerales
|
|
If HdnModalidadOpciones.Value = "I" Then
|
|
If ChkSeguirRegistrando.Checked = True Then
|
|
If Objeto.AddCaracteristicasOpciones(TxtOpcion.Text, DdlCaracteristicasOpciones.SelectedValue.ToEntero,
|
|
TxtOrdenOpciones.Text.ToEntero, ChkEstatusOpcion.Checked, UsuarioActual.CveUsuario) Then
|
|
Alert("Se agregó correctamente la opción.")
|
|
CargaGridOpciones()
|
|
TxtOpcion.Text = ""
|
|
DdlCaracteristicasOpciones.SelectedIndex = 0
|
|
TxtOrdenOpciones.Text = ""
|
|
UpModalOpciones.Update()
|
|
End If
|
|
Else
|
|
If Objeto.AddCaracteristicasOpciones(TxtOpcion.Text, DdlCaracteristicasOpciones.SelectedValue.ToEntero,
|
|
TxtOrdenOpciones.Text.ToEntero, ChkEstatusOpcion.Checked, UsuarioActual.CveUsuario) Then
|
|
Alert("Se agregó correctamente la opción.")
|
|
CargaGridOpciones()
|
|
OcultaDiv("ModalOpciones")
|
|
End If
|
|
End If
|
|
Else
|
|
If Objeto.UpdateCaracteristicasOpciones(HdnIdOpciones.Value.ToEntero, TxtOpcion.Text, DdlCaracteristicasOpciones.SelectedValue.ToEntero,
|
|
TxtOrdenOpciones.Text.ToEntero, ChkEstatusOpcion.Checked, UsuarioActual.CveUsuario) Then
|
|
Alert("Se actualizó correctamente la opción.")
|
|
CargaGridOpciones()
|
|
OcultaDiv("ModalOpciones")
|
|
End If
|
|
End If
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Private Sub CargaGridOpciones()
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.GetCaracteristicasOpciones(UsuarioActual.CveEmpresa) Then
|
|
GvOpciones.DataSource = Objeto.DtResultados
|
|
GvOpciones.DataBind()
|
|
End If
|
|
Objeto.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
Protected Sub GvOpciones_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvOpciones.RowDeleting
|
|
Dim Objeto As New ClsGenerales
|
|
If Objeto.RemoveCaracteristicasOpciones(GvOpciones.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
|
Alert("La Opción se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
CargaGridOpciones()
|
|
UpDatos.Update()
|
|
Objeto.Dispose()
|
|
End Sub
|
|
Public Sub ActualizaModalOpciones(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnModalidadOpciones.Value = "U"
|
|
HdnIdOpciones.Value = GvRow.DataKey("CveCaracteristicaOpcion")
|
|
DdlCaracteristicasOpciones.SelectedValueExist(GvRow.DataKey("CveCaracteristicaOpcion"))
|
|
TxtOrdenOpciones.Text = GvRow.DataKey("Orden")
|
|
ChkEstatusOpcion.Checked = CBool(IIf(GvRow.DataKey("Estatus").ToString = "Activo", True, False))
|
|
TxtOpcion.Text = GvRow.DataKey("CaracteristicaOpcion")
|
|
ChkSeguirRegistrando.Checked = False
|
|
DivChkSeguir.Visible = False
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalOpciones"))
|
|
UpModalOpciones.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " E X T R A S "
|
|
Private Sub OcultaDiv(Modal As String)
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", Modal))
|
|
End Sub
|
|
|
|
Private Sub HLAgregarClasificacion_Click(sender As Object, e As EventArgs) Handles HLAgregarClasificacion.Click
|
|
TxtClasificaciones.Text = ""
|
|
TxtOrdenClasif.Text = ""
|
|
HdnModalidadClasificacion.Value = "I"
|
|
UpModalClasificaciones.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalClasificaciones"))
|
|
End Sub
|
|
|
|
Private Sub HLAgregarCaracteristica_Click(sender As Object, e As EventArgs) Handles HLAgregarCaracteristica.Click
|
|
HFModalidadCaracteristica.Value = "I"
|
|
TxtCaracteristica.Text = ""
|
|
TxtOrdenCaracteristica.Text = ""
|
|
DdlModulo.SelectedIndex = 0
|
|
DdlCaracteristica.SelectedIndex = 0
|
|
DdlTipoCampo.SelectedIndex = 0
|
|
TxtLongitud.Text = ""
|
|
ChkEsSeparador.Checked = True
|
|
ChkEstatusCaracteristica.Checked = True
|
|
ChkEsSeparador.Checked = True
|
|
UpModalCaracteristicas.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalCaracteristicas"))
|
|
End Sub
|
|
|
|
Private Sub HLAgregarOpciones_Click(sender As Object, e As EventArgs) Handles HLAgregarOpciones.Click
|
|
HdnModalidadOpciones.Value = "I"
|
|
DdlCaracteristicasOpciones.SelectedIndex = 0
|
|
TxtOrdenOpciones.Text = ""
|
|
ChkEstatusOpcion.Checked = True
|
|
ChkSeguirRegistrando.Checked = True
|
|
TxtOpcion.Text = ""
|
|
ChkSeguirRegistrando.Checked = True
|
|
DivChkSeguir.Visible = True
|
|
UpModalOpciones.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "ModalOpciones"))
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
End Class |