예제 #1
0
        protected void BindList()
        {
            int count = 0;

            var where = ExpressionExtension.CreateExpression <TNNEWSInfo>();
            if (txtMonthlyName.Text != "")
            {
                where = where.And(t => t.CN_TITLE.Contains(txtMonthlyName.Text));
            }
            List <TNNEWSInfo> lst = bllTNNEWS.GetListByPage(AspNetPager.CurrentPageIndex, AspNetPager.PageSize, where, "CN_CREATE_DATE DESC", out count).ToList();

            rep.DataSource = lst;
            rep.DataBind();
            AspNetPager.RecordCount = count;
        }
예제 #2
0
 private void BindNewsList()
 {
     try
     {
         TNNEWSBLL         bllNews = new TNNEWSBLL();
         int               count   = 0;
         List <TNNEWSInfo> lst     = bllNews.GetListByPage(1, 8, "CN_MODIFY_DATE DESC", out count).ToList();
         repNews.DataSource = lst;
         repNews.DataBind();
     }
     catch (Exception ex)
     {
         LogHelper.WriteErrorLog("绑定动态出错:" + ex);
         MessageBox.Show(this, ex.Message);
     }
 }
예제 #3
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindList()
        {
            try
            {
                string title = txtTitle.Text.Trim();
                if (title == "标题")
                {
                    title = "";
                }

                Expression <Func <TNNEWSInfo, bool> > wheres = null;
                if (string.IsNullOrEmpty(title) == false)
                {
                    wheres = c => c.CN_TITLE.Contains(title);
                }

                int count             = 0;
                List <TNNEWSInfo> lst = bll.GetListByPage(AspNetPager.CurrentPageIndex, AspNetPager.PageSize, wheres, "CN_CREATE_DATE DESC", out count).ToList();
                AspNetPager.RecordCount = count;

                if (string.IsNullOrEmpty(title) == false)
                {
                    foreach (TNNEWSInfo info in lst)
                    {
                        info.CN_TITLE = info.CN_TITLE.Replace(title, "<span style='color:red;'>" + title + "</span>");
                    }
                }

                rep.DataSource = lst;
                rep.DataBind();
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog("绑定动态列表出错(Index/DynamicList):" + ex);
            }
        }