Exemplo n.º 1
0
        /// <summary>
        /// 获取当前ID对应数据
        /// </summary>
        /// <param name="nId"></param>
        /// <returns></returns>
        public static Model.ContentDetail GetModel(object nId)
        {
            BLL.ContentDetail bll = new BLL.ContentDetail();

            if (!enableCaching)
            {
                return(bll.GetModel(nId));
            }

            string key = "contentDetail_" + nId.ToString() + "";

            Model.ContentDetail data = (Model.ContentDetail)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetModel(nId);

                AggregateCacheDependency cd = DependencyFactory.GetContentDetailDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(contentDetailTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Exemplo n.º 2
0
 private void Bind()
 {
     if (!string.IsNullOrEmpty(nId))
     {
         if (bll == null)
         {
             bll = new BLL.ContentDetail();
         }
         Model.ContentDetail model = bll.GetModel(nId);
         if (model != null)
         {
             txtTitle.Value  = model.Title;
             txtParent.Value = model.ContentTypeID.ToString();
             hEditor1.Value  = model.ContentText;
         }
     }
 }
Exemplo n.º 3
0
        private void Bind()
        {
            if (!Page.IsPostBack)
            {
                BLL.ContentDetail       bll   = new BLL.ContentDetail();
                Model.ContentDetailInfo model = bll.GetModel(nId);
                if (model != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<div id='cTitle' class='tc'>{0}</div>", model.Title, model.ContentTypeID);
                    sb.AppendFormat("<div id='cContent' class='mt10'>{0}</div>", model.ContentText);

                    ltrContent.Text = sb.ToString();
                }
                else
                {
                    ltrContent.Text = "<div id='cTitle' class='tc'></div><div id='cContent' class='mt10'></div>";
                }
            }
        }