Beispiel #1
0
        protected void PageData()
        {
            KingTop.Common.Pages page = new KingTop.Common.Pages();
            string strWhere           = " isdel=0 and nodecode='" + NodeCode + "' ";
            string Keywords           = Request.QueryString["k"];

            if (!string.IsNullOrEmpty(Keywords))
            {
                strWhere   += " and title like '%" + Keywords + "%' ";
                Title.Value = Keywords;
            }

            try
            {
                int     recordCount = 0;
                DataSet ds          = page.GetPageList("K_U_Common ", "*", "orders desc ", strWhere, Split.CurrentPageIndex, Split.PageSize, out recordCount, 1);
                Split.RecordCount = recordCount;
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        rptListInfo.DataSource = ds;
                        rptListInfo.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.AlertMessage(this, ex.Message, "系统提示");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取数据列表,带分页,带搜索
        /// </summary>
        /// <param name="context"></param>
        private void GetList(HttpContext context)
        {
            KingTop.Common.Pages page = new KingTop.Common.Pages();
            string title    = Utils.CheckSql(context.Request.Params["sTitle"]);
            string username = Utils.CheckSql(context.Request.Params["sUserName"]);
            Dictionary <string, object> dt = new Dictionary <string, object>();
            int intPageSize    = Convert.ToInt32(context.Request.Params["rows"]);
            int intCurrentPage = Convert.ToInt32(context.Request.Params["page"]);
            int RecordCount    = 0;

            string strWhere = " isdel=0 and nodecode='" + NodeCode + "' ";

            if (title.Length > 0)
            {
                strWhere += " and title like '%" + title + "%'";
            }
            if (username.Length > 0)
            {
                strWhere += " and username='******'";
            }


            DataSet ds = page.GetPageList("K_U_Common ", "*", " orders desc ", strWhere, intCurrentPage, intPageSize, out RecordCount, 1);

            List <KingTop.Model.Common.Common> List = new List <KingTop.Model.Common.Common>();

            foreach (DataRow item in ds.Tables[0].Rows)
            {
                KingTop.Model.Common.Common model = new KingTop.Model.Common.Common();
                model.Id       = item["Id"].ToString();
                model.Title    = item["Title"].ToString();
                model.UserName = item["UserName"].ToString();
                if (item["BigImg"].ToString() != "")
                {
                    model.BigImg = "<img src='/UploadFiles/Images/" + item["BigImg"].ToString() + "' height='60'/>";
                }
                else
                {
                    model.BigImg = "<img src='/sysadmin/images/NoPic.jpg' height='60' />";
                }

                model.AddDate   = Utils.GetStandardDateTime(item["AddDate"].ToString());
                model.FlowState = Utils.GetFlowState(item["FlowState"].ToString());
                model.Orders    = Utils.ParseInt(item["Orders"].ToString(), 0);
                List.Add(model);
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            dt.Add("total", RecordCount);
            dt.Add("rows", List.ToList <object>());//list.ToList<object>());
            context.Response.Write(js.Serialize(dt));
            context.Response.End();
        }