Exemplo n.º 1
0
        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <param name="SystemCode">系统编号</param>
        /// <returns></returns>
        public SysSettingModel Get(int SystemCode)
        {
            var list = new SysSettingModel();

            if (!this.Exists(SystemCode))
            {
                var db = new UCMS.Entitys.UCMSContext();

                var tb = db.SysSetting.FirstOrDefault();
                if (tb != null)
                {
                    list = new SysSettingModel {
                        Id         = tb.Id,
                        SystemName = tb.SystemName,
                        Contact    = tb.Contact,
                        Feeback    = tb.Feeback,
                        HomeLogo   = tb.HomeLogo,
                        LoginLogo  = tb.LoginLogo,
                        FootLogo   = tb.FootLogo,
                        IsEnable   = tb.IsEnable
                    };
                    //保存缓存
                    this.Set(SystemCode, list);
                }
            }
            else
            {
                list = (SysSettingModel)mc.Get(this.GetCacheName(SystemCode));
            }
            return(list);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 添加缓存
 /// </summary>
 /// <param name="SystemCode">系统编号</param>
 /// <param name="list"></param>
 /// <returns></returns>
 public bool Set(int SystemCode, SysSettingModel list)
 {
     return(mc.Set(this.GetCacheName(SystemCode), list, DateTime.Now.AddDays(7)));
 }