//绑定收文单位 private void BindAcceptUnit() { DataTable dt = new DataTable(); BLL.BASE_DEPT dept = new BLL.BASE_DEPT(); /*当前用户所属部门和子部门*/ dt = dept.GetUserWhereDepartment(userSession.USERNAME, -1); foreach (DataRow dr in dt.Rows) { if (dr["PARENTID"].ToString().Equals("0")) { TreeNode rootNode = new TreeNode(); rootNode.Text = dr["DPTNAME"].ToString(); rootNode.Value = dr["DEPTID"].ToString(); rootNode.ToolTip = dr["DPTINFO"].ToString(); rootNode.ShowCheckBox = true; rootNode.Expanded = true; //递归子节点 RecursiveBindAcceptUnit(rootNode, dt); //加入控件 TreeViewAcceptUnit.Nodes.Add(rootNode); } } }
/// <summary> /// 绑定部门员工树 数据源 /// </summary> private void DepartmentAndEmployeesDataSource() { DataTable dt = new DataTable(); //获取部门数据源 BLL.BASE_DEPT bll = new BLL.BASE_DEPT(); //dt = bll.GetAllDep("1=1"); dt = bll.GetUserWhereDepartment(userSession.USERNAME, -1); TreeNode rootNode = new TreeNode(); rootNode.Text = "部门用户树"; rootNode.Value = "0"; rootNode.Expanded = true; InitTreeView(rootNode, dt); this.trvControl.Nodes.Add(rootNode); }
/// <summary> /// 绑定单位信息 /// </summary> private void BindAcceptUnit(string type) { string url = string.Empty; if (type == "0") { url = "ArtificialPatrol.aspx"; } else { url = "ElectronicPatrol.aspx"; } DataTable dt = new DataTable(); //获取用户所属单位和下级部门 BLL.BASE_DEPT dept = new BLL.BASE_DEPT(); dt = dept.GetAllDep("STATUS=0"); foreach (DataRow dr in dt.Rows) { if (dr["PARENTID"].ToString().Equals("0")) { TreeNode rootNode = new TreeNode(); rootNode.Text = dr["DPTNAME"].ToString(); rootNode.Value = dr["DEPTID"].ToString(); rootNode.ToolTip = dr["DPTINFO"].ToString(); rootNode.ShowCheckBox = false; rootNode.Expanded = true; rootNode.Target = "PatrolFrame"; rootNode.NavigateUrl = url + "?deptid=" + dr["DEPTID"].ToString() + "&deptName=" + dr["DPTNAME"].ToString();//设置导航:绑定该部门下巡逻日志 //递归子节点 RecursiveBindAcceptUnit(rootNode, dt, url); //加入控件 TreeViewAcceptUnit.Nodes.Add(rootNode); } } }
/// <summary> /// 绑定用户信息 /// </summary> /// <param name="userId">用户ID</param> private void BindingUserInfo(int userId) { BLL.BASE_USER_ROLE userRoleBLL = new BLL.BASE_USER_ROLE(); var dt = userRoleBLL.GetList(userId); //获取用户权限集合 #region 绑定用户基本信息 BLL.BASE_USER userBLL = new BLL.BASE_USER(); Entity.BASE_USER userModel = new Entity.BASE_USER(); userModel = userBLL.GetUser(userId); this.BIRTHDAY = userModel.BIRTHDAY; this.DEGREE = userModel.DEGREE; this.DEPTID = userModel.DEPTID; this.FACE = userModel.FACE; this.IDNUMBER = userModel.IDNUMBER; this.JOBNUMBER = userModel.JOBNUMBER; this.PARENTID = userModel.PARENTID; this.PHONE = userModel.PHONE; this.PHOTO = userModel.PHONE; this.PROF = userModel.PROF; this.REMARK = userModel.REMARK; this.SEX = userModel.SEX; this.STSTUS = userModel.STSTUS; this.USERID = userModel.USERID; this.USERNAME = userModel.USERNAME; this.USERPWD = userModel.USERPWD; #endregion //绑定部门 BLL.BASE_DEPT deptBLL = new BLL.BASE_DEPT(); _Department = deptBLL.GetEntity(userModel.DEPTID); /* #region 绑定角色信息 * var roles = userRoleBLL.Query( * string.Format("SELECT distinct ROLEID FROM base_user_role WHERE userid = {0}", * userId.ToString())); * BLL.BASE_ROLE roleBll = new BLL.BASE_ROLE(); * foreach (DataRow dr in roles.Rows) { * Entity.BASE_ROLE roleModel = new Entity.BASE_ROLE(); * roleModel = roleBll.GetEntity(Convert.ToInt32(dr["ROLEID"])); * * Utility.UserRole role = new UserRole(); * role.ROLEID = roleModel.ROLEID; * role.ROLEINFO = roleModel.ROLEINFO; * role.ROLENAME = roleModel.ROLENAME; * #region 绑定菜单 * var menus = userRoleBLL.GetList(string.Format("USERID={0} AND ROLEID={1}", * userId.ToString(), * roleModel.ROLEID.ToString())); * BLL.BASE_MENU bllMenu = new BLL.BASE_MENU(); * foreach (DataRow menuDr in menus.Rows) { * Entity.BASE_MENU menuModel = new Entity.BASE_MENU(); * menuModel = bllMenu.GetEntity(Convert.ToInt32(menuDr["MENUID"])); * * Utility.UserMenu menu = new UserMenu(); * menu.ICON = menuModel.ICON; * menu.MENUID = menuModel.MENUID; * menu.MENUINFO = menuModel.MENUINFO; * menu.MENUNAME = menuModel.MENUNAME; * menu.MENUURL = menuModel.MENUURL; * menu.PARENTID = menuModel.PARENTID; * menu.STATUS = menuModel.STATUS; * #region 绑定菜单的Action * var actions = userRoleBLL.GetList(string.Format("USERID={0} AND ROLEID={1} AND MENUID={2}", * userId.ToString(), * roleModel.ROLEID.ToString(), * menu.MENUID.ToString())); * BLL.BASE_ACTION actionBLL = new BLL.BASE_ACTION(); * foreach (DataRow actionDr in actions.Rows) { * Entity.BASE_ACTION actionModel = new Entity.BASE_ACTION(); * actionModel = actionBLL.GetEntity(Convert.ToInt32(actionDr["ACTIONID"].ToString())); * * menu.UserAction.Add(actionModel); //动作信息加载菜单中 * } #endregion * * role.UserMenu.Add(menu); //菜单加入角色组中 * } #endregion * * UserRole.Add(role); //角色组加入集合中 * } #endregion */ }