//模块权限列表 protected string fRoleNames() { string ls_return = ""; string ls_userid = ""; string ls_roleids = ""; //加载 HyoaClass.Hyoa_jiaose Hyoa_jiaose = new HyoaClass.Hyoa_jiaose(); DataTable dt = Hyoa_jiaose.Getdocs(); //fdselectroleid if (this.Request.QueryString["selectjiaoseid"] != null) { this.fdselectroleid.Value = "," + this.Request.QueryString["selectjiaoseid"].ToString() + ","; } if(dt.Rows.Count>0) { for (var i = 0; i < dt.Rows.Count; i++) { //if (ls_roleids == "") //{ ls_return += "<td width=\"25%\">"; if (this.fdselectroleid.Value.IndexOf(","+dt.Rows[i]["id"].ToString()+",") >= 0) { //判断是否已经选中,如果选中了,则前面打勾 ls_return += "<input type=\"checkbox\" checked=true name=\"fRoleName\" value=\"" + dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_jsname"].ToString() + "\" id=\"" + dt.Rows[i]["hy_jsname"].ToString() + "\">" + dt.Rows[i]["hy_jsname"].ToString(); } else { ls_return += "<input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_jsname"].ToString() + "\" id=\"" + dt.Rows[i]["hy_jsname"].ToString() + "\">" + dt.Rows[i]["hy_jsname"].ToString(); } ls_return += "</td>"; //} //else //{ // if (ls_roleids.Contains(dt.Rows[i]["hy_roleid"].ToString())) // { // ls_return += "<td width=\"25%\"><input type=\"checkbox\" checked=\"checked\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>"; // } // else // { // ls_return += "<td width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>"; // } //} if (((i + 1) % 4) == 0 && i < dt.Rows.Count) ls_return += "</tr><tr>"; } } dt.Clear(); return ls_return; }
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_jiaose Hyoa_jiaose = new HyoaClass.Hyoa_jiaose(); DataTable dt; dt = Hyoa_jiaose.Getdocs(); 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(); }