Example #1
0
        public clsCache RecuperarXML(string idSession)
        {
            clsCache objCache = new clsCache();

            try
            {
                string FileCache  = "Cache_" + idSession;
                string strPathXML = clsValidaciones.CacheTempCrea();

                if (File.Exists(strPathXML + FileCache + ".xml"))
                {
                    TextReader txtReader = new StreamReader(strPathXML + FileCache + ".xml");

                    XmlSerializer SerializerRS = new XmlSerializer(typeof(clsCache));

                    objCache = (clsCache)SerializerRS.Deserialize(txtReader);
                    HttpContext.Current.Session["SessionIDLocal"] = idSession;
                    HttpContext.Current.Session["SessionID"]      = idSession;

                    txtReader.Close();
                    txtReader.Dispose();
                    GuardaSesion(idSession);
                }
            }
            catch
            { objCache = null; }
            return(objCache);
        }
Example #2
0
        public clsCache cCache(Page PageActual)
        {
            clsCacheControl cCacheControl = new clsCacheControl();
            clsCache        cCache        = new clsCache();

            cCache = clsSesiones.getCache(PageActual);
            string sSesion = null;

            if (cCache != null)
            {
                cCacheControl.GuardaSesion(sSesion);
            }
            else
            {
                sSesion = cCacheControl.RecuperarSesionId(PageActual);
                if (sSesion != null)
                {
                    cCache = cCacheControl.RecuperarSesion(sSesion);
                }
                else
                {
                    cCache = null;
                }
            }
            return(cCache);
        }
Example #3
0
 public static void ActualizarCache(clsCache cCache)
 {
     try
     {
         clsCacheControl cCacheControl = new clsCacheControl();
         cCacheControl.ActualizaXML(cCache);
     }
     catch (Exception Ex)
     {
         clsParametros cParametros = new clsParametros();
         cParametros.Id       = 0;
         cParametros.Message  = Ex.Message.ToString();
         cParametros.Tipo     = clsTipoError.Library;
         cParametros.Severity = clsSeveridad.Moderada;
         try
         {
             cParametros.Source      = Ex.Source.ToString();
             cParametros.StackTrace  = Ex.StackTrace.ToString();
             cParametros.Complemento = Ex.TargetSite.Module.Name.ToString();
             cParametros.Metodo      = System.Reflection.MethodInfo.GetCurrentMethod().Name;
             cParametros.TargetSite  = Ex.TargetSite.Name.ToString();
         }
         catch { }
         cParametros.Info = "Actualizar cache";
         ExceptionHandled.Publicar(cParametros);
     }
 }
Example #4
0
        public clsCache cCache()
        {
            clsCacheControl cCacheControl = new clsCacheControl();
            Page            PageActual    = null;

            if (HttpContext.Current.Handler is Page)
            {
                PageActual = HttpContext.Current.Handler as Page;
            }

            string   sSesion = null;
            clsCache cCache  = new clsCache();

            if (PageActual != null)
            {
                cCache = clsSesiones.getCache(PageActual);
            }
            else
            {
                sSesion = cCacheControl.RecuperarSesionId();
                if (sSesion != null)
                {
                    cCache = cCacheControl.RecuperarSesion(sSesion);
                    cCacheControl.GuardaSesion(sSesion);
                }
                else
                {
                    cCache = null;
                }
            }
            return(cCache);
        }
Example #5
0
 public static void IniciaProyecto(clsCache cCache)
 {
     try
     {
         clsSesiones.CLEAR_SESSION_PROYECTO();
     }
     catch { }
 }
Example #6
0
        public clsCache RecuperarSesion(string SesionId)
        {
            clsCache cCache = null;

            try { cCache = RecuperarXML(SesionId); }
            catch { }
            return(cCache);
        }
        public clsCache CargarXML(string idSession)
        {
            clsCache objCache = new clsCache();

            if (HttpContext.Current.Session["Contacto"] != null)
            {
                objCache.Contacto = HttpContext.Current.Session["Contacto"].ToString();
            }
            if (HttpContext.Current.Session["Nombre"] != null)
            {
                objCache.Nombre = HttpContext.Current.Session["Nombre"].ToString();
            }
            if (HttpContext.Current.Session["User"] != null)
            {
                objCache.User = HttpContext.Current.Session["User"].ToString();
            }
            if (HttpContext.Current.Session["Nivel"] != null)
            {
                objCache.Nivel = HttpContext.Current.Session["Nivel"].ToString();
            }
            if (HttpContext.Current.Session["Pass"] != null)
            {
                objCache.Pass = HttpContext.Current.Session["Pass"].ToString();
            }
            if (HttpContext.Current.Session["Pagina"] != null)
            {
                objCache.Pagina = HttpContext.Current.Session["Pagina"].ToString();
            }
            if (HttpContext.Current.Session["Idioma"] != null)
            {
                objCache.Idioma = HttpContext.Current.Session["Idioma"].ToString();
            }
            if (HttpContext.Current.Session["Cultura"] != null)
            {
                objCache.Cultura = HttpContext.Current.Session["Cultura"].ToString();
            }
            objCache.SessionID = idSession;

            string pathXML = clsValidaciones.CacheTempCrea();

            XmlSerializer SerializerRQ = new XmlSerializer(typeof(clsCache));
            StreamWriter  WriterRQ     = new StreamWriter(pathXML + idSession + ".xml");

            SerializerRQ.Serialize(WriterRQ, objCache);
            WriterRQ.Close();

            return(objCache);
        }
Example #8
0
        public clsCache ActualizaXML(clsCache objCache)
        {
            string FileCache = "Cache_" + objCache.SessionID.ToString();

            string strPathXML = clsValidaciones.CacheTempCrea();

            try
            {
                XmlSerializer SerializerRQ = new XmlSerializer(typeof(clsCache));
                StreamWriter  WriterRQ     = new StreamWriter(strPathXML + FileCache + ".xml");
                SerializerRQ.Serialize(WriterRQ, objCache);
                WriterRQ.Flush();
                WriterRQ.Close();
                clsSesiones.setCache(objCache);
                clsSesiones.setSesionIDLocal(objCache.SessionID.ToString());
            }
            catch { }
            GuardaSesion(objCache.SessionID.ToString());
            return(objCache);
        }
        public void RecuperarXML(string idSession)
        {
            string strPathXML = clsValidaciones.CacheTempCrea();

            TextReader txtReader = new StreamReader(strPathXML + idSession + ".xml");

            XmlSerializer SerializerRS = new XmlSerializer(typeof(clsCache));

            clsCache objCache = (clsCache)SerializerRS.Deserialize(txtReader);

            HttpContext.Current.Session["Nombre"]         = objCache.Nombre.ToString();
            HttpContext.Current.Session["Contacto"]       = objCache.Contacto.ToString();
            HttpContext.Current.Session["User"]           = objCache.User.ToString();
            HttpContext.Current.Session["Nivel"]          = objCache.Nivel.ToString();
            HttpContext.Current.Session["Pass"]           = objCache.Pass.ToString();
            HttpContext.Current.Session["Pagina"]         = objCache.Pagina.ToString();
            HttpContext.Current.Session["Idioma"]         = objCache.Idioma.ToString();
            HttpContext.Current.Session["Cultura"]        = objCache.Cultura.ToString();
            HttpContext.Current.Session["SessionIDLocal"] = objCache.SessionID.ToString();
        }