142 lines
4.9 KiB
VB.net
142 lines
4.9 KiB
VB.net
Imports System.Data
|
|
Imports System.Drawing
|
|
Imports Extensiones
|
|
|
|
Partial Class Sistemas_CatEmpresas
|
|
Inherits ClsPaginas
|
|
|
|
#Region "Permisos"
|
|
Private Property PermisoEditar As Boolean
|
|
Get
|
|
Return CType(ViewState("PermisoEditar"), Boolean)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("PermisoEditar") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property PermisoModulos As Boolean
|
|
Get
|
|
Return CType(ViewState("PermisoModulos"), Boolean)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("PermisoModulos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property PermisoProcesos As Boolean
|
|
Get
|
|
Return CType(ViewState("PermisoProcesos"), Boolean)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("PermisoProcesos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property PermisoRestablecerContraseña As Boolean
|
|
Get
|
|
Return CType(ViewState("PermisoProcesos"), Boolean)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("PermisoProcesos") = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = "CveEmpresa ASC"
|
|
ViewState("CveRol") = -1
|
|
CargaDatos()
|
|
|
|
If UsuarioActual.CveRol = 1 Or UsuarioActual.CveUsuario = 100 Then
|
|
LBAdd.Visible = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
Dim Empresa As New ClsSisEmpresas
|
|
If Empresa.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then
|
|
GlobalDTEmpresas = Empresa.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
Empresa.Dispose()
|
|
|
|
If ViewState("Orden").ToString() <> String.Empty Then
|
|
CargaGrid(ViewState("Orden").ToString())
|
|
Else
|
|
CargaGrid("")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal Then
|
|
If e.Row.RowIndex <= 1 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(90)
|
|
e.Row.Cells(1).Width = Unit.Pixel(350)
|
|
e.Row.Cells(2).Width = Unit.Pixel(180)
|
|
e.Row.Cells(3).Width = Unit.Pixel(110)
|
|
e.Row.Cells(4).Width = Unit.Pixel(109)
|
|
e.Row.Cells(5).Width = Unit.Pixel(109)
|
|
|
|
End If
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.FCLiteral("LtlCveEmpresa").Text = String.Format("<a class=""Texto"" href=""/Sistemas/Empresa.aspx?CveEmpresa={0}"">{1}</a>", e.Row.DBCampo("CveEmpresa"), e.Row.FCLiteral("LtlCveEmpresa").Text)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
#Region "O R D E N A M I E N T O"
|
|
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
|
Dim Orden As String = ""
|
|
Dim Campo As String = ""
|
|
Dim Literal As Literal = Nothing
|
|
Const OrdenInicial As String = ""
|
|
Dim Arg(2) As String
|
|
|
|
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
|
Campo = Arg(0)
|
|
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
|
|
|
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
|
Else
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
|
End If
|
|
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
|
ViewState("Orden") = Orden
|
|
CargaGrid(Orden)
|
|
End Sub
|
|
|
|
Private Sub CargaGrid(Orden As String)
|
|
|
|
|
|
|
|
Dim CveUsaurioConsulta As Integer = If(UsuarioActual.CveRol = 1, -1, UsuarioActual.CveUsuario)
|
|
|
|
Using ObjEmpresas As New ClsSisEmpresas()
|
|
|
|
If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1", CveUsaurioConsulta) Then
|
|
GvDatos.DataSource = ObjEmpresas.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
End Using
|
|
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
#End Region
|
|
End Class
|