public ActionResult Query() { SetPage(); var result = userService.Gettb_Sys_UserList(PageModel); //var result = from a in entity.UserInfoes // join b in entity.CompanyInfoes on a.CompCode equals b.CompCode // select // new UserInfoDto() // { // CompCode = b.Name, // UserCode = a.UserCode, // UserName = a.UserName, // Position = a.Position, // Phone = a.Phone, // Mail = a.Mail, // BirthDay = a.BirthDay, // Remarks = a.Remarks, // CreateDt = a.CreateDt, // CreateUser = a.CreateUser // }; //result = result.OrderBy(a => a.CreateDt).Skip((MyPage.Page - 1)*MyPage.PageSize).Take(MyPage.PageSize); return(ToDataGridResult(result, PageModel.ItemCount)); }
/// <summary> /// 添加用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles; A004_RoleControlEdit frmedit = new A004_RoleControlEdit("AddUser", role.Id); if (frmedit.ShowDialog() == DialogResult.OK) { List <Guid> listUserID = userRoleService.GetByRoleId(role.Id).Select(i => i.UserId).ToList(); //ServiceHelper.Current.DbSession.Itb_Sys_UserRoleDAL.GetListBy(r => r.RoleID == role.RoleID).Select(r => r.UserID).ToList(); gridcontrolUser.DataSource = userService.Gettb_Sys_UserList().Where(i => listUserID.Contains(i.Id)).ToList(); //ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(r => listUserID.Contains(r.UserID)); } }
//绑定数据 private void BindData() { if (toolCommand == "AddMenu") { this.Text = "添加菜单"; treeListColumn1.FieldName = "Id"; treeListColumn2.FieldName = "MenuName"; treeList1.ParentFieldName = "ParentMenuId"; treeList1.KeyFieldName = "Id"; listmenuID = roleRightService.Gettb_Sys_RolesRightList().Where(i => i.Roles_Id == sys_roleid).Select(i => i.Menu_Id).ToList(); //ServiceHelper.Current.DbSession.Itb_Sys_RoleModuleDAL.GetListBy(r => r.RoleID == sys_roleid).Select(r => r.ModuleID).ToList(); this.treeList1.DataSource = this.menuService.Gettb_Sys_MenuList(); //ServiceHelper.Current.DbSession.Itb_Sys_ModuleDAL.GetListBy(m => m.State != false); this.treeList1.ExpandAll(); foreach (TreeListNode node in treeList1.Nodes) { Guid moduleId = node.GetValue(treeListColumn1).ToStr().ToGuid(); //获取PermissionID if (listmenuID.Contains(moduleId)) { node.Checked = true; SetTreeListChecks(node); } else { node.Checked = false; SetTreeListChecks(node); } } } else if (toolCommand == "AddAction") { this.Text = "添加按钮"; treeListColumn1.FieldName = "Id"; treeListColumn2.FieldName = "Btn_Name"; listmenuID = buttonService.GetButtonsByMenu(sys_roleid, sys_moduleId).Select(i => i.Id).ToList(); this.treeList1.DataSource = buttonService.Gettb_Sys_ButtonList(); // ServiceHelper.Current.DbSession.Itb_Sys_ActionDAL.GetListBy(m => m.ActionID != null ); foreach (TreeListNode node in treeList1.Nodes) { Guid buttonId = node.GetValue(treeListColumn1).ToStr().ToGuid(); //获取PermissionID if (listmenuID.Contains(buttonId)) { node.Checked = true; SetTreeListChecks(node); } else { node.Checked = false; SetTreeListChecks(node); } } } else if (toolCommand == "AddUser") { this.Text = "添加按钮"; treeListColumn1.FieldName = "Id"; treeListColumn2.FieldName = "UserName"; this.treeList1.DataSource = userService.Gettb_Sys_UserList();//ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(m => m.State != false); } else if (toolCommand == "AddControl") { this.Text = "添加Control"; treeListColumn1.FieldName = "Id"; treeListColumn2.FieldName = "Windows"; treeListColumn3.FieldName = "Control"; treeListColumn4.FieldName = "CValue"; treeListColumn3.Visible = true; treeListColumn4.Visible = true; this.treeList1.DataSource = controlService.GetList();//ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(m => m.State != false); } }