Exemplo n.º 1
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";
            this.tdnewdoc.Visible = true; //新建
            this.tddeldoc.Visible = true; //删除

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

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

        DataTable dt = new DataTable();
        if (this.hy_name.Value != "")
        {
            dt = Hyoa_role.Getrolesbyrolename(this.hy_name.Value);
        }
        else
        {
            dt = Hyoa_role.Getroles();
        }

        DataTable tempTable = dt.Clone();

        DataColumn col1 = new DataColumn("hy_roleuser", typeof(String)); //定义新的一列  add原因说明
        tempTable.Columns.Add(col1);  //追加一列  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_roleuser = "";
            if (dt.Rows[i]["hy_roleid"].ToString() != "")
            {
                DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(dt.Rows[i]["hy_roleid"].ToString());
                if (dtjudeg.Rows.Count > 0)
                {
                    for (var ii = 0; ii < dtjudeg.Rows.Count; ii++)
                    {
                        if (ls_roleuser == "")
                        {
                            ls_roleuser = getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString());
                        }
                        else
                        {
                            ls_roleuser = ls_roleuser + "," + getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString());
                        }
                    }
                }
            }
            if (ls_roleuser.Length > 50)
            {
                ls_roleuser = ls_roleuser.Substring(0, 50) + "...";
            }
            dr["hy_roleuser"] = ls_roleuser;

            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();
    }
Exemplo n.º 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";
            this.tdnewdoc.Visible = true; //新建
            this.tddeldoc.Visible = true; //删除

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

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

        DataTable dt;
        if (this.hy_name.Value != "")
        {
            dt = Hyoa_role.Getrolesbyrolename(this.hy_name.Value);
        }
        else
        {
            dt = Hyoa_role.Getroles();
        }

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