public UserLoginItemDto(UserLogin item) { id = item.Id; fullName = item.User.FullName; userId = item.User.Id; date = item.Date; }
protected void AddRecordToUserLogin(User user,UserRole roleId) { var userLogin = new UserLogin(user) {RoleId = (int) roleId}; UserLoginDao.MergeAndFlush(userLogin); }
public void SetUserRole(int roleId) { var accounts = UserDao.GetAllUserRoles(CurrentUser.Id); if (accounts != null) { var users = accounts.Where(x => (x.RoleId & roleId) > 0); int userid = 0; if (users != null) userid = users.First().UserId; if (userid > 0) { var user = UserDao.Load(userid); var dto = AuthenticationService.CreateUser(user, (UserRole)roleId); AuthenticationService.setAuthTicket(dto); var userLogin = new UserLogin(user) { RoleId = (int)roleId }; UserLoginDao.MergeAndFlush(userLogin); } } }