Cambio entre portales (portal del proveedor)
This commit is contained in:
@@ -416,7 +416,7 @@ Public Class ClsSisUsuarios
|
||||
End Function
|
||||
|
||||
|
||||
Public Function ValidaUsuarioPortalCliente(Clave As String, Usuario As String, Password As String) As Usuario
|
||||
Public Function ValidaUsuarioPortalCliente(CveCliente As Integer, Usuario As String, Password As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
@@ -442,7 +442,7 @@ Public Class ClsSisUsuarios
|
||||
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.CveCliente = CveCliente
|
||||
Retorno.ClienteGPS = False
|
||||
Retorno.Portal = True
|
||||
Retorno.Referencia = Data.Rows(0)("Referencia").ToString
|
||||
@@ -473,6 +473,64 @@ Public Class ClsSisUsuarios
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioPortalProveedor(CveProveedor As Integer, 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.CveProveedor = CveProveedor
|
||||
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.CveProveedor)
|
||||
|
||||
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"
|
||||
Public Function getUsuarioIndicadores(_CveUsuario As Integer, _CveEmpresa As Integer, _CveRol As Integer) As DataTable
|
||||
@@ -2740,6 +2798,30 @@ Public Class ClsSisUsuarios
|
||||
.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 el acceso a clientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddUsuarioProveedor(CveUsuario As Integer, CveProveedor As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Sis_UsuariosProveedoresAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
@@ -2755,6 +2837,29 @@ Public Class ClsSisUsuarios
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GetUsuarioProveedor(CveUsuario As Integer, CveProveedor As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Sis_UsuariosProveedorGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
|
||||
.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 obtener el acceso a proveedores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -371,7 +371,8 @@ Partial Class Sistemas_PopUpAddUsuario
|
||||
' Return
|
||||
'End If
|
||||
|
||||
If UsuarioActual.Empresa.CvePlataforma = 1 Then
|
||||
'SI ES UN USUARIO DEL ERP, DEBE DARLE ACCESO AL CLIENTE
|
||||
If UsuarioActual.Empresa.CvePlataforma = 1 AndAlso CveCliente > 0 Then
|
||||
Dim DtClientesAcceso As DataTable = Nothing
|
||||
If Not HuboError AndAlso ObjUsuarios.GetUsuarioCliente(CveUsuario, CveCliente) Then
|
||||
'DEBE AGREGAR EL USUARIO AL CLIENTE
|
||||
@@ -383,6 +384,19 @@ Partial Class Sistemas_PopUpAddUsuario
|
||||
Else
|
||||
HuboError = True
|
||||
End If
|
||||
'SI ES UN USUARIO DEL ERP, DEBE DARLE ACCESO AL PROVEEDOR
|
||||
ElseIf UsuarioActual.Empresa.CvePlataforma = 1 AndAlso CveProveedor > 0 Then
|
||||
Dim DtProveedoresAcceso As DataTable = Nothing
|
||||
If Not HuboError AndAlso ObjUsuarios.GetUsuarioProveedor(CveUsuario, CveProveedor) Then
|
||||
'DEBE AGREGAR EL USUARIO AL PROVEEDOR
|
||||
If ObjUsuarios.DtResultados.Rows.Count = 0 Then
|
||||
If Not HuboError AndAlso Not ObjUsuarios.AddUsuarioProveedor(CveUsuario, CveProveedor) 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
|
||||
HuboError = True
|
||||
|
||||
@@ -75,6 +75,20 @@
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:GridView ID="GvPortalProveedor" runat="server" DataKeyNames="CveUsuario, CveProveedor, Contraseña, Usuario, CveEmpresa" AutoGenerateColumns="false" ShowHeaderWhenEmpty="false"
|
||||
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">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>Portal del Proveedor</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkEmp" runat="server" CssClass="Texto" Text='<%# Eval("ProveedorEmpresa")%>' CommandArgument='<%# Eval("CveProveedor") %>' CommandName="Cambia"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Left" />
|
||||
<HeaderStyle HorizontalAlign="Left" />
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
@@ -110,6 +124,9 @@
|
||||
function Ir4() {
|
||||
gotourl('/PortalCliente/PortalCliente.aspx');
|
||||
}
|
||||
function Ir5() {
|
||||
gotourl('/PortalProveedor/PortalProveedor.aspx');
|
||||
}
|
||||
|
||||
function buscarDT() {
|
||||
$('.TxtBusqueda').on('keyup', function () {
|
||||
|
||||
@@ -12,8 +12,6 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CType(Me.Master, BaseMasterPage).EsPopup = True
|
||||
'CType(Me.Master, BaseMasterPage).PopupWidth = HdnAncho.Value.ToEntero
|
||||
'RegistraScript("alertSize();")
|
||||
GetEmpresas()
|
||||
End If
|
||||
End Sub
|
||||
@@ -26,10 +24,14 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
LtlTotalRegistros.Text = Dt.Rows.Count.ToString.FormatoNumero(0)
|
||||
GvEmpresas.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS 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")
|
||||
GvPortalCliente.DataSource = Dt.FiltraParametros("CvePlataforma = 6 AND CveCliente IS NOT NULL", "Empresa")
|
||||
GvPortalProveedor.DataSource = Dt.FiltraParametros("CvePlataforma = 7 AND CveProveedor IS NOT NULL", "Empresa")
|
||||
Else
|
||||
LtlTotalRegistros.Text = "0"
|
||||
GvEmpresas.DataSource = Nothing
|
||||
GvPortalRastreo.DataSource = Nothing
|
||||
GvPortalCliente.DataSource = Nothing
|
||||
GvPortalProveedor.DataSource = Nothing
|
||||
Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
@@ -37,6 +39,7 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
GvEmpresas.DataBind()
|
||||
GvPortalRastreo.DataBind()
|
||||
GvPortalCliente.DataBind()
|
||||
GvPortalProveedor.DataBind()
|
||||
|
||||
UPDatos.Update()
|
||||
|
||||
@@ -116,7 +119,6 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
|
||||
End If
|
||||
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)
|
||||
@@ -125,7 +127,7 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario = Nothing
|
||||
Usuario = ObjUsuario.ValidaUsuarioPortalCliente(gvr.DataKey("CveCliente"), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"))
|
||||
Usuario = ObjUsuario.ValidaUsuarioPortalCliente(gvr.DataKey("CveCliente").ToEntero(), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"))
|
||||
|
||||
ObjUsuario.Dispose()
|
||||
|
||||
@@ -155,7 +157,48 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
End Sub
|
||||
Protected Sub GvPortalProveedor_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GvPortalProveedor.RowCommand
|
||||
If e.CommandName = "Cambia" Then
|
||||
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
|
||||
|
||||
If gvr IsNot Nothing Then
|
||||
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario = Nothing
|
||||
Usuario = ObjUsuario.ValidaUsuarioPortalProveedor(gvr.DataKey("CveProveedor").ToEntero(), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"))
|
||||
|
||||
ObjUsuario.Dispose()
|
||||
|
||||
If Usuario IsNot Nothing Then
|
||||
Dim dt As Data.DataTable = GlobalDTUsuarios(Usuario.CveUsuario)
|
||||
|
||||
Dim ModoSimulacion As Boolean = ADSSession.ADSSessionConfig.sessionUser.ModoSimulacion
|
||||
Usuario.ModoSimulacion = ModoSimulacion
|
||||
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 = 7
|
||||
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("Ir5();")
|
||||
End If
|
||||
End If
|
||||
dt.Dispose()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "F U N C I O N E S"
|
||||
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
|
||||
@@ -181,8 +224,6 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GuardaLogR(Mensaje As String)
|
||||
Dim ArchivoW As IO.StreamWriter
|
||||
Dim MensajeLog As String = ""
|
||||
@@ -209,6 +250,7 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
End Try
|
||||
ArchivoW.Close()
|
||||
ArchivoW.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user