public ActionResult ScanRole(int id) { // 创建物业用户角色模型 PropertyUserRoleModel userRoleModel = new PropertyUserRoleModel(); IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); // 根据指定id值获取实体对象 var userInfo = propertyUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); userRoleModel.User = new PropertyUserModel() { UserName = userInfo.UserName, UserId = userInfo.Id, TrueName = userInfo.TrueName }; // 获取用户已分配的角色id列表 var selectedRoleList = userInfo.PropertyUserRoles.Select(m => m.RoleId).ToList(); userRoleModel.RoleIds = selectedRoleList; // 获取所有物业角色 IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //排序 var sortModel = this.SettingSorting("Id", false); var roleList = propertyRoleBll.GetList(p => true, sortModel.SortName, sortModel.IsAsc).ToList(); userRoleModel.RoleList = roleList; return(View(userRoleModel)); }
public ActionResult ConfigRole(int id) { // 创建物业用户角色模型 PropertyUserRoleModel userRoleModel = new PropertyUserRoleModel(); // 获取指定id的物业用户模型 IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser propertyUser = propertyUserBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); userRoleModel.User = new PropertyUserModel() { UserId = propertyUser.Id, UserName = propertyUser.UserName, TrueName = propertyUser.TrueName, Tel = propertyUser.Tel, Phone = propertyUser.Phone, Memo = propertyUser.Memo, Email = propertyUser.Email }; // 获取本小区中所有的物业角色 IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //排序 var sortModel = this.SettingSorting("Id", false); var roleList = propertyRoleBll.GetList(p => p.PropertyPlaceId == propertyUser.PropertyPlaceId && p.IsSystem == ConstantParam.USER_ROLE_DEFAULT, sortModel.SortName, sortModel.IsAsc).ToList(); userRoleModel.RoleList = roleList; //获取该用户已分配的角色id的集合 userRoleModel.RoleIds = propertyUser.PropertyUserRoles.Select(m => m.RoleId).ToList(); return(View(userRoleModel)); }