Exemplo n.º 1
0
        public Usuario Detalles(int Id_User)
        {
            Usuario user = null;

            try
            {
                string nombreCache = string.Format("user{0}", Id_User);

                if (!CacheData.Exist(nombreCache))
                {
                    UsuarioDAL model = new UsuarioDAL(_connectionString);

                    var userDAL = model.Detalles(Id_User);

                    user = Converter.ConvertToBL(userDAL);

                    CacheData.Add(nombreCache, user);
                }
                else
                {
                    user = (Usuario)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("Detalles()", ex);
            }

            return(user);
        }
Exemplo n.º 2
0
        public Usuario GetUserByIdentityCode(string identityCode)
        {
            Usuario user = null;

            try
            {
                string nombreCache = string.Format("user_identitycode{0}", identityCode);

                if (!CacheData.Exist(nombreCache))
                {
                    UsuarioDAL model = new UsuarioDAL(_connectionString);

                    var userDAL = model.GetUserByIdentityCode(identityCode);

                    user = Converter.ConvertToBL(userDAL);


                    CacheData.Add(nombreCache, user);
                }
                else
                {
                    user = (Usuario)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("GetUserByIdentityCode()", ex);
            }

            return(user);
        }
Exemplo n.º 3
0
        public Solicitud Detalles(int id)
        {
            Solicitud result = null;

            try
            {
                string nombreCache = string.Format("solicitud{0}", id);

                if (!CacheData.Exist(nombreCache))
                {
                    SolicitudDAL model = new SolicitudDAL(_connectionString);

                    var solicitud = model.Detalles(id);

                    result = Converter.ConvertToBL(solicitud);

                    CacheData.Add(nombreCache, result);
                }
                else
                {
                    result = (Solicitud)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("Detalles()", ex);
            }

            return(result);
        }
Exemplo n.º 4
0
        public Permiso Detalles(int id)
        {
            Permiso result = null;

            try
            {
                string nombreCache = string.Format("Permiso{0}", id);

                if (!CacheData.Exist(nombreCache))
                {
                    PermisoDAL model = new PermisoDAL(_connectionString);

                    var permiso = model.Detalles(id);

                    result = Converter.ConvertToBL(permiso);

                    CacheData.Add(nombreCache, result);
                }
                else
                {
                    result = (Permiso)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("Detalles()", ex);
            }

            return(result);
        }
Exemplo n.º 5
0
        public Dispositivo Detalles(int id)
        {
            Dispositivo result = null;

            try
            {
                string nombreCache = string.Format("device{0}", id);

                if (!CacheData.Exist(nombreCache))
                {
                    DispositivoDAL model = new DispositivoDAL(_connectionString);

                    var device = model.Detalles(id);

                    result = Converter.ConvertToBL(device);

                    CacheData.Add(nombreCache, result);
                }
                else
                {
                    result = (Dispositivo)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("Detalles()", ex);
            }

            return(result);
        }
Exemplo n.º 6
0
        public Rol Detalles(int id)
        {
            Rol result = null;

            try
            {
                string nombreCache = string.Format("Rol{0}", id);

                if (!CacheData.Exist(nombreCache))
                {
                    RolDAL model = new RolDAL(_connectionString);

                    var rol = model.Detalles(id);

                    result = Converter.ConvertToBL(rol);

                    CacheData.Add(nombreCache, result);
                }
                else
                {
                    result = (Rol)CacheData.Get(nombreCache);
                }
            }
            catch (Exception ex)
            {
                log.Error("Detalles()", ex);
            }

            return(result);
        }
        public CacheBase BuildCache(string regionName, IDictionary <string, string> properties)
        {
            if (!CacheData.TryGetValue(regionName ?? string.Empty, out var data))
            {
                data = new Hashtable();
                CacheData.Add(regionName ?? string.Empty, data);
            }

            return(new SerializingCache(regionName, data));
        }
        public void Start(IDictionary <string, string> properties)
        {
            var serializer = new BinaryFormatter();

            foreach (var cache in SerializedCacheData)
            {
                using (var stream = new MemoryStream(cache.Value))
                {
                    CacheData.Add(cache.Key, (IDictionary)serializer.Deserialize(stream));
                }
            }
        }
Exemplo n.º 9
0
            internal override bool Reconstruct(Blam.CacheFile c)
            {
                bool result = true;

                if (CacheData.Count != 1)
                {
                    lightmap_vertex_buffer_bucket_cache_data_block cache_data;
                    CacheData.Add(out cache_data);

                    result = cache_data.Reconstruct(c, this, GeometryBlockInfo);
                }

                GeometryBlockInfo.Value.ClearPostReconstruction();

                return(result);
            }
Exemplo n.º 10
0
            internal override bool Reconstruct(BlamLib.Blam.CacheFile c)
            {
                bool result = true;

                if (CacheData.Count != 1)
                {
                    lightmap_geometry_section_cache_data_block cache_data;
                    CacheData.Add(out cache_data);

                    result = cache_data.Reconstruct(c, GeometryInfo.Value, GeometryBlockInfo.Value);
                }

                GeometryBlockInfo.Value.ClearPostReconstruction();

                return(result);
            }
Exemplo n.º 11
0
        public Tag Detalles(int id)
        {
            Tag result = null;

            try
            {
                string nombreCache = string.Format("tag{0}", id);

                if (!CacheData.Exist(nombreCache))
                {
                    TagsDAL mod = new TagsDAL(_connectionString);
                    var     tag = mod.Detalles(id);

                    result = Converter.ConvertToBL(tag);


                    //result = Diccionario_Get(id);

                    if (result != null)
                    {
                        // Guardamos en caché para la próxima
                        CacheData.Add(nombreCache, result);
                    }
                }
                else
                {
                    result = (Tag)CacheData.Get(nombreCache);
                }
            }
            catch (Exception er)
            {
                log.Error(string.Format("Detalles({0})", id), er);
            }

            return(result);
        }