Cambio entre portales (portal del cliente)
This commit is contained in:
@@ -19,30 +19,31 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
End Sub
|
||||
|
||||
Private Sub GetEmpresas()
|
||||
|
||||
|
||||
Dim Dt As Data.DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario)
|
||||
|
||||
If Dt IsNot Nothing Then
|
||||
If Dt.Rows.Count > 0 Then
|
||||
LtlTotalRegistros.Text = Dt.Rows.Count.ToString.FormatoNumero(0)
|
||||
GV.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")
|
||||
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")
|
||||
Else
|
||||
LtlTotalRegistros.Text = "0"
|
||||
GV.DataSource = Nothing
|
||||
GvEmpresas.DataSource = Nothing
|
||||
Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
GV.DataBind()
|
||||
GVCliente.DataBind()
|
||||
GvEmpresas.DataBind()
|
||||
GvPortalRastreo.DataBind()
|
||||
GvPortalCliente.DataBind()
|
||||
|
||||
UPDatos.Update()
|
||||
|
||||
TblBusqueda.Visible = True
|
||||
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
|
||||
|
||||
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
|
||||
@@ -80,35 +81,7 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
End If
|
||||
|
||||
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
|
||||
Protected Sub gvUsuarios_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GVCliente.RowCommand
|
||||
Protected Sub GvPortalRastreo_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GvPortalRastreo.RowCommand
|
||||
If e.CommandName = "Cambia" Then
|
||||
Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow)
|
||||
|
||||
@@ -142,32 +115,49 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
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
|
||||
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
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario = Nothing
|
||||
Usuario = ObjUsuario.ValidaUsuarioPortalCliente(gvr.DataKey("CveCliente"), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"))
|
||||
|
||||
ObjUsuario.Dispose()
|
||||
|
||||
Private Sub CreaObjetoEmpresa()
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
'Session("Empresa") = ObjEmpresa
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
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 = 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
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
Else
|
||||
Session("Empresa") = Nothing
|
||||
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
|
||||
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
@@ -190,9 +180,35 @@ Partial Class PopUpSeleccionarEmpresa
|
||||
Session("Empresa") = Nothing
|
||||
End If
|
||||
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 Class
|
||||
Reference in New Issue
Block a user