private void createData() { zs.BLL.Sys_Role bllr = new zs.BLL.Sys_Role(); zs.BLL.Sys_UserRole bllur = new zs.BLL.Sys_UserRole(); zs.Model.Sys_UserRole model = new zs.Model.Sys_UserRole(); foreach (RepeaterItem ri in Repeater1.Items) { (ri.FindControl("ddl_role") as DropDownList).DataSource = bllr.GetModelList(""); (ri.FindControl("ddl_role") as DropDownList).DataTextField = "RoleName"; (ri.FindControl("ddl_role") as DropDownList).DataValueField = "ID"; (ri.FindControl("ddl_role") as DropDownList).DataBind(); //(ri.FindControl("ddl_role") as DropDownList).SelectedValue = string userId = (ri.FindControl("HiddenField1") as HiddenField).Value; if (bllur.GetModelList("UserID=" + userId).Count > 0) { model = bllur.GetModelList("UserID=" + userId)[0]; (ri.FindControl("ddl_role") as DropDownList).SelectedValue = model.RoleID.Value.ToString(); } } }
private void BindData() { this.ddl_role.DataSource = bllr.GetModelList(""); this.ddl_role.DataTextField = "RoleName"; this.ddl_role.DataValueField = "ID"; this.ddl_role.DataBind(); if (Request.QueryString["id"] != null) { string ids = Request.QueryString["id"].ToString(); if (ids != "0") { zs.Model.Tbl_User model = bll.GetModel(int.Parse(ids)); this.tb_name.Text = model.userName; this.tb_Psw.Text = model.userPsw; this.ddl_role.SelectedValue = bllur.GetModelList("UserID=" + ids)[0].RoleID.ToString(); this.Button1.Text = "修改"; ViewState["userid"] = ids; } } }
public string GetUserFunction() { string uid = Request.Cookies["userId"].Value.ToString(); StringBuilder sb = new StringBuilder(); int rid = bllur.GetModelList("UserID=" + uid)[0].RoleID.Value; List <zs.Model.Sys_RoleFunction> modelrf = bllrf.GetModelList("RoleID=" + rid.ToString()); foreach (zs.Model.Sys_RoleFunction ri in modelrf) { int fid = ri.FunctionID.Value; zs.Model.Sys_Function fun = bllf.GetModel(fid); sb.Append("<li>"); sb.Append("<a href='" + fun.Assembly + "'><i class=\"icon-double-angle-right\"></i><span class=\"menu-text\">"); sb.Append(fun.FunctionDescription); sb.Append("</span></a>"); sb.Append("</li>\n\r"); } return(sb.ToString()); }