Ejemplo n.º 1
0
 /// <summary>
 /// 缓存jsonData
 /// </summary>
 /// <returns></returns>
 public bool StartJsonDataCatch()
 {
     try
     {
         DataCacheProvider _DataCacheProvider = new DataCacheProvider();
         //清空缓存
         _DataCacheProvider.ClearCache();
         //
         SetCache <MenuModel>(_DataCacheProvider, Constant.MainMenuJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.ManagementRegulationsJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.NewsMenuJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.OrganizationalTypeJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.AssociationMenuJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.AboutJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.PublicationTypeJsonFile);
         SetCache <MenuModel>(_DataCacheProvider, Constant.AcademicResourceJsonFile);
         SetCache <Content>(_DataCacheProvider, Constant.ContentDataJsonFile);
         //缓存角色数据
         CacheRole(_DataCacheProvider);
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "缓存jsonData", "StartJsonDataCatch", ex);
         return(false);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取联系我们电话
        /// </summary>
        /// <returns></returns>
        public Content GetContent()
        {
            Content           result             = new Content();
            DataCacheProvider _DataCacheProvider = new DataCacheProvider();

            var Contents = _DataCacheProvider.GetCache(Constant.ContentDataJsonFile);

            if (Contents != null)
            {
                result = (Contents as List <Content>).FirstOrDefault();
            }

            return(result);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 缓存角色信息
 /// </summary>
 /// <returns></returns>
 private bool CacheRole(DataCacheProvider Provider)
 {
     try
     {
         string      sql     = "select * from de2_user_roletype";
         MySqlClient _Client = new MySqlClient();
         var         result  = _Client.ExecuteQuery <RoleType>(sql);
         return(Provider.SetCache("roetype", result));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "缓存角色信息", "CacheRole", ex);
         return(false);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="Provider"></param>
 /// <param name="JSONPath"></param>
 /// <returns></returns>
 private bool SetCache <T>(DataCacheProvider Provider, string JSONPath)
 {
     try
     {
         List <T>     result        = new List <T>();
         JsonDataHelp _JsonDataHelp = new JsonDataHelp();
         result = _JsonDataHelp.GetJsonData <List <T> >(JSONPath);
         return(Provider.SetCache(JSONPath, result));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "设置缓存", "SetCache", ex);
         return(false);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取学术资源菜单列表
        /// </summary>
        /// <param name="StartRow"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public List <MenuModel> GetAcademicResource()
        {
            List <MenuModel> Result = new List <MenuModel>();

            try
            {
                DataCacheProvider _Provider = new DataCacheProvider();
                Result = _Provider.GetCache(Constant.AcademicResourceJsonFile) as List <MenuModel>;
                if (Result != null)
                {
                    Result = Result.OrderBy(a => a.Index).ToList();
                }
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取学术资源菜单列表", "GetAcademicResource", ex);
            }
            return(Result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取管理条例列表
        /// </summary>
        /// <param name="StartRow"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public List <MenuModel> GetManageRuleses()
        {
            List <MenuModel> Result = new List <MenuModel>();

            try
            {
                DataCacheProvider _Provider = new DataCacheProvider();
                Result = _Provider.GetCache(Constant.ManagementRegulationsJsonFile) as List <MenuModel>;
                if (Result != null)
                {
                    Result = Result.OrderBy(a => a.Index).ToList();
                }
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取管理条例列表", "GetManageRuleses", ex);
            }
            return(Result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取组织机构分类列表
        /// </summary>
        /// <returns></returns>
        public List <MenuModel> GetOrganizationalTypes()
        {
            List <MenuModel> result = new List <MenuModel>();

            try
            {
                DataCacheProvider _Provider = new DataCacheProvider();
                result = _Provider.GetCache(Constant.OrganizationalTypeJsonFile) as List <MenuModel>;
                if (result != null)
                {
                    result = result.OrderBy(a => a.Index).ToList();
                }
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取组织机构分类列表", "GetOrganizationalTypes", ex);
            }
            return(result);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取学会动态菜单
        /// </summary>
        /// <returns></returns>
        public List <MenuModel> GetAssociationMenu()
        {
            List <MenuModel> result = new List <MenuModel>();

            try
            {
                //JsonDataHelp _JsonDataHelp = new JsonDataHelp();
                //result = _JsonDataHelp.GetJsonData<List<MenuModel>>(Constant.AssociationMenuJsonFile);
                DataCacheProvider _Provider = new DataCacheProvider();
                result = _Provider.GetCache(Constant.AssociationMenuJsonFile) as List <MenuModel>;
                if (result != null)
                {
                    result = result.OrderBy(a => a.Index).ToList();
                }
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取学会动态菜单", "GetAssociationMenu", ex);
            }
            return(result);
        }