Cambio entre portales (portal del cliente)

This commit is contained in:
2020-09-26 16:09:32 -07:00
parent b971b9da22
commit c60179f2b2
6 changed files with 325 additions and 181 deletions

View File

@@ -413,8 +413,67 @@ Public Class ClsSisUsuarios
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function ValidaUsuarioPortalCliente(Clave As String, Usuario As String, Password As String) As Usuario
Dim Retorno As Usuario = Nothing
DataAdapter("PA_Sis_UsuariosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveUsuario", SqlDbType.Int).Value = -1
.Add("@CveRol", SqlDbType.Int).Value = -1
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
End With
Try
SqlAdapter.Fill(Data)
If Data.Rows.Count > 0 Then
Retorno = New Usuario
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
Retorno.Usuario = Usuario
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
Retorno.Nombre = Data.Rows(0)("Nombre").ToString
Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
Retorno.Rol = Data.Rows(0)("Rol").ToString
'Retorno.NombreEmpresa = Data.Rows(0)("Empresa").ToString
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
Retorno.CveCliente = Clave.ToEntero
Retorno.ClienteGPS = False
Retorno.Portal = True
Retorno.Referencia = Data.Rows(0)("Referencia").ToString
Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False)
'Retorno.Liga = Data.Rows(0)("Liga").ToString
'cargo los modulos del usuario y genero el menú
Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveCliente)
Dim UsuariosModulos As New HybridDictionary
For Each Row As DataRow In dttmp.Rows
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
Next
Retorno.Modulos = UsuariosModulos
''cargo los procesos del usuario
dttmp = GetUsuariosRolesProcesos(Retorno.CveUsuario)
Dim UsuariosProcesos As New HybridDictionary
For Each Row As DataRow In dttmp.Rows
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
Next
Retorno.Procesos = UsuariosProcesos
End If
Catch ex As SqlException
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
Retorno = Nothing
End Try
Return Retorno
End Function
#Region "U S U A R I O - I N D I C A D O R E S" #Region "U S U A R I O - I N D I C A D O R E S"
Public Function getUsuarioIndicadores(_CveUsuario As Integer, _CveEmpresa As Integer, _CveRol As Integer) As DataTable Public Function getUsuarioIndicadores(_CveUsuario As Integer, _CveEmpresa As Integer, _CveRol As Integer) As DataTable
@@ -2671,12 +2730,37 @@ Public Class ClsSisUsuarios
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetUsuarioCliente(CveUsuario As Integer, CveCliente As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Sis_UsuariosClienteGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch Ex1 As SqlException
If Ex1.Message.Contains("Número: 2627;") Then
Alert("Ya existe un Usuario con el mismo nombre: " & Usuario & ".", TipoMensaje.MsgAdvertencia)
Else
Me.OnError("Ocurrió un error al guardar el nuevo usuario", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
Catch ex As Exception
OnError("Ocurrió un error al guardar el nuevo usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region #End Region
#Region "U S U A R I O S - PyME" #Region "U S U A R I O S - PyME"
Public Function AddUsuariosModulosPyMe(CveUsuario As Integer, Rol As String) As Boolean Public Function AddUsuariosModulosPyMe(CveUsuario As Integer, Rol As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False

View File

@@ -21,6 +21,17 @@
#GvPermisosComandos tr td:nth-child(n+3), #GVNotificaciones tr th:nth-child(n+2) { #GvPermisosComandos tr td:nth-child(n+3), #GVNotificaciones tr th:nth-child(n+2) {
width: 50px; width: 50px;
} }
.CustomSpinner {
position: fixed;
background-image: url(/Imagenes/Loading.gif);
background-repeat: no-repeat, repeat;
background-size: contain;
top: 60px;
right: 25px;
z-index: 500000;
height: 40px;
width: 40px;
}
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
@@ -430,6 +441,7 @@
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div class="CustomSpinner" style="display: none;"></div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script> <script>
@@ -440,30 +452,34 @@
let myTick = 0 let myTick = 0
$('body').on('keyup', '#TxtEmail ', function (e) { $('body').on('keyup', '#TxtEmail ', function (e) {
changeUser();
});
function changeUser() {
let Tick = myTick + 1; let Tick = myTick + 1;
myTick = Tick; myTick = Tick;
setTimeout( setTimeout(
function () { function () {
if (myTick == Tick) { if (myTick == Tick) {
myTick = 0; myTick = 0;
let Tusuario = $('#TxtEmail').val(); let Tusuario = $('#TxtEmail').val();
if (TusuarioOld != Tusuario) { if (TusuarioOld != Tusuario) {
$('.CustomSpinner').show();
TusuarioOld = Tusuario TusuarioOld = Tusuario
//console.log(Tusuario) $.ajax({
$.ajax({
url: "/Ashx/SIGWeb.ashx", url: "/Ashx/SIGWeb.ashx",
data: { usuario: Tusuario, metodo: 'GetUser' } data: { usuario: Tusuario, metodo: 'GetUser' }
}).done(function (data) { }).done(function (data) {
//console.log(data) if (data == "1") {
if (data == "1") { $('#BtnCambiarUsuario').click()
$('#BtnCambiarUsuario').click() } else {
} $('.CustomSpinner').hide();
}
}); });
}
} }
} }, 500);
}, 2000); }
});
function ADSBegin() { function ADSBegin() {
TusuarioOld = $('#TxtEmail').val() TusuarioOld = $('#TxtEmail').val()

View File

@@ -371,7 +371,19 @@ Partial Class Sistemas_PopUpAddUsuario
' Return ' Return
'End If 'End If
If UsuarioActual.Empresa.CvePlataforma = 3 Then If UsuarioActual.Empresa.CvePlataforma = 1 Then
Dim DtClientesAcceso As DataTable = Nothing
If Not HuboError AndAlso ObjUsuarios.GetUsuarioCliente(CveUsuario, CveCliente) Then
'DEBE AGREGAR EL USUARIO AL CLIENTE
If ObjUsuarios.DtResultados.Rows.Count = 0 Then
If Not HuboError AndAlso Not ObjUsuarios.AddUsuarioCliente(CveUsuario, CveCliente) Then
HuboError = True
End If
End If
Else
HuboError = True
End If
ElseIf UsuarioActual.Empresa.CvePlataforma = 3 Then
If Not ObjUsuarios.UpdateUsuario(LtlUsuario.Text.Trim, TxtNombre.Text, -1, TxtEmail.Text, -1, -1, False, True, -1, CveUsuario, -1, -1) Then If Not ObjUsuarios.UpdateUsuario(LtlUsuario.Text.Trim, TxtNombre.Text, -1, TxtEmail.Text, -1, -1, False, True, -1, CveUsuario, -1, -1) Then
HuboError = True HuboError = True
End If End If
@@ -855,6 +867,8 @@ Partial Class Sistemas_PopUpAddUsuario
CargaModulosPermisos() CargaModulosPermisos()
CargaComandos() CargaComandos()
UpDatos.Update() UpDatos.Update()
RegistraScript(" $('.CustomSpinner').hide();")
End Sub End Sub
End Class End Class

View File

@@ -1,123 +1,141 @@
<%@ Page Title="Lista de Empresas con acceso disponible" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpSeleccionarEmpresa.aspx.vb" Inherits="PopUpSeleccionarEmpresa" %> <%@ Page Title="Lista de Empresas con acceso disponible" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpSeleccionarEmpresa.aspx.vb" Inherits="PopUpSeleccionarEmpresa" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Lista de Empresas con acceso disponible Lista de Empresas con acceso disponible
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<div style="align-content: center;"> <div style="align-content: center;">
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:Button ID="BtnSeleccionar" runat="server" ClientIDMode="Static" Text="Seleccionar" Style="display: none;" class="btn btn-primary" /> <asp:Button ID="BtnSeleccionar" runat="server" ClientIDMode="Static" Text="Seleccionar" Style="display: none;" class="btn btn-primary" />
<asp:HiddenField ID="HdnEmpresa" runat="server" ClientIDMode="Static" Value="-1" /> <asp:HiddenField ID="HdnEmpresa" runat="server" ClientIDMode="Static" Value="-1" />
<asp:Button ID="BtnSetWindows" runat="server" ClientIDMode="Static" Text="Set Window" Style="display: none;" class="btn btn-primary" /> <asp:Button ID="BtnSetWindows" runat="server" ClientIDMode="Static" Text="Set Window" Style="display: none;" class="btn btn-primary" />
<asp:HiddenField ID="HdnAncho" runat="server" ClientIDMode="Static" Value="-1" /> <asp:HiddenField ID="HdnAncho" runat="server" ClientIDMode="Static" Value="-1" />
<asp:HiddenField ID="HdnAlto" runat="server" ClientIDMode="Static" Value="-1" /> <asp:HiddenField ID="HdnAlto" runat="server" ClientIDMode="Static" Value="-1" />
<div id="TblBusqueda" runat="server" border="0" visible="false" > <div id="TblBusqueda" runat="server" border="0" visible="false">
<div> <div>
Número de registros encontrados: <b> Número de registros encontrados: <b>
<asp:Literal ID="LtlTotalRegistros" runat="server"></asp:Literal></b> <asp:Literal ID="LtlTotalRegistros" runat="server"></asp:Literal></b>
</div> </div>
<div> <div>
<input name="ctl00$C$TxtBusqueda" type="text" id="TxtBusqueda" class="form-control input-sm TxtBusqueda" placeholder="" data-table=".GVSearch" style="width: 100%"> <input name="ctl00$C$TxtBusqueda" type="text" id="TxtBusqueda" class="form-control input-sm TxtBusqueda" placeholder="" data-table=".GVSearch" style="width: 100%">
</div> </div>
<asp:GridView ID="GV" runat="server" DataKeyNames="CveUsuario, Contraseña, Usuario,CveEmpresa" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros" <asp:GridView ID="GvEmpresas" runat="server" DataKeyNames="CveUsuario, Contraseña, Usuario,CveEmpresa" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros"
Width="100%" ToolTip="Listado de Empresas a las que tiene acceso." CssClass="table table-striped table-advance table-hover GVSearch" Style="margin-top: -10px; text-align: center;" Width="100%" ToolTip="Listado de Empresas a las que tiene acceso." CssClass="table table-striped table-advance table-hover GVSearch" Style="margin-top: -10px; text-align: center;"
GridLines="None"> GridLines="None">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate>Empresa</HeaderTemplate> <HeaderTemplate>Empresa</HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("Empresa")%>' CommandArgument='<%# Eval("CveEmpresa") %>' CommandName="Cambia"></asp:LinkButton> <asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("Empresa")%>' CommandArgument='<%# Eval("CveEmpresa") %>' CommandName="Cambia"></asp:LinkButton>
</ItemTemplate> </ItemTemplate>
<ItemStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign="Left" />
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<HeaderStyle HorizontalAlign="Left" /> <HeaderStyle HorizontalAlign="Left" />
<AlternatingRowStyle CssClass="TextoAlterno" /> <AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView> </asp:GridView>
<asp:GridView ID="GVCliente" runat="server" DataKeyNames="CveUsuario, CveCliente, Contraseña, Usuario" AutoGenerateColumns="false" ShowHeaderWhenEmpty="false" <asp:GridView ID="GvPortalRastreo" runat="server" DataKeyNames="CveUsuario, CveCliente, Contraseña, Usuario" AutoGenerateColumns="false" ShowHeaderWhenEmpty="false"
Width="100%" ToolTip="Listado de Empresas a las que tiene acceso." CssClass="table table-striped table-advance table-hover GVSearch" Width="100%" ToolTip="Listado de Empresas a las que tiene acceso." CssClass="table table-striped table-advance table-hover GVSearch"
Style="margin-top: -10px; text-align: center;" GridLines="None"> Style="margin-top: -10px; text-align: center;" GridLines="None">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate>Portal Rastreo</HeaderTemplate> <HeaderTemplate>Portal Rastreo</HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("Cliente")%>' CommandArgument='<%# Eval("CveCliente") %>' CommandName="Cambia"></asp:LinkButton> <asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("Cliente")%>' CommandArgument='<%# Eval("CveCliente") %>' CommandName="Cambia"></asp:LinkButton>
</ItemTemplate> </ItemTemplate>
<ItemStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" /> <HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div>
</ContentTemplate> <asp:GridView ID="GvPortalCliente" runat="server" DataKeyNames="CveUsuario, CveCliente, Contraseña, Usuario, CveEmpresa" AutoGenerateColumns="false" ShowHeaderWhenEmpty="false"
</asp:UpdatePanel> Width="100%" ToolTip="Listado de Empresas a las que tiene acceso." CssClass="table table-striped table-advance table-hover GVSearch"
</div> Style="margin-top: -10px; text-align: center;" GridLines="None">
<Columns>
</asp:Content> <asp:TemplateField>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server"> <HeaderTemplate>Portal del Cliente</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("ClienteEmpresa")%>' CommandArgument='<%# Eval("CveCliente") %>' CommandName="Cambia"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
buscarDT(); buscarDT();
Sys.Application.add_load(function (s, e) { Sys.Application.add_load(function (s, e) {
buscarDT(); buscarDT();
}); });
}); });
document.body.onload = function () { document.body.onload = function () {
alertSize(); alertSize();
} }
function Ir(c) { function Ir(c) {
$get("HdnEmpresa").value = c; $get("HdnEmpresa").value = c;
$('#BtnSeleccionar').click(); $('#BtnSeleccionar').click();
} }
function Ir2() { function Ir2() {
gotourl('/PortalGPS/InicioGPS.aspx'); gotourl('/PortalGPS/InicioGPS.aspx');
} }
function Ir3() { function Ir3() {
gotourl('/Inicio.aspx'); gotourl('/Inicio.aspx');
} }
function buscarDT() { function Ir4() {
$('.TxtBusqueda').on('keyup', function () { gotourl('/PortalCliente/PortalCliente.aspx');
if (this.value == '') { }
$('table' + $(this).attr('data-table') + ' tr').css('display', '');
} else { function buscarDT() {
$('.TxtBusqueda').on('keyup', function () {
if (this.value == '') {
$('table' + $(this).attr('data-table') + ' tr').css('display', '');
} else {
$('table' + $(this).attr('data-table') + ' tr').css('display', 'none'); $('table' + $(this).attr('data-table') + ' tr').css('display', 'none');
$('table' + $(this).attr('data-table') + ' tr:contains("' + this.value + '")').css('display', ''); $('table' + $(this).attr('data-table') + ' tr:contains("' + this.value + '")').css('display', '');
} }
}); });
$('.TxtBusqueda').removeClass('TxtBusqueda'); $('.TxtBusqueda').removeClass('TxtBusqueda');
} }
function alertSize() { function alertSize() {
var myWidth = 0, myHeight = 0; var myWidth = 0, myHeight = 0;
if (typeof (window.innerWidth) == 'number') { if (typeof (window.innerWidth) == 'number') {
//Non-IE //Non-IE
myWidth = window.innerWidth; myWidth = window.innerWidth;
myHeight = window.innerHeight; myHeight = window.innerHeight;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode' //IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth; myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight; myHeight = document.documentElement.clientHeight;
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible //IE 4 compatible
myWidth = document.body.clientWidth; myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight; myHeight = document.body.clientHeight;
} }
$get("HdnAncho").value = myWidth; $get("HdnAncho").value = myWidth;
//$get("TablaGeneral").style.width = myWidth; //$get("TablaGeneral").style.width = myWidth;
@@ -126,5 +144,5 @@
//$('#BtnSetWindows').click(); //$('#BtnSetWindows').click();
} }
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -19,30 +19,31 @@ Partial Class PopUpSeleccionarEmpresa
End Sub End Sub
Private Sub GetEmpresas() Private Sub GetEmpresas()
Dim Dt As Data.DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) Dim Dt As Data.DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario)
If Dt IsNot Nothing Then If Dt IsNot Nothing Then
If Dt.Rows.Count > 0 Then If Dt.Rows.Count > 0 Then
LtlTotalRegistros.Text = Dt.Rows.Count.ToString.FormatoNumero(0) LtlTotalRegistros.Text = Dt.Rows.Count.ToString.FormatoNumero(0)
GV.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)", "Empresa") GvEmpresas.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)", "Empresa")
GVCliente.DataSource = Dt.FiltraParametros("CvePlataforma = 3 AND CveCliente IS NOT NULL", "Empresa") GvPortalRastreo.DataSource = Dt.FiltraParametros("CvePlataforma = 3 AND CveCliente IS NOT NULL", "Empresa")
GvPortalCliente.DataSource = Dt.FiltraParametros("CvePlataforma = 6 AND CveCliente IS NOT NULL", "Empresa")
Else Else
LtlTotalRegistros.Text = "0" LtlTotalRegistros.Text = "0"
GV.DataSource = Nothing GvEmpresas.DataSource = Nothing
Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
End If End If
End If End If
GV.DataBind() GvEmpresas.DataBind()
GVCliente.DataBind() GvPortalRastreo.DataBind()
GvPortalCliente.DataBind()
UPDatos.Update() UPDatos.Update()
TblBusqueda.Visible = True TblBusqueda.Visible = True
End Sub End Sub
Protected Sub GV_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GV.RowCommand Protected Sub GvEmpresas_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvEmpresas.RowCommand
If e.CommandName = "Cambia" Then If e.CommandName = "Cambia" Then
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow) Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
@@ -80,35 +81,7 @@ Partial Class PopUpSeleccionarEmpresa
End If End If
End Sub End Sub
Protected Sub GvPortalRastreo_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GvPortalRastreo.RowCommand
Private Sub GuardaLogR(Mensaje As String)
Dim ArchivoW As IO.StreamWriter
Dim MensajeLog As String = ""
Dim continuar As Boolean = True
Try
If Not IsNothing(System.Web.HttpContext.Current) Then
If Not IsNothing(System.Web.HttpContext.Current.Request) Then
MensajeLog = $"{HttpContext.Current.Request.Url.ToString()}{Environment.NewLine}"
End If
End If
Catch
End Try
MensajeLog = $"{System.Environment.NewLine}'{DateTime.Now:dd/MM/yyyy hh:mm}' -- {MensajeLog}{Mensaje.Trim()}{Environment.NewLine}"
Try
ArchivoW = New IO.StreamWriter(String.Format("{0}\LogSession.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
Catch
Exit Sub
End Try
Try
ArchivoW.Write(MensajeLog)
Catch
End Try
ArchivoW.Close()
ArchivoW.Dispose()
End Sub
Protected Sub gvUsuarios_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GVCliente.RowCommand
If e.CommandName = "Cambia" Then If e.CommandName = "Cambia" Then
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow) Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
@@ -142,32 +115,49 @@ Partial Class PopUpSeleccionarEmpresa
End If End If
End If End If
End Sub End Sub
Protected Sub GvPortalCliente_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GvPortalCliente.RowCommand
If e.CommandName = "Cambia" Then
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
If gvr IsNot Nothing Then
Protected Sub BtnSetWindows_Click(sender As Object, e As System.EventArgs) Handles BtnSetWindows.Click Dim ObjUsuario As New ClsSisUsuarios
RegistraScript(String.Format("$get('tdContenido').style.height='{0}px'; $get('tdContenido').style.width='{1}px'", HdnAlto.Value.ToEntero - 30, HdnAncho.Value.ToEntero - 30)) Dim Usuario As Usuario = Nothing
End Sub Usuario = ObjUsuario.ValidaUsuarioPortalCliente(gvr.DataKey("CveCliente"), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"))
ObjUsuario.Dispose()
Private Sub CreaObjetoEmpresa() If Usuario IsNot Nothing Then
Dim ObjEmpresa As New ClsSisEmpresas() Dim dt As Data.DataTable = GlobalDTUsuarios(Usuario.CveUsuario)
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
'Session("Empresa") = ObjEmpresa Dim ModoSimulacion As Boolean = ADSSession.ADSSessionConfig.sessionUser.ModoSimulacion
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then Usuario.ModoSimulacion = ModoSimulacion
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados ADSSession.ADSSessionConfig.sessionUser = Usuario
ADSSession.ADSSessionConfig.sessionDpage = False
If dt IsNot Nothing Then
If dt.Rows.Count >= 1 Then
If dt.Rows.Count > 1 Then Usuario.MultipleEmpresa = True
Usuario.CvePlataforma = 6
UsuarioActual.CveEmpresa = gvr.DataKey("CveEmpresa").ToEntero()
ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.CambiarEmpresa, Nothing, UsuarioActual.CveEmpresa)
CreaObjetoEmpresa(Usuario)
'si la contraseña es la prederminada, pide la nueva contraseña
'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario.ToString), False)
RegistraScript("Ir4();")
End If
End If
dt.Dispose()
End If
Dim EmpresasFuncionalidades As New HybridDictionary
For Each Row As Data.DataRow In dttmp.Rows
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
Next
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
End If End If
UsuarioActual.Empresa = ObjEmpresa.Empresa
Else
Session("Empresa") = Nothing
End If End If
ObjEmpresa.Dispose() End Sub
Protected Sub BtnSetWindows_Click(sender As Object, e As System.EventArgs) Handles BtnSetWindows.Click
RegistraScript(String.Format("$get('tdContenido').style.height='{0}px'; $get('tdContenido').style.width='{1}px'", HdnAlto.Value.ToEntero - 30, HdnAncho.Value.ToEntero - 30))
End Sub End Sub
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
@@ -190,9 +180,35 @@ Partial Class PopUpSeleccionarEmpresa
Session("Empresa") = Nothing Session("Empresa") = Nothing
End If End If
ObjEmpresa.Dispose() ObjEmpresa.Dispose()
End Sub
Private Sub GuardaLogR(Mensaje As String)
Dim ArchivoW As IO.StreamWriter
Dim MensajeLog As String = ""
Dim continuar As Boolean = True
Try
If Not IsNothing(System.Web.HttpContext.Current) Then
If Not IsNothing(System.Web.HttpContext.Current.Request) Then
MensajeLog = $"{HttpContext.Current.Request.Url.ToString()}{Environment.NewLine}"
End If
End If
Catch
End Try
MensajeLog = $"{System.Environment.NewLine}'{DateTime.Now:dd/MM/yyyy hh:mm}' -- {MensajeLog}{Mensaje.Trim()}{Environment.NewLine}"
Try
ArchivoW = New IO.StreamWriter(String.Format("{0}\LogSession.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
Catch
Exit Sub
End Try
Try
ArchivoW.Write(MensajeLog)
Catch
End Try
ArchivoW.Close()
ArchivoW.Dispose()
End Sub End Sub
End Class End Class

View File

@@ -122,15 +122,11 @@ Partial Class Site
'2018.08.14, se movió de la linea 59 a la actual '2018.08.14, se movió de la linea 59 a la actual
CargaTipoCambio() CargaTipoCambio()
CargaUsuario()
If UsuarioActual.Portal = False Then If UsuarioActual.Portal = False Then
CreaMenu() CreaMenu()
'Configuracion() 'Configuracion()
CargaUsuario()
CargaBuscadores() CargaBuscadores()
Else
LtMasterPerfil.Text = UsuarioActual.Rol
LtMasterUsuario.Text = UsuarioActual.Usuario
End If End If
End If End If