private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9990", this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
            this.tdnewdoc.Visible = true; //新建
            this.tddeldoc.Visible = true; //删除

        }
        else
        {
            this.isrole.Value = "0";
            this.tdnewdoc.Visible = false; //新建
            this.tddeldoc.Visible = false; //删除
        }

        if (this.txtdeptid.Value == "")
            this.tdnewdoc.Visible = false;  //新建

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

        DataTable dt;
        if (this.hy_name.Value != "")
        {
            if (this.txtdeptid.Value == "")
            {
                dt = Hyoa_user.GetusersbynameforCX(this.hy_name.Value);
            }
            else
            {
                dt = Hyoa_user.GetusersbydeptidforCX(this.txtdeptid.Value, this.hy_name.Value);
            }
        }
        else
        {
            if (this.txtdeptid.Value == "")
            {
                //显示所有用户
                dt = Hyoa_user.GetusersOrderbydeptsortandusersort();
            }
            else
            {
                //按部门ID显示
                dt = Hyoa_user.Getusersbydeptid(this.txtdeptid.Value);
            }
        }

        DataTable tempTable = dt.Clone();
        DataColumn col = new DataColumn("ifjz", typeof(String)); //定义新的一列  是否兼职
        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];
            }
            if (dt.Rows[i]["hy_loginuid"].ToString() == "")
            {
                dr["ifjz"] = "<font color=red>[兼职信息]</font>";  //将新值赋给相应的列  add
            }
            else
            {
                dr["ifjz"] = "";  //将新值赋给相应的列  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();
    }
Example #2
0
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
        }
        else
        {
            this.isrole.Value = "0";
        }

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

        DataTable dt;
        if (this.hy_name.Value != "")
        {
            if (this.txtdeptid.Value == "")
            {
                dt = Hyoa_user.GetusersbynameforCX(this.hy_name.Value);
            }
            else
            {
                dt = Hyoa_user.GetusersbydeptidforCX(this.txtdeptid.Value, this.hy_name.Value);
            }
        }
        else
        {
            if (this.txtdeptid.Value == "")
            {
                //显示所有用户
                dt = Hyoa_user.GetusersOrderbydeptsortandusersort();
            }
            else
            {
                //按部门ID显示
                dt = Hyoa_user.Getusersbydeptid(this.txtdeptid.Value);
            }
        }

        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();
    }