207 lines
8.9 KiB
VB.net
207 lines
8.9 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class CatModulos
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
CargaPadres()
|
|
CargaPlataformas()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim Modulo As New ClsModulos
|
|
If Modulo.GetModulos(-1, -1, "-1", "-1") Then
|
|
GvDatos.DataSource = Modulo.DtResultados
|
|
GvDatos.DataBind()
|
|
End If
|
|
|
|
Modulo.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaPadres()
|
|
Dim Modulo As New ClsModulos
|
|
If Modulo.GetModulos(-1, -1, "-1", "-1") Then
|
|
GvDatos.DataSource = Modulo.DtResultados
|
|
CboPadres.DataSource = Modulo.DtResultados.FiltraParametros("CvePadre = 0 OR Agrupacion = 'S'")
|
|
CboPadres.DataBind()
|
|
End If
|
|
'CboPadres.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
CboPadres.Items.Insert(0, New ListItem("Raíz", "0"))
|
|
End Sub
|
|
Private Sub CargaPlataformas()
|
|
Dim ObjEmpresas As New ClsSisEmpresas
|
|
If ObjEmpresas.GetPlataforma(-1, "-1") Then
|
|
DdlPlataforma.DataSource = ObjEmpresas.DtResultados
|
|
DdlPlataforma.DataBind()
|
|
End If
|
|
|
|
' DdlPlataforma.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End Sub
|
|
|
|
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
|
|
Dim Modulo As New ClsModulos
|
|
If HdnModalidad.Value = "A" Then
|
|
If Modulo.AddModulo(Me.TxtClave.Text.Trim().ToEntero(), Me.TxtDescripcion.Text.Trim(), Me.CboPadres.SelectedValue.ToEntero(), Me.TxtLiga.Text.Trim(), CboPopUp.SelectedValue,
|
|
Me.TxtAncho.Text.Trim().ToEntero(), Me.TxtAlto.Text.Trim().ToEntero(), Me.TxtOrden.Text.Trim().ToEntero(), Me.TxtEstilo.Text.Trim(), Me.CboIncluye.SelectedValue, Me.CboAgrupacion.SelectedValue,
|
|
UsuarioActual.CveUsuario, DdlPlataforma.SelectedValue.ToEntero) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalModulos"))
|
|
Alert("El nuevo Módulo se guardó correctamente.", TipoMensaje.MsgInformacion)
|
|
CargaDatos()
|
|
UpDatos.Update()
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If Modulo.UpdateModulo(CboPadres.SelectedValue, TxtDescripcion.Text.Trim(), TxtLiga.Text.Trim(), CboPopUp.SelectedValue, TxtAncho.Text.Trim().ToEntero(), TxtAlto.Text.Trim().ToEntero(),
|
|
TxtOrden.Text.Trim().ToEntero(), TxtEstilo.Text.Trim(), CboIncluye.SelectedValue, CboAgrupacion.SelectedValue, UsuarioActual.CveUsuario, HdnID.Value, DdlPlataforma.SelectedValue.ToEntero) Then
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalModulos"))
|
|
Alert("El Módulo se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
CargaDatos()
|
|
UpDatos.Update()
|
|
End If
|
|
End If
|
|
Modulo.Dispose()
|
|
End Sub
|
|
|
|
|
|
|
|
#Region "G V D A T O S"
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
'e.Row.Cells(0).Width = Unit.Pixel(63)
|
|
'e.Row.Cells(1).Width = Unit.Pixel(85)
|
|
'e.Row.Cells(2).Width = Unit.Pixel(95)
|
|
'e.Row.Cells(3).Width = Unit.Pixel(95)
|
|
'e.Row.Cells(4).Width = Unit.Pixel(74)
|
|
'e.Row.Cells(5).Width = Unit.Pixel(69)
|
|
'e.Row.Cells(6).Width = Unit.Pixel(55)
|
|
'e.Row.Cells(7).Width = Unit.Pixel(70)
|
|
'e.Row.Cells(8).Width = Unit.Pixel(90)
|
|
'e.Row.Cells(9).Width = Unit.Pixel(65)
|
|
'e.Row.Cells(10).Width = Unit.Pixel(60)
|
|
'e.Row.Cells(11).Width = Unit.Pixel(76)
|
|
'e.Row.Cells(12).Width = Unit.Pixel(79)
|
|
'e.Row.Cells(13).Width = Unit.Pixel(80)
|
|
'e.Row.Cells(14).Width = Unit.Pixel(68)
|
|
|
|
If e.Row.DBCampo("PopUp") = "N" Then e.Row.FCLabel("E").Text = "No" Else e.Row.FCLabel("E").Text = "Si"
|
|
If e.Row.DBCampo("Incluye") = "N" Then e.Row.FCLabel("I").Text = "No" Else e.Row.FCLabel("I").Text = "Si"
|
|
If e.Row.DBCampo("Agrupacion") = "N" Then e.Row.FCLabel("J").Text = "No" Else e.Row.FCLabel("J").Text = "Si"
|
|
|
|
|
|
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
|
|
|
|
If e.Row.RowState = DataControlRowState.Normal OrElse e.Row.RowState = DataControlRowState.Alternate Then
|
|
|
|
If CType(e.Row.FindControl("C"), Label).Text.Length > 15 Then
|
|
CType(e.Row.FindControl("C"), Label).ToolTip = CType(e.Row.FindControl("C"), Label).Text
|
|
CType(e.Row.FindControl("C"), Label).Text = CType(e.Row.FindControl("C"), Label).Text.Substring(0, 14)
|
|
End If
|
|
|
|
If CType(e.Row.FindControl("D"), Label).Text.Length > 15 Then
|
|
CType(e.Row.FindControl("D"), Label).ToolTip = CType(e.Row.FindControl("D"), Label).Text
|
|
CType(e.Row.FindControl("D"), Label).Text = CType(e.Row.FindControl("D"), Label).Text.Substring(0, 14)
|
|
End If
|
|
|
|
ElseIf e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
|
|
Dim Modulo As New ClsModulos
|
|
If Modulo.GetModulos(-1, -1, "-1", "-1") Then
|
|
e.Row.FCDropDownList("B").DataSource = Modulo.DtResultados.FiltraParametros("CvePadre = 0 OR Agrupacion = 'S'")
|
|
e.Row.FCDropDownList("B").DataBind()
|
|
e.Row.FCDropDownList("B").SelectedValue = e.Row.FCLabel("LB").Text.ToEntero
|
|
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
|
Dim Modulo As New ClsModulos
|
|
If Modulo.RemoveModulo(GvDatos.DataKeys(e.RowIndex).Value.ToString().ToEntero()) Then
|
|
GvDatos.EditIndex = -1
|
|
CargaDatos()
|
|
End If
|
|
|
|
Modulo.Dispose()
|
|
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
Private Sub HlAgregarModulo_Click(sender As Object, e As EventArgs) Handles HlAgregarModulo.Click
|
|
TxtClave.Text = ""
|
|
TxtDescripcion.Text = ""
|
|
TxtAlto.Text = ""
|
|
TxtAncho.Text = ""
|
|
TxtLiga.Text = ""
|
|
TxtOrden.Text = ""
|
|
CboAgrupacion.SelectedIndex = 0
|
|
CboIncluye.SelectedIndex = 0
|
|
CboPadres.SelectedIndex = 0
|
|
CboPopUp.SelectedIndex = 0
|
|
LtlTituloModal.Text = "Agregar Modulo"
|
|
LbAgregar.Text = "Agregar"
|
|
HdnModalidad.Value = "A"
|
|
UpModal.Update()
|
|
RegistraScript("$('#ModalModulos').modal();")
|
|
End Sub
|
|
|
|
Public Sub ActualizaModulo(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim CveModulo As String = GvRow.DataKey("CveModulo").ToString
|
|
|
|
Dim CvePadre As String = GvRow.DataKey("CvePadre").ToString
|
|
|
|
Dim ModuloPadre As String = GvRow.DataKey("DesPadre").ToString
|
|
Dim Descripcion As String = GvRow.DataKey("Modulo").ToString
|
|
Dim Liga As String = GvRow.DataKey("Liga").ToString
|
|
Dim PopUp As String = GvRow.DataKey("PopUp").ToString
|
|
Dim Ancho As String = GvRow.DataKey("Ancho").ToString
|
|
Dim Alto As String = GvRow.DataKey("Alto").ToString
|
|
Dim Orden As String = GvRow.DataKey("Orden").ToString
|
|
Dim Estilo As String = GvRow.DataKey("Estilo").ToString
|
|
Dim Incluye As String = GvRow.DataKey("Incluye").ToString
|
|
Dim Agrupacion As String = GvRow.DataKey("Agrupacion").ToString
|
|
Dim CvePlataforma As String = GvRow.DataKey("CvePlataforma").ToString
|
|
|
|
TxtClave.Text = CveModulo
|
|
|
|
'CboPadres.Items.FindByText(ModuloPadre).Selected = True
|
|
|
|
CboPadres.SelectedValueExist(CvePadre)
|
|
|
|
TxtDescripcion.Text = Descripcion
|
|
TxtLiga.Text = Liga
|
|
CboPopUp.SelectedValueExist(PopUp)
|
|
TxtAncho.Text = Ancho
|
|
TxtAlto.Text = Alto
|
|
TxtOrden.Text = Orden
|
|
TxtEstilo.Text = Estilo
|
|
CboIncluye.SelectedValueExist(Incluye)
|
|
CboAgrupacion.SelectedValueExist(Agrupacion)
|
|
DdlPlataforma.SelectedValueExist(CvePlataforma)
|
|
|
|
HdnID.Value = CveModulo
|
|
HdnModalidad.Value = "U"
|
|
LtlTituloModal.Text = "Actualizar Modulo"
|
|
LbAgregar.Text = "Actualizar"
|
|
UpModal.Update()
|
|
RegistraScript("$('#ModalModulos').modal();")
|
|
End Sub
|
|
|
|
|
|
End Class
|
|
|
|
|