Example #1
0
        private void Get_Data()
        {
            string where = "typeid=" + typeid;
            if (!string.IsNullOrEmpty(key))
            {
                where += " and (Title like '%" + key + "%')";
            }

            DataTable dt = DB.GetListByPage("News", "Id", where, "Id", 1, 1, 1, out PageCount, out RecordCount);

            if (dt.Rows.Count > 0)
            {
                CurrentPage        = PagingHelper.getPage(PageCount);//当前页
                rptList.DataSource = DB.GetListByPage("News", "*", where, "Id", 1, PageSize, CurrentPage, out PageCount, out RecordCount);
                rptList.DataBind();
                ltlNull.Text = "";
            }
            else
            {
                rptList.DataSource = string.Empty;
                rptList.DataBind();
                ltlNull.Text = "<tr><td>暂无数据</td></tr>";
            }

            dt.Dispose();
        }
Example #2
0
        private void Get_Data()
        {
            if (userName != "")
            {
                string where = "UserName='******'";

                DataTable dt = DB.GetListByPage("Product", "Id", where, "Id", 1, 1, 1, out PageCount, out RecordCount);
                if (dt.Rows.Count > 0)
                {
                    CurrentPage        = PagingHelper.getPage(PageCount);//当前页
                    rptList.DataSource = DB.GetListByPage("Product", "*", where, "Id", 1, PageSize, CurrentPage, out PageCount, out RecordCount);
                    rptList.DataBind();
                    ltlNull.Text = "";
                }
                else
                {
                    rptList.DataSource = string.Empty;
                    rptList.DataBind();
                    ltlNull.Text = "暂无数据";
                }

                dt.Dispose();
            }
            else
            {
                string where = "State='通过'";
                if (fenleiId > 0)
                {
                    where += " and FenLeiId=" + fenleiId;
                }

                if (!string.IsNullOrEmpty(key))
                {
                    where += " and (ProductName like '%" + key + "%')";
                }

                DataTable dt = DB.GetListByPage("Product", "Id", where, "Id", 1, 1, 1, out PageCount, out RecordCount);
                if (dt.Rows.Count > 0)
                {
                    CurrentPage        = PagingHelper.getPage(PageCount);//当前页
                    rptList.DataSource = DB.GetListByPage("Product", "*", where, "Id", 1, PageSize, CurrentPage, out PageCount, out RecordCount);
                    rptList.DataBind();
                    ltlNull.Text = "";
                }
                else
                {
                    rptList.DataSource = string.Empty;
                    rptList.DataBind();
                    ltlNull.Text = "暂无数据";
                }

                dt.Dispose();
            }
        }