Example #1
0
 public Maticsoft.Model.CMS.Content GetModelByClassIDByCache(int ClassID, out string className)
 {
     className = new Maticsoft.BLL.CMS.ContentClass().GetClassnameById(ClassID);
     string cacheKey = "ContentModelClassID-" + ClassID;
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         try
         {
             cache = this.dal.GetModelByClassID(ClassID);
             if (cache != null)
             {
                 int num = Globals.SafeInt(ConfigSystem.GetValueByCache("ModelCache"), 30);
                 DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
             }
         }
         catch
         {
         }
     }
     return (Maticsoft.Model.CMS.Content) cache;
 }
Example #2
0
 public Maticsoft.Model.CMS.Content GetModelByCache(int? ContentID, out string className)
 {
     className = "";
     if (!ContentID.HasValue)
     {
         return null;
     }
     Maticsoft.BLL.CMS.ContentClass class2 = new Maticsoft.BLL.CMS.ContentClass();
     this.dal.UpdatePV(ContentID.Value);
     string cacheKey = "ContentModel-" + ContentID.Value;
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         try
         {
             cache = this.dal.GetModel(ContentID.Value);
             if (cache != null)
             {
                 int num = Globals.SafeInt(ConfigSystem.GetValueByCache("ModelCache"), 30);
                 DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
             }
         }
         catch
         {
         }
     }
     Maticsoft.Model.CMS.Content content = (Maticsoft.Model.CMS.Content) cache;
     if (content != null)
     {
         className = class2.GetClassnameById(content.ClassID);
     }
     return content;
 }
Example #3
0
 public int GetClassIdById(int id)
 {
     Maticsoft.BLL.CMS.ContentClass class2 = new Maticsoft.BLL.CMS.ContentClass();
     Maticsoft.Model.CMS.ContentClass modelByCache = class2.GetModelByCache(id);
     if (modelByCache == null)
     {
         return 0;
     }
     if ((modelByCache.ParentId != 0) && modelByCache.ParentId.HasValue)
     {
         int classID = Convert.ToInt32(modelByCache.ParentId);
         modelByCache = class2.GetModel(classID);
     }
     return modelByCache.ClassID;
 }
Example #4
0
 public List<Maticsoft.Model.CMS.ContentClass> GetModelList(int Top, int? classid, out string classname)
 {
     classname = "此栏目不存在";
     if (!classid.HasValue)
     {
         return null;
     }
     classname = new Maticsoft.BLL.CMS.ContentClass().GetClassnameById(classid.Value);
     List<Maticsoft.Model.CMS.ContentClass> list = this.GetModelList(Top, string.Format("  State=0  and  ParentId in ({0})", classid.Value), " Sequence ");
     if ((list != null) && (list.Count > 0))
     {
         return list;
     }
     return this.GetModelList(1, string.Format("  State=0  and  ClassID ={0}", classid.Value), " Sequence ");
 }
Example #5
0
 public static List<Maticsoft.Model.CMS.ContentClass> GetAllClass()
 {
     string cacheKey = "ContentClass-GetAllClass";
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         try
         {
             cache = new Maticsoft.BLL.CMS.ContentClass().GetModelList("");
             if (cache != null)
             {
                 int num = Globals.SafeInt(ConfigSystem.GetValueByCache("ModelCache"), 30);
                 DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
             }
         }
         catch
         {
         }
     }
     return (List<Maticsoft.Model.CMS.ContentClass>) cache;
 }