| 发表于:2007-01-11 10:17:037楼 得分:0 |
protected void page_load(object sender, eventargs e) { if (!ispostback) { //绑定自己有权限查看的人员 if ((string)session[ "username "] == null)//原为!= { response.redirect( "login.aspx "); } string sr = (session[ "组织id "].tostring()).substring(0, 2).tolower(); if (sr != "jy ") { response.redirect( "pageerror.aspx "); } string sql = "select * from tbluser where 组织id like '% " + session[ "组织id "].tostring() + "% ' "; db = new database(); ds = new dataset(); ds = db.getdatafromdb(sql); this.droppeople.datasource = ds; this.droppeople.datavaluefield = "工号 "; this.droppeople.datatextfield = "姓名 "; this.droppeople.databind(); this.droppeople.items.add(new listitem( "请选择 ", "0 ")); this.droppeople.selectedindex = this.droppeople.items.count - 1; ds.clear(); } } protected void droppeople_selectedindexchanged(object sender, eventargs e) { //选择用户名绑定相应的权限 if (this.droppeople.selectedvalue != "0 ") { int a = this.droppeople.selectedindex; //提出以有的权限 string sql = "select * from tblpurview where 用户姓名= ' " + this.droppeople.selecteditem .text .trim () + " ' ";//and 部门= '2 ' "; db = new database(); ds = new dataset(); ds = db.getdatafromdb(sql); if (ds != null) { this.listnew.datasource = ds; this.listnew.datavaluefield = "用户权限url "; this.listnew.datatextfield = "用户权限页名 "; this.listnew.databind(); ds.clear(); } //内部的看所有权限 string allsql = "select * from tbltree where url not in (select 用户权限url from tblpurview where 用户姓名= ' " + this.droppeople.selecteditem.text + " ') and 子级 is not null order by 所属公司,父级 "; db = new database(); ds = new dataset(); ds = db.getdatafromdb(allsql); this.listpur.datasource = ds; this.listpur.datavaluefield = "url "; this.listpur.datatextfield = "名称 "; this.listpur.databind(); } } | | |
|