Example #1
0
        protected void initList()
        {
            Eyousoft_yhq.BLL.Comment      bll        = new Eyousoft_yhq.BLL.Comment();
            Eyousoft_yhq.Model.serComment serchModel = new Eyousoft_yhq.Model.serComment();
            serchModel.sTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("stime"));
            serchModel.eTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("etime"));
            pageIndex        = UtilsCommons.GetPagingIndex("Page");
            var list = bll.GetList(pageSize, pageIndex, ref recordCount, serchModel);

            if (list != null && list.Count > 0)
            {
                rpt_list.DataSource = list;
                rpt_list.DataBind();
                BindPage();
                litMsg.Visible = false;
            }
            else
            {
                rpt_list.Visible = false;
            }
        }
Example #2
0
        protected void initList()
        {
            Eyousoft_yhq.BLL.Comment bll = new Eyousoft_yhq.BLL.Comment();
            Eyousoft_yhq.Model.serComment serchModel = new Eyousoft_yhq.Model.serComment();
            serchModel.sTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("stime"));
            serchModel.eTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("etime"));
            pageIndex = UtilsCommons.GetPagingIndex("Page");
            var list = bll.GetList(pageSize, pageIndex, ref recordCount, serchModel);
            if (list != null && list.Count > 0)
            {
                rpt_list.DataSource = list;
                rpt_list.DataBind();
                BindPage();
                litMsg.Visible = false;

            }
            else
            {
                rpt_list.Visible = false;
            }
        }
Example #3
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList <Eyousoft_yhq.Model.Comment> GetList(Eyousoft_yhq.Model.serComment serModel)
        {
            IList <Eyousoft_yhq.Model.Comment> list = new List <Eyousoft_yhq.Model.Comment>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  ProductID,CommentID,PeopleID,CommentText,IssueTime,(select ContactName from tbl_member   where userid=PeopleID) as PeopleName   ");
            strSql.Append("  from tbl_Comment where  1=1  ");
            if (serModel != null)
            {
                if (serModel.sTime.HasValue)
                {
                    strSql.AppendFormat(" AND datediff(day,'{0}',IssueTime)>=0 ", serModel.sTime.Value);
                }
                if (serModel.eTime.HasValue)
                {
                    strSql.AppendFormat(" AND datediff(day,'{0}',IssueTime)<=0 ", serModel.eTime.Value);
                }
            }
            strSql.Append("  order by IssueTime  DESC  ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.Comment model = new Eyousoft_yhq.Model.Comment();
                    model.ProductID   = dr.IsDBNull(dr.GetOrdinal("ProductID")) ? "" : dr.GetString(dr.GetOrdinal("ProductID"));;
                    model.CommentID   = dr.IsDBNull(dr.GetOrdinal("CommentID")) ? "" : dr.GetString(dr.GetOrdinal("CommentID"));
                    model.PeopleID    = dr.IsDBNull(dr.GetOrdinal("PeopleID")) ? "" : dr.GetString(dr.GetOrdinal("PeopleID"));
                    model.CommentText = dr.IsDBNull(dr.GetOrdinal("CommentText")) ? "" : dr.GetString(dr.GetOrdinal("CommentText"));
                    model.IssueTime   = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.PeopleName  = dr.IsDBNull(dr.GetOrdinal("PeopleName")) ? "" : dr.GetString(dr.GetOrdinal("PeopleName"));
                    list.Add(model);
                }
            }
            return(list);
        }
Example #4
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="RecordCount"></param>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList <Eyousoft_yhq.Model.Comment> GetList(int PageSize, int PageIndex, ref int RecordCount, Eyousoft_yhq.Model.serComment serModel)
        {
            IList <Eyousoft_yhq.Model.Comment> list = new List <Eyousoft_yhq.Model.Comment>();


            string tableName     = "tbl_Comment";
            string fileds        = "  ProductID,CommentID,PeopleID,CommentText,IssueTime,(select ContactName from tbl_member   where userid=PeopleID) as PeopleName ";
            string orderByString = "IssueTime desc";

            StringBuilder query = new StringBuilder();

            query.Append(" 1=1 ");

            if (serModel != null)
            {
                if (serModel.sTime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',IssueTime)>=0 ", serModel.sTime.Value);
                }
                if (serModel.eTime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',IssueTime)<=0 ", serModel.eTime.Value);
                }
            }


            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.Comment model = new Eyousoft_yhq.Model.Comment();
                    model.ProductID   = dr.IsDBNull(dr.GetOrdinal("ProductID")) ? "" : dr.GetString(dr.GetOrdinal("ProductID"));;
                    model.CommentID   = dr.IsDBNull(dr.GetOrdinal("CommentID")) ? "" : dr.GetString(dr.GetOrdinal("CommentID"));
                    model.PeopleID    = dr.IsDBNull(dr.GetOrdinal("PeopleID")) ? "" : dr.GetString(dr.GetOrdinal("PeopleID"));
                    model.CommentText = dr.IsDBNull(dr.GetOrdinal("CommentText")) ? "" : dr.GetString(dr.GetOrdinal("CommentText"));
                    model.IssueTime   = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.PeopleName  = dr.IsDBNull(dr.GetOrdinal("PeopleName")) ? "" : dr.GetString(dr.GetOrdinal("PeopleName"));
                    list.Add(model);
                }
            }
            return(list);
        }