/// <summary> /// 绑定部门 /// </summary> private void DepBind() { this.ddlDepart.DataSource = bllSys_Department.GetAll().OrderBy(m => m.Department_Level).OrderBy(m => m.Department_Sequence).ToList(); this.ddlDepart.DataTextField = "Department_Name"; this.ddlDepart.DataValueField = "Department_Code"; this.ddlDepart.DataBind(); this.ddlDepart.SelectedValue = this.hid_Dep.Value; }
/// <summary> /// 全展开部门用户树 带Checkbox /// </summary> /// <param name="context"></param> public void AllDeptData(HttpContext context) { StringBuilder sb = new StringBuilder(); string parentId = ""; if (!string.IsNullOrEmpty(context.Request.QueryString["pid"])) { parentId = context.Request.QueryString["pid"]; } string roleID = context.Request.QueryString["roleID"]; string MenuCode = context.Request.QueryString["MenuCode"]; //List<Sys_RolePurview> RPList = bllRP.FindWhere(" RolePurview_RoleID='" + roleID + "' and RolePurview_MenuCode='" + MenuCode + "'"); List <Sys_RolePurview> RPList = bllRP.GetList(p => p.RolePurview_RoleID == roleID && p.RolePurview_MenuCode == MenuCode).ToList(); string SeeDepCode = ""; if (RPList.Count == 1) { SeeDepCode = RPList[0].RolePurview_SeeDepCode; if (!string.IsNullOrEmpty(SeeDepCode)) { SeeDepCode = SeeDepCode.Replace("'", ""); } } if (!parentId.Equals("")) { sb.Append("["); //NodeDepList = bllDep.FindWhere(" 1=1 "); NodeDepList = bllDep.GetAll().ToList(); if (NodeDepList.Count != 0) { sb.Append(AllDeptDataBindTree(NodeDepList, parentId, SeeDepCode)); } sb.Remove(sb.Length - 1, 1); sb.Append("}]"); } context.Response.Write(sb.ToString()); }