This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<asp:DropDownList ID="DdlEmpresa" runat="server" AutoPostBack="true" DataTextField="Empresa" DataValueField="CveEmpresa" style="width:100%;" Class="form-control select2me"></asp:DropDownList>
|
||||
</div>
|
||||
<div class="has-info col-sm-6">
|
||||
<asp:TextBox id="TxtBusqueda" CssClass="form-control input-sm" placeholder="" style="width:100%" runat="server" ClientIDMode="Static"/></label>
|
||||
<asp:TextBox id="TxtBusqueda" CssClass="form-control input-sm" placeholder="" style="width:100%" runat="server" ClientIDMode="Static"/>
|
||||
<asp:Button ID="BtnFiltrar" runat="server" Text="Filtrar" class="btn btn-primary" style="display: none;"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
85
Sistemas/PopUpCambiaUsuarioEmpresa.aspx
Normal file
85
Sistemas/PopUpCambiaUsuarioEmpresa.aspx
Normal file
@@ -0,0 +1,85 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpCambiaUsuarioEmpresa.aspx.vb" Inherits="Sistemas_PopUpCambiaUsuarioEmpresa" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
<link href="/Metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" rel="stylesheet" />
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||
Cambio de Usuario
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:Panel ID="PnlGral" runat="server">
|
||||
<asp:UpdatePanel ID="UPPGral" runat="server">
|
||||
<ContentTemplate>
|
||||
<h4> Usuario Actual: <asp:Label ID="LblUsuario" runat="server" Text="" Font-Bold="True"></asp:Label><br />
|
||||
</h4>
|
||||
<div class="row">
|
||||
<%-- <div class="col-sm-6">
|
||||
<asp:Label AssociatedControlID="DdlEmpresa" runat="server" Text="Empresa:"></asp:Label></div>--%>
|
||||
<div class="col-sm-6">Nombre de Usuario:</div>
|
||||
</div>
|
||||
<%--<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<asp:DropDownList ID="DdlEmpresa" runat="server" AutoPostBack="true" DataTextField="Empresa" DataValueField="CveEmpresa" style="width:100%;" Class="form-control select2me"></asp:DropDownList>
|
||||
</div>
|
||||
<div class="has-info col-sm-6">
|
||||
</div>
|
||||
</div>--%>
|
||||
<asp:TextBox ID="TxtBusqueda" CssClass="form-control input-sm" placeholder="" Style="width: 100%" runat="server" ClientIDMode="Static" />
|
||||
<asp:Button ID="BtnFiltrar" runat="server" Text="Filtrar" class="btn btn-primary" Style="display: none;" />
|
||||
|
||||
<div>
|
||||
<asp:GridView ID="gvUsuarios" runat="server" data-sort="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD " AutoGenerateColumns="False" ClientIDMode="Static" DataKeyNames="Usuario,Contraseña,CveEmpresa" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Nombre">
|
||||
<ItemTemplate>
|
||||
|
||||
<asp:LinkButton ID="LnkNombre" runat="server" CssClass="Texto"
|
||||
Text='<%#String.Format("{0}({1})", Eval("Nombre"), Eval("Usuario")) %>' ToolTip='<%# Eval("CveUsuario") %>' CommandName="Usuarios" CommandArgument='<%# eval("CveUsuario") %>'></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<%-- <ItemStyle Width="250px" />
|
||||
<HeaderStyle CssClass="Titulo" HorizontalAlign="Center" />--%>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="Rol" HeaderText="Rol" DataFormatString=" {0}">
|
||||
<ItemStyle HorizontalAlign="Left" Width="150px" />
|
||||
</asp:BoundField>
|
||||
</Columns>
|
||||
<%-- <RowStyle CssClass="Texto" Height="19px" />
|
||||
<HeaderStyle CssClass="Titulo" />
|
||||
<AlternatingRowStyle CssClass="TextoAlterno" />--%>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Panel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
buscarDT();
|
||||
Sys.Application.add_load(function (s, e) {
|
||||
buscarDT();
|
||||
});
|
||||
});
|
||||
function buscarDT() {
|
||||
$('#TxtBusqueda').on('keyup', function () {
|
||||
if (this.value == '') {
|
||||
$('table#' + $(this).attr('data-table') + ' tr').css('display', 'table-row');
|
||||
} else {
|
||||
$('table#' + $(this).attr('data-table') + ' tr').css('display', 'none');
|
||||
$('table#' + $(this).attr('data-table') + ' tr:contains("' + this.value + '")').css('display', 'table-row');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
187
Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb
Normal file
187
Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb
Normal file
@@ -0,0 +1,187 @@
|
||||
Imports ADSSession
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Sistemas_PopUpCambiaUsuarioEmpresa
|
||||
Inherits ClsPaginas
|
||||
|
||||
Property DTUsuarios() As Data.DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTUsuarios"), DataTable)
|
||||
End Get
|
||||
Set(value As Data.DataTable)
|
||||
ViewState("DTUsuarios") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
ViewState("Orden") = ""
|
||||
|
||||
If Not (UsuarioActual.CveRol = 1 OrElse UsuarioActual.ModoSimulacionXEmpresa) Then
|
||||
PnlGral.Visible = False
|
||||
RegistraScript("window.close();")
|
||||
End If
|
||||
|
||||
'Dim DtEmp As DataTable = GlobalDTEmpresas.Copy
|
||||
Dim NombreEmp As String = UsuarioActual.Empresa.Empresa
|
||||
'''condición para ocultar los nombres de las empresas y ponerles "mi empresa de venta (xxx)"
|
||||
''If UsuarioActual.CveUsuario = 100 Then
|
||||
|
||||
'' Dim customerRow() As Data.DataRow
|
||||
'' customerRow = DtEmp.Select("")
|
||||
|
||||
'' For Each drt As DataRow In customerRow
|
||||
'' drt("Empresa") = "Mi Empresa de ventas (" & drt("CveEmpresa") & ")"
|
||||
'' Next
|
||||
|
||||
|
||||
''End If
|
||||
|
||||
CType(Me.Master, BaseMasterPage).EsPopup = True
|
||||
LblUsuario.Text = String.Format("{0} - {1}", UsuarioActual.Nombre, UsuarioActual.Empresa.Empresa)
|
||||
|
||||
|
||||
'DdlEmpresa.DataSource = DtEmp '.FiltraParametros(If(UsuarioActual.CveRol = 1, "CvePlataforma IN (1,2)", $"CvePlataforma={UsuarioActual.Empresa.CvePlataforma}"))
|
||||
Dim CveEmpresa As String = UsuarioActual.CveEmpresa.ToString()
|
||||
|
||||
Dim splitedtext As String() = Request.Url.AbsoluteUri.Replace("http://", "").Replace("https://", "").Split("."c)
|
||||
If Request.Url.AbsoluteUri.Contains("sig.agrojam.com.mx") Then
|
||||
CveEmpresa = 119
|
||||
End If
|
||||
|
||||
If splitedtext.Length > 0 Then
|
||||
Select Case splitedtext(0).ToUpper()
|
||||
Case "VSH" : CveEmpresa = "7"
|
||||
Case "JAM" : CveEmpresa = "119"
|
||||
Case "COMPUPROVEEDORES" : CveEmpresa = "72"
|
||||
Case "DNDIFUSA" : CveEmpresa = "80"
|
||||
Case "SOGO" : CveEmpresa = "8"
|
||||
Case "BDH" : CveEmpresa = "140"
|
||||
Case "ECONOLLANTAS" : CveEmpresa = "141"
|
||||
End Select
|
||||
End If
|
||||
'DdlEmpresa.DataBind()
|
||||
'DdlEmpresa.SelectedValue = CveEmpresa
|
||||
|
||||
'DdlRol.DataSource = GlobalDTRoles(DdlEmpresa.SelectedValue.ToEntero)
|
||||
'DdlRol.DataBind()
|
||||
'DdlRol.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
TxtBusqueda.Attributes.Add("data-table", gvUsuarios.ClientID)
|
||||
|
||||
CargaUsuarios()
|
||||
'LblUsuario.Text = usuarioactual.
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub gvUsuarios_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvUsuarios.RowCommand
|
||||
If e.CommandName = "Usuarios" Then
|
||||
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
|
||||
'Dim Dt As DataTable = GlobalDTUsuarios(e.CommandArgument.ToString.ToEntero)
|
||||
Dim multiempresa As Boolean = ADSSessionConfig.sessionUser.MultipleEmpresa
|
||||
Dim objempresa As Empresa = ADSSessionConfig.sessionUser.Empresa
|
||||
If gvr IsNot Nothing Then
|
||||
|
||||
Dim tUsuario, tContraseña As String
|
||||
Dim tCveEmpresa As Integer
|
||||
tUsuario = gvr.DataKey("Usuario").ToString
|
||||
tContraseña = gvr.DataKey("Contraseña").ToString
|
||||
tCveEmpresa = gvr.DataKey("CveEmpresa").ToString.ToEntero
|
||||
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario
|
||||
'Dim UsuarioAsignaciones As Usuario
|
||||
|
||||
Usuario = ObjUsuario.ValidaUsuario(tUsuario, tContraseña, IMEI, tCveEmpresa)
|
||||
'UsuarioAsignaciones = ObjUsuario.ValidaUsuarioAsignacion(Usuario.CveUsuario, Usuario.CveEmpresa)
|
||||
ObjUsuario.Dispose()
|
||||
|
||||
If Usuario IsNot Nothing Then
|
||||
Dim dt As Data.DataTable = GlobalDTUsuarios(Usuario.CveUsuario)
|
||||
ADSSessionConfig.sessionUser = Usuario
|
||||
ADSSessionConfig.sessionUser.CvePlataforma = 1
|
||||
If Usuario.CveRol = 1200 Then
|
||||
ADSSessionConfig.sessionUser.CvePlataforma = 3
|
||||
End If
|
||||
ADSSessionConfig.sessionDpage = False
|
||||
ADSSessionConfig.sessionUser.MultipleEmpresa = multiempresa
|
||||
ADSSessionConfig.sessionUser.ModoSimulacion = False
|
||||
ADSSessionConfig.sessionUser.ModoSimulacionXEmpresa = True
|
||||
|
||||
UsuarioActual.Empresa = objempresa
|
||||
dt.Dispose()
|
||||
|
||||
If UsuarioActual.CveCliente > 0 Then
|
||||
CargaZonasHorarias(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
|
||||
RegistraScript("gotourl();")
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaZonasHorarias(ByRef UsuarioActual As Usuario)
|
||||
Dim ObjClientes As New ClsClientes
|
||||
Try
|
||||
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=1) Then
|
||||
If ObjClientes.DtResultados.Rows.Count = 1 Then
|
||||
UsuarioActual.UTCOffset = ObjClientes.DtResultados(0)("UTCOffset").ToString().ToEntero()
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener la zona horaria.", ex)
|
||||
Finally
|
||||
ObjClientes.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs) Handles BtnFiltrar.Click
|
||||
CargaUsuarios()
|
||||
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
|
||||
CargaUsuarios(Orden)
|
||||
End Sub
|
||||
|
||||
Private Sub CargaUsuarios(Optional Orden As String = "Nombre")
|
||||
Dim dtt As DataTable = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("CveRol <> 1")
|
||||
dtt = dtt.FiltraParametros("Estatus = 1", Orden, {"CveUsuario", "Usuario", "Nombre", "Contraseña", "CveEmpresa", "Rol"})
|
||||
gvUsuarios.DataSource = dtt
|
||||
gvUsuarios.DataBind()
|
||||
|
||||
If (gvUsuarios.Rows.Count > 0) Then
|
||||
gvUsuarios.UseAccessibleHeader = True
|
||||
gvUsuarios.HeaderRow.TableSection = TableRowSection.TableHeader
|
||||
End If
|
||||
TxtBusqueda.Focus()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user