コード例 #1
0
    private void DataPlay(int PageNo)
    {
        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();

        DataTable dt;
        dt = Hyoa_mail.Getmail_sjx(Session["hyuid"].ToString(), "收件", "收件箱");

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
コード例 #2
0
ファイル: list_mail_sjx.aspx.cs プロジェクト: wjszxli/Webapp
    private void DataPlay(int PageNo)
    {
        //加载外部收件账号
        string lswbjszh = "--按账号查看--";
        if (this.Request.QueryString["wbjszh"] != null)
        {
            lswbjszh = this.Request.QueryString["wbjszh"].ToString();
        }
        HyoaClass.Hyoa_mail_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config();
        DataTable dtmailconfig = Hyoa_mail_config.Getmailconfigbyuserid(this.Session["hyuid"].ToString());
        if (dtmailconfig.Rows.Count > 0)
        {
            this.ddlwbjszh.DataSource = dtmailconfig;
            this.ddlwbjszh.DataTextField = "hy_mailid";
            this.ddlwbjszh.DataValueField = "hy_mailid";
            this.ddlwbjszh.DataBind();
            this.ddlwbjszh.Items.Insert(0, new ListItem("本系统邮件", "本系统邮件"));
            this.ddlwbjszh.Items.Insert(0, new ListItem("--按账号查看--", "--按账号查看--"));

            this.ddlwbjszh.SelectedValue = lswbjszh;
        }

        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();

        DataTable dt;
        if (lswbjszh == "--按账号查看--")
            lswbjszh = "";
        if (lswbjszh == "本系统邮件")
            lswbjszh = "本系统邮件";
        dt = Hyoa_mail.Getmail_sjx(Session["hyuid"].ToString(), "收件", "收件箱", lswbjszh);

        DataTable tempTable = dt.Clone();
        DataColumn col = new DataColumn("wdyj", typeof(String)); //定义新的一列  add
        tempTable.Columns.Add(col);  //追加一列  add
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            //得到是否未读
            string ls_wdyj = "<font color=red>未读</font>";   //add
            if(dt.Rows[i]["hy_sccksj"].ToString()!="")
                ls_wdyj = "已读";
            dr["wdyj"] = ls_wdyj;  //将新值赋给相应的列  add
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }