497 lines
24 KiB
VB.net
497 lines
24 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.IO
|
|
Imports System.Security.Cryptography.X509Certificates
|
|
Imports Extensiones
|
|
'Imports Microsoft.AspNet.SignalR.Client
|
|
'Imports ChatHub
|
|
|
|
Partial Class Site
|
|
Inherits BaseMasterPage
|
|
#Region "Propiedades"
|
|
|
|
Public Overrides Property EsPopup() As Boolean
|
|
Get
|
|
Return Convert.ToBoolean(HdnEsPopup.Value)
|
|
End Get
|
|
Set(value As Boolean)
|
|
HdnEsPopup.Value = value.ToString
|
|
End Set
|
|
End Property
|
|
|
|
Public Overrides Property PopupWidth() As Integer
|
|
Get
|
|
Return HdnPopUpWidth.Value.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
HdnPopUpWidth.Value = value.ToString
|
|
End Set
|
|
End Property
|
|
Public Property userx As Usuario
|
|
Get
|
|
userx = DirectCast(ViewState("userx"), Usuario)
|
|
End Get
|
|
Set(value As Usuario)
|
|
ViewState("userx") = value
|
|
End Set
|
|
End Property
|
|
Public Property countNotificaciones As Integer
|
|
Get
|
|
countNotificaciones = If(IsNothing(ViewState("countNotificaciones")), 0, ViewState("countNotificaciones").ToString.ToEntero)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("countNotificaciones") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property UsuarioCve As Integer
|
|
Get
|
|
Return 15
|
|
End Get
|
|
Set(value As Integer)
|
|
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
|
|
MasterChat.Visible = False
|
|
|
|
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString = "true" Then EsPopup = True
|
|
If UsuarioActual IsNot Nothing Then
|
|
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString
|
|
HdnCveU.Value = UsuarioActual.CveUsuario.ToString
|
|
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
|
|
If UsuarioActual.CveUsuario = 100 Then
|
|
LitTit.Text = String.Format("<span style='color:white; font-size:x-large'></span> <span style='color: #32A1CF; font-size:x-large'>Mi Empresa de Ventas ({0})</span> ", UsuarioActual.CveEmpresa)
|
|
TxtTit.Visible = True
|
|
End If
|
|
|
|
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
|
If thisURL.Equals("WizardRegistro.aspx") OrElse thisURL.Equals("Registro.aspx") Then
|
|
LitTit.Text = "<span style='color:white; font-size:x-large'>AD</span> <span style='color: #32A1CF; font-size:x-large'> Soluciones en TI</span> "
|
|
End If
|
|
|
|
userx = New Usuario
|
|
userx.Empresa = New Empresa
|
|
userx.Referencia = Encripta(UsuarioActual.CveUsuario.ToString)
|
|
userx.Usuario = Encripta(UsuarioActual.Usuario)
|
|
userx.Liga = Encripta(UsuarioActual.Rol)
|
|
|
|
If UsuarioActual.CvePersonal > 0 Then
|
|
DivPerfil.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CveRol = 1 Then
|
|
userx.Empresa.Direccion = Encripta("-999")
|
|
userx.Empresa.Empresa = Encripta("ADSistemas")
|
|
Else
|
|
'.Empresa.Direccion = Encripta(UsuarioActual.Empresa.CveEmpresa)
|
|
'userx.Empresa.Empresa = Encripta(UsuarioActual.Empresa.Empresa)
|
|
End If
|
|
|
|
If UsuarioActual.CveRol = 1200 Then
|
|
dashboard.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CvePlataforma = 6 Or UsuarioActual.CvePlataforma = 7 Then
|
|
header_search_bar.Visible = False
|
|
header_notification_bar.Visible = False
|
|
End If
|
|
|
|
If EsPopup Then
|
|
|
|
scriptoppner.Visible = True
|
|
divMenu.Visible = False
|
|
RegistraScript("$('#barradenavegacion').css({'display':'none'})")
|
|
divContenido.Attributes.CssStyle("background") = "white"
|
|
divpagecontainer.Attributes.CssStyle("margin") = "0px !important"
|
|
headertitleh3.Attributes.CssStyle("margin") = "0px !important"
|
|
divtopmenu.Visible = False
|
|
Else
|
|
'MyChat_Init(Nothing, Nothing)
|
|
|
|
'19/05/2018 - CARGA TIPO DE CAMBIO
|
|
'2018.08.14, se movió de la linea 59 a la actual
|
|
CargaTipoCambio()
|
|
|
|
|
|
If UsuarioActual.Portal = False Then
|
|
CreaMenu()
|
|
'Configuracion()
|
|
CargaUsuario()
|
|
CargaBuscadores()
|
|
Else
|
|
LtMasterPerfil.Text = UsuarioActual.Rol
|
|
LtMasterUsuario.Text = UsuarioActual.Usuario
|
|
End If
|
|
|
|
End If
|
|
CargarNotificaciones()
|
|
Else
|
|
|
|
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
|
If thisURL.Equals("WizardRegistro.aspx") OrElse thisURL.Equals("Registro.aspx") Then
|
|
LitTit.Text = "<span style='color:white; font-size:x-large'>AD</span> <span style='color: #32A1CF; font-size:x-large'> Soluciones en TI</span> "
|
|
|
|
End If
|
|
|
|
End If
|
|
Else
|
|
'VALIDACION DE SEGURIDAD, EN LA QUE SE VALIDA QUE LA EMPRESA EN LA QUE SE GENERO LA PAGINA SEA LA MISMA A LA DE LA SESION,
|
|
'DE NO SER ASI, SE REDIRECCIONA A INICIO.
|
|
If UsuarioActual IsNot Nothing AndAlso (HdnCveE.Value <> UsuarioActual.CveEmpresa.ToString OrElse HdnCveU.Value <> UsuarioActual.CveUsuario.ToString) Then
|
|
Response.Redirect(FormsAuthentication.DefaultUrl)
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub CargaUsuario()
|
|
If UsuarioActual IsNot Nothing Then
|
|
'LtMasterNombre.Text = UsuarioActual.Nombre
|
|
LtMasterPerfil.Text = UsuarioActual.Rol
|
|
LtMasterUsuario.Text = UsuarioActual.Usuario
|
|
|
|
|
|
'DivConfiguracionEmpresa.Visible = True
|
|
' BtnConfiguracionEmpresa.Attributes.Add("onclick", String.Format("javascript:document.location.href='/Sistemas/Empresa.aspx?CveEmpresa={0}'", UsuarioActual.CveEmpresa))
|
|
BtnConfiguracionEmpresa.Visible = False
|
|
DivConfiguracionEmpresa.Visible = False
|
|
'loadchat()
|
|
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.ModoSimulacion Then
|
|
DivCambiarUsuario.Visible = True
|
|
BtnCambiarUsuario.Attributes.Add("onclick", "javascript:AbrirVentana('/Sistemas/PopUpCambiaUsuario.aspx');")
|
|
End If
|
|
If UsuarioActual.MultipleEmpresa Then
|
|
BtnCambiarEmpresa.Attributes.Add("onclick", "javascript:AbrirVentana('/Sistemas/PopUpSeleccionarEmpresa.aspx');")
|
|
DivCambiarEmpresa.Visible = True
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
'Private Sub loadchat()
|
|
|
|
' If UsuarioActual.CveRol = 1 OrElse UsuarioActual.ModoSimulacion Then
|
|
' Dim GlobalDTUsuarios As DataTable = DirectCast(Application("GlobalDTUsuarios"), DataTable)
|
|
' Dim userconectedlist As List(Of Integer) = (From c In MyHub.usuarios Select c.CveUsuario Distinct).ToList
|
|
' Dim prefix As String = ""
|
|
' Dim userstring As New StringBuilder
|
|
' For Each item As Integer In userconectedlist
|
|
' userstring.AppendFormat("{0}{1} ", prefix, item)
|
|
' prefix = ","
|
|
' Next
|
|
' stringusers = userstring.ToString
|
|
' If userconectedlist.Count > 0 Then
|
|
' GlobalDTUsuarios = GlobalDTUsuarios.FiltraParametros(String.Format("CveUsuario in ({0})", userstring))
|
|
' RptChatEmpresa.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa >1", "", {"CveEmpresa", "Empresa"})
|
|
' RptChatEmpresa.DataBind()
|
|
' End If
|
|
' MasterChat.Visible = True
|
|
|
|
' End If
|
|
'End Sub
|
|
'Private stringusers As String = "0"
|
|
'Private Sub RptChatEmpresa_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles RptChatEmpresa.ItemDataBound
|
|
' Dim CveEmpresa As Integer = e.Item.DataItem("CveEmpresa").ToString.ToEntero
|
|
' Dim GlobalDTUsuarios As DataTable = DirectCast(Application("GlobalDTUsuarios"), DataTable).FiltraParametros(String.Format("CveUsuario in ({0}) AND CveEmpresa ={1}", stringusers, CveEmpresa))
|
|
|
|
' Dim rpthijo As Repeater = DirectCast(e.Item.FindControl("RPTChatuser"), Repeater)
|
|
' rpthijo.DataSource = GlobalDTUsuarios
|
|
' rpthijo.DataBind()
|
|
'End Sub
|
|
Private Sub CargaBuscadores()
|
|
'Proveedores
|
|
If UsuarioActual.TienePermisoPagina(37) Then tdProv.Visible = True
|
|
|
|
'Clientes
|
|
If UsuarioActual.TienePermisoPagina(26) Then tdCliente.Visible = True
|
|
|
|
'Factura de Ventas
|
|
If UsuarioActual.TienePermisoPagina(6) Then tdVentas.Visible = True
|
|
|
|
'Personal
|
|
If UsuarioActual.TienePermisoPagina(46) Then tdPersonal.Visible = True
|
|
|
|
'Buscar Productos servicios
|
|
If UsuarioActual.TienePermisoPagina(13) Then tdBuscarPs.Visible = True
|
|
|
|
'Compras
|
|
If UsuarioActual.TienePermisoPagina(38) Then tdCompras.Visible = True
|
|
|
|
'Ordenes Servicio
|
|
If UsuarioActual.TienePermisoPagina(135) Then tdOS.Visible = True
|
|
|
|
'Ingresos / Egresos
|
|
If UsuarioActual.TienePermisoPagina(153) Then tdCheques.Visible = True
|
|
|
|
'Órdenes de Compra
|
|
If UsuarioActual.TienePermisoPagina(103) Then tdOC.Visible = True
|
|
|
|
'Cuando es Requisición
|
|
If UsuarioActual.TienePermisoPagina(250) Then tdOC.Visible = True
|
|
|
|
'Inventarios Movimientos
|
|
If UsuarioActual.TienePermisoPagina(219) Then TdMovInv.Visible = True
|
|
|
|
'Prospectos
|
|
If UsuarioActual.TienePermisoPagina(181) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx',980,547,'popBuscarProspectos');")
|
|
'ProspectosRedes
|
|
If UsuarioActual.TienePermisoPagina(183) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=Redes',980,547,'popBuscarProspectos');")
|
|
'ProspectosG15
|
|
If UsuarioActual.TienePermisoPagina(187) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=Atn',980,547,'popBuscarProspectos');")
|
|
'ProspectosSIP
|
|
If UsuarioActual.TienePermisoPagina(207) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=SIP',980,547,'popBuscarProspectos');")
|
|
|
|
If UsuarioActual.TienePermisoPagina(392) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospeccion/PopUpBuscarProspectos.aspx',980,547,'popBuscarProspectos');")
|
|
|
|
If UsuarioActual.TienePermisoPagina(228) Then tdBExi.Visible = True
|
|
|
|
'Contratos
|
|
If UsuarioActual.TienePermisoPagina(313) Then TdContratos.Visible = True
|
|
|
|
|
|
'BUSCAR MILITANTE
|
|
If UsuarioActual.TienePermisoPagina(1001) Then tdBuscarMilitante.Visible = True
|
|
|
|
'Orden Produccion'
|
|
If UsuarioActual.TienePermisoPagina(816) Then tdOP.Visible = True
|
|
|
|
'Produccion'
|
|
If UsuarioActual.TienePermisoPagina(823) Then tdP.Visible = True
|
|
|
|
'BUSCAR ACERCAMIENTO CRM'
|
|
If UsuarioActual.TienePermisoProceso(251) Then TdCRMAcercamientos.Visible = True
|
|
|
|
End Sub
|
|
|
|
Protected Sub CerrarSesion_Click(sender As Object, e As EventArgs) Handles BtnCerrarSesion.ServerClick
|
|
|
|
'If Request.ServerVariables("URL").ToUpper.Contiene("/PortalCliente/PortalCliente.aspx".ToUpper) Then
|
|
' UsuarioActual.CerrarSession(1)
|
|
'ElseIf Request.ServerVariables("URL").ToUpper.Contiene("/PortalProveedores/PortalProveedor.aspx".ToUpper) Then
|
|
' UsuarioActual.CerrarSession(2)
|
|
'Else
|
|
'MyHub.RemoveConexiones(UsuarioActual.CveUsuario)
|
|
Usuario.CerrarSession()
|
|
'End If
|
|
|
|
'UsuarioActual.Dispose()
|
|
End Sub
|
|
|
|
'Private Sub Configuracion()
|
|
' Dim dt As New DataTable
|
|
' dt.ReadXml(String.Format("{0}\Menu\ERP\{1}_Conf.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
|
|
'End Sub
|
|
|
|
Private Sub CreaMenu()
|
|
Dim dt As New DataTable
|
|
|
|
If UsuarioActual.CveRol = 1200 Then
|
|
dt.ReadXml(String.Format("{0}\Menu\GPS\{1}.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
Else
|
|
dt.ReadXml(String.Format("{0}\Menu\ERP\{1}.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
End If
|
|
|
|
Dim Inicio = From i In dt.AsEnumerable Where i!CvePadre.Equals(0) Order By i!Orden
|
|
Dim CveModuloPadre, CveModuloPadreSeleccionado, CveModuloHijoSeleccionado, CveModuloNietoSeleccionado As Integer
|
|
Dim CveModulo As Integer = CveModulomasterpage.Text.ToEntero
|
|
Dim ScriptColorGrupoModulo As String = ""
|
|
Dim LinkBase = "javascript:;"
|
|
Dim HeaderBar As New StringBuilder("<li><i class='fa fa-home'></i><a href='/Inicio.aspx'>Inicio</a>")
|
|
Dim LinkPadre = ""
|
|
Dim Linkpapa As String = ""
|
|
Dim LinkHijo = ""
|
|
Dim Linkson As String = ""
|
|
Dim LinkNieto = ""
|
|
Dim ClassActive As String
|
|
CveModuloPadreSeleccionado = 0 : CveModuloHijoSeleccionado = 0 : CveModuloNietoSeleccionado = 0
|
|
Dim MenuHTML As New StringBuilder
|
|
For Each drP As DataRow In Inicio
|
|
CveModuloPadre = drP("CveModulo").ToString.ToEntero
|
|
LinkPadre = drP("LIGA").ToString
|
|
If drP("PopUp").ToString = "S" Then LinkPadre = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drP("LIGA"), drP("ANCHO"), drP("ALTO"))
|
|
|
|
Dim Hijos = From h In dt.AsEnumerable Where h!CvePadre.Equals(CveModuloPadre) Order By h!Orden
|
|
If CveModulo = drP("CveModulo").ToString.ToEntero Then
|
|
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i></li> <li><a href='{0}'>{1}</a>", LinkPadre, drP("Modulo").ToString)
|
|
ScriptColorGrupoModulo = ColorPage(drP("CveGrupoModulo").ToString.ToEntero)
|
|
End If
|
|
If Hijos.Count > 0 Then
|
|
Linkpapa = LinkPadre
|
|
LinkPadre = LinkBase
|
|
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}<span class='title'>{1}</span><span id='j{3}' ></span><span class='arrow '></span></a><ul class='sub-menu'>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""), drP("CveModulo"))
|
|
For Each drH As DataRow In Hijos
|
|
Dim CveModuloHijo As Integer = drH("CveModulo").ToString.ToEntero
|
|
LinkHijo = drH("LIGA").ToString
|
|
If CveModulo = drH("CveModulo").ToString.ToEntero Then
|
|
CveModuloPadreSeleccionado = CveModuloPadre
|
|
ClassActive = "class='active'"
|
|
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a>", Linkpapa, drP("Modulo").ToString, LinkHijo, drH("Modulo").ToString)
|
|
ScriptColorGrupoModulo = ColorPage(drH("CveGrupoModulo").ToString.ToEntero)
|
|
Else
|
|
|
|
ClassActive = ""
|
|
End If
|
|
If drH("PopUp").ToString = "S" Then LinkHijo = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drH("LIGA"), drH("ANCHO"), drH("ALTO"))
|
|
|
|
Dim Nietos = From h In dt.AsEnumerable Where h!CvePadre.Equals(CveModuloHijo) Order By h!Orden
|
|
If Nietos.Count > 0 Then
|
|
Linkson = LinkHijo
|
|
LinkHijo = LinkBase
|
|
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}{1}<span class='arrow '></span> </a><ul class='sub-menu'>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), drH("CveModulo"))
|
|
For Each drN As DataRow In Nietos
|
|
LinkNieto = drN("LIGA").ToString
|
|
If CveModulo = drN("CveModulo").ToString.ToEntero Then
|
|
CveModuloPadreSeleccionado = CveModuloPadre : CveModuloHijoSeleccionado = CveModuloHijo
|
|
ClassActive = "class='active'"
|
|
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{4}'>{5}</a>", Linkpapa, drP("Modulo").ToString, Linkson, drH("Modulo").ToString, LinkNieto, drN("Modulo"))
|
|
ScriptColorGrupoModulo = ColorPage(drN("CveGrupoModulo").ToString.ToEntero)
|
|
Else
|
|
ClassActive = ""
|
|
End If
|
|
If drN("PopUp").ToString = "S" Then LinkNieto = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drN("LIGA"), drN("ANCHO"), drN("ALTO"))
|
|
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkNieto, drN("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drN("Estilo")), ""), ClassActive)
|
|
Next
|
|
MenuHTML.AppendFormat("</ul></li>")
|
|
Else
|
|
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), ClassActive)
|
|
End If
|
|
Next
|
|
MenuHTML.AppendFormat("</ul></li>")
|
|
Else
|
|
MenuHTML.AppendFormat("<li><a href=""{0}"">{2}<span class='title'>{1}</span></a></li>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""))
|
|
End If
|
|
Next
|
|
|
|
If CveModuloPadreSeleccionado > 0 Then
|
|
MenuHTML = MenuHTML.Replace(String.Format("id='m{0}'", CveModuloPadreSeleccionado), String.Format("id='m{0}' class='active open'", CveModuloPadreSeleccionado))
|
|
MenuHTML = MenuHTML.Replace(String.Format("id='j{0}'", CveModuloPadreSeleccionado), String.Format("id='j{0}' class='selected'", CveModuloPadreSeleccionado))
|
|
Else
|
|
End If
|
|
If CveModuloHijoSeleccionado > 0 Then
|
|
MenuHTML = MenuHTML.Replace(String.Format("id='m{0}'", CveModuloHijoSeleccionado), String.Format("id='m{0}' class='open'", CveModuloHijoSeleccionado))
|
|
MenuHTML = MenuHTML.Replace(String.Format("id='j{0}'", CveModuloHijoSeleccionado), String.Format("id='j{0}' class='selected'", CveModuloHijoSeleccionado))
|
|
End If
|
|
HeaderBar.AppendFormat("</li>{0}", ScriptColorGrupoModulo)
|
|
BarraNavegacion.Text = HeaderBar.ToString
|
|
CargaMenu(MenuHTML)
|
|
End Sub
|
|
|
|
|
|
Private Function ColorPage(value As Integer) As String
|
|
|
|
Select Case value
|
|
Case 1
|
|
Return "<script>$('body').addClass('ventasbody')</script>"
|
|
Case 2
|
|
Return "<script>$('body').addClass('comprasbody')</script>"
|
|
Case 3
|
|
Return "<script>$('body').addClass('bancosbody')</script>"
|
|
Case 4
|
|
Return "<script>$('body').addClass('ocomprabody')</script>"
|
|
Case 5
|
|
Return "<script>$('body').addClass('inventariosbody')</script>"
|
|
Case 6
|
|
Return "<script>$('body').addClass('oserviciobody')</script>"
|
|
Case 7
|
|
Return "<script>$('body').addClass('oibody')</script>"
|
|
Case 8
|
|
Return "<script>$('body').addClass('contabilidadbody')</script>"
|
|
Case 9
|
|
Return "<script>$('body').removeClass('rhumanosbody').addClass('rhumanosbody')</script>"
|
|
Case 10
|
|
Return "<script>$('body').addClass('afijosbody')</script>"
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Function
|
|
|
|
Private Sub CargaMenu(Texto As StringBuilder)
|
|
Menu.Text = Texto.ToString
|
|
End Sub
|
|
|
|
#Region "Notificaciones"
|
|
|
|
Private Sub CargarNotificaciones()
|
|
Dim Notificaciones As New StringBuilder
|
|
|
|
'Bienvenida
|
|
Notificaciones.Append(ItemNotificaciones("Bienvenido a SIG ", "Hoy", "fa fa-bullhorn"))
|
|
|
|
'Certificado
|
|
Dim fechacer As String = ConvertCER()
|
|
If fechacer = "" OrElse (((DateTime.Parse(fechacer).Month - Now.Month) < 2) AndAlso ((DateTime.Parse(fechacer).Year - Now.Year) < 1)) Then
|
|
Notificaciones.Append(ItemNotificaciones("Su certificado expira en: ", fechacer, Tipo:="warning"))
|
|
countNotificaciones = countNotificaciones + 1
|
|
Else
|
|
Notificaciones.Append(ItemNotificaciones("Su certificado expira en: ", fechacer))
|
|
End If
|
|
|
|
'C A R G A - A L E R T A S - O R D E N E S D E C O M P R A
|
|
If UsuarioActual.CveUsuario = 1459 Then
|
|
Dim OC As New ClsOC
|
|
If OC.GetOrdenesPendientes("-1", 0, UsuarioActual.CveEmpresa, -1, -1, -1, UsuarioActual.CveUsuario, -1) Then
|
|
If (OC.DtResultados.Rows.Count > 0) Then
|
|
Notificaciones.Append(ItemNotificaciones(String.Format("Orden de Compra por atender {0}", OC.DtResultados.Rows.Count), Ico:="fa fa-tags", Tipo:="warning", Link:="/OC/RepOC.aspx"))
|
|
countNotificaciones = countNotificaciones + 1
|
|
End If
|
|
End If
|
|
OC.Dispose()
|
|
End If
|
|
|
|
|
|
''OC Pendientes por atender
|
|
'Dim OC As New ClsOC
|
|
'If OC.GetOrdenesPendientes("-1", 0, UsuarioActual.CveEmpresa, -1, -1, -1, UsuarioActual.CveUsuario, -1) Then
|
|
' Notificaciones.Append(ItemNotificaciones(String.Format("REQ/OC por atender: <b>{0}</b>", OC.DtResultados.Rows.Count), Tipo:=If(OC.DtResultados.Rows.Count > 3, "warning", "info"), Link:="/OC/RepOC.aspx"))
|
|
' If OC.DtResultados.Rows.Count > 0 Then
|
|
' countNotificaciones = countNotificaciones + 1
|
|
' End If
|
|
'End If
|
|
'OC.Dispose()
|
|
|
|
LtlMNotificaciones.Text = LtlMNotificaciones.Text & Notificaciones.ToString
|
|
End Sub
|
|
|
|
|
|
Private Function ConvertCER() As String
|
|
Try
|
|
Dim Archivo As String = String.Format("{0}Empresas\{1}\Certificados\{2}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.ArchivoCer)
|
|
If File.Exists(Archivo) Then
|
|
Dim CerFile As New FileStream(Archivo, FileMode.Open, FileAccess.Read)
|
|
Dim Size As Integer = CerFile.Length.ToString.ToEntero()
|
|
Dim Data As Byte() = New Byte(Size - 1) {}
|
|
Size = CerFile.Read(Data, 0, Size)
|
|
CerFile.Close()
|
|
CerFile.Dispose()
|
|
|
|
Dim x509 As New X509Certificate2()
|
|
x509.Import(Data)
|
|
Return x509.NotAfter.ToShortDateString()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return ""
|
|
End Try
|
|
Return ""
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "TIPO DE CAMBIO"
|
|
Private Sub CargaTipoCambio()
|
|
Dim ObjGenerales As ClsGenerales = New ClsGenerales
|
|
If ObjGenerales.GetTipoCambio(-1, DateTime.Now) And ObjGenerales.DtResultados.Rows.Count > 0 Then
|
|
lblTipoCambio.Text = String.Format(" | TC {0:C4}", ObjGenerales.DtResultados(0)("TipoCambio").ToString().ToDecimal())
|
|
End If
|
|
ObjGenerales.Dispose()
|
|
End Sub
|
|
#End Region
|
|
End Class |