コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataSet newsDataset   = new DataSet();
            DataSet notifyDataset = new DataSet();

            ServiceNews serviceNews = new ServiceNews();
            newsDataset   = serviceNews.GetSingleOutlineNewsListWithPageNumber(2, 5, 1);
            notifyDataset = serviceNews.GetSingleOutlineNewsListWithPageNumber(3, 5, 1);

            if (null == newsDataset || 0 == newsDataset.Tables.Count)
            {
                this.news_list.InnerText = "目前尚未有新闻";
            }
            else
            {
                this.news_list.InnerHtml = getDetailList(newsDataset.Tables[0]);
            }

            if (null == notifyDataset || 0 == notifyDataset.Tables.Count)
            {
                this.news_list.InnerText = "目前尚未有通知";
            }
            else
            {
                this.notify_list.InnerHtml = getDetailList(notifyDataset.Tables[0]);
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string outlineType = Request.QueryString["type"];
            int    outlineId   = Convert.ToInt32(outlineType);
            if (null == outlineType || outlineType.Equals(string.Empty))
            {
                this.showFalseMessage("请输入正确的请求代号!");
                return;
            }

            string pageRequestString = Request.QueryString["page_request"];
            int    pageRequest       = Convert.ToInt32(pageRequestString);
            if (null == pageRequestString || pageRequestString.Equals(string.Empty))
            {
                this.showFalseMessage("请输入正确的页码!");
                return;
            }

            ServiceNews serviceNews = new ServiceNews();
            int         pageCount   = serviceNews.GetNewsPageCountOutline(outlineId, 20);
            if (0 == pageCount)
            {
                this.showOverflowMessage("该栏目目前还没有资源!");
                this.initPageNumber(pageCount, pageRequest, outlineId);
                return;
            }
            this.initPageNumber(pageCount, pageRequest, outlineId);

            DataSet dataset = serviceNews.GetSingleOutlineNewsListWithPageNumber(outlineId, 20, pageRequest);
            if (null == dataset || 0 == dataset.Tables.Count || 0 == dataset.Tables[0].Rows.Count)
            {
                this.showOverflowMessage("页码超出范围!");
                return;
            }
            this.initNewsList(dataset.Tables[0]);
        }
    }