Ejemplo n.º 1
0
 //Método de prueba borrar al final
 public void InicializarConfiguracionPrueba()
 {
     this.presentador = new MasterPagePRE(this);
     this.presentador.ObtenerDatosDeConexion();
     if (this.Ambiente == null)
     {
         this.ltEstilo.Text = "<link href='" + this.ResolveUrl("~/Contenido/Estilos/EstiloDesarrollo.css") + "' rel='Stylesheet' type='text/css'/>";
     }
     else
     {
         this.ltEstilo.Text = "<link rel='stylesheet' type='text/css' href='" + this.ResolveUrl("~/Contenido/Estilos/" + this.Ambiente + ".css") + "'/>";
     }
     if (this.Usuario != null && this.Usuario.Usuario != null)
     {
         this.lblNombre.Text = this.Usuario.Usuario.Trim();
     }
     else
     {
         this.lblNombre.Text = "";
     }
     if (this.Adscripcion != null)
     {
         if (this.Adscripcion.UnidadOperativa != null)
         {
             this.lblAdscripcion.Text = this.Adscripcion.UnidadOperativa.Nombre;
         }
         if (this.Adscripcion.Sucursal != null)
         {
             this.lblAdscripcion.Text += " | " + this.Adscripcion.Sucursal.Nombre;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Método manejador del evento load de la master principal
 /// </summary>
 /// <param name="sender">Representa el objeto sobre el cual se esta trabajando</param>
 /// <param name="e">Representa un objeto de tipo EventArgs</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         this.AsignarMenuSeleccionado();
         this.VerificaSession();
         this.VerificarCambioAdscripcion();
         this.LeerYSubirNumeroFilas();
         if (this.Usuario != null && this.ListadoDatosConexion != null && this.ListadoDatosConexion.Count > 0)
         {
             this.EvitarCache();
             this.presentador = new MasterPagePRE(this);
             if (!IsPostBack)
             {
                 hdnIniContFinSession.Value = (int.Parse(ConfigurationManager.AppSettings["timeoutIniContador"].ToString()) * 60).ToString();
                 this.Session.Remove("ProcesoSeleccionado");
                 if (bool.Parse(this.hdnMostrarMenu.Value))
                 {
                     if (this.ListadoProcesos == null)
                     {
                         this.presentador.ObtenerProcesos();
                     }
                     else
                     {
                         this.CargarProcesos();
                     }
                 }
             }
         }
         else
         {
             //Checar este código al final, sustituir la ubicación de la página de login
             this.Response.Redirect(this.Logueo);
         }
     }
     catch (Exception)
     {
         this.MostrarMensaje("Error inesperado", ETipoMensajeIU.ERROR, "Surgió un error inesperado, por favor contacte a su administrador de sistemas.");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Inicializa las variables de configuración del sistema
        /// </summary>
        private void InicializarConfiguracion()
        {
            try
            {
                //Conexiones
                if (this.ListadoDatosConexion == null)
                {
                    this.presentador = new MasterPagePRE(this);
                    this.presentador.ObtenerDatosDeConexion();
                }

                //Asignación de estilos con base en la configuración del módulo y el ambiente
                if (this.Ambiente == null)
                {
                    this.ltEstilo.Text = "<link href='" + this.DireccionCSS + "EstiloDesarrollo.css" + "' rel='Stylesheet' type='text/css'/>";
                }
                else
                {
                    this.ltEstilo.Text = "<link rel='stylesheet' type='text/css' href='" + this.DireccionCSS + this.Ambiente + ".css" + "'/>";
                }

                //Asignación del logo del sistema
                this.imgLogo.ImageUrl = this.URLLogoEmpresa;

                //Asignación del nombre del sistema
                this.ltTitle.Text = this.NombreSistema;

                //Asignación de información de logueo
                if (this.Usuario != null)
                {
                    string id = this.Usuario.Id != null?this.Usuario.Id.ToString() : "";

                    string nombreUsuario = this.Usuario.Usuario;
                    if (string.IsNullOrEmpty(id))
                    {
                        throw new NullReferenceException("Usuario no válido");
                    }
                    else
                    {
                        this.lblNombre.Text = this.Usuario.Usuario;
                    }
                }
                else
                {
                    this.lblNombre.Text = "";
                }

                //Asignación de información de la adscripción
                if (this.Adscripcion != null)
                {
                    this.lblAdscripcion.Text = this.Adscripcion.UnidadOperativa.Nombre;
                    if (this.Adscripcion.Sucursal != null)
                    {
                        this.lblAdscripcion.Text += " | " + this.Adscripcion.Sucursal.Nombre;
                    }
                }
            }
            catch (Exception ex)
            {
                this.MostrarMensaje("No se pudo inicializar la configuración correctamente", ETipoMensajeIU.ERROR, ex.Message);
            }
        }