Esempio n. 1
0
 public UserLoginItemDto(UserLogin item)
 {
     id = item.Id;
     fullName = item.User.FullName;
     userId = item.User.Id;
     date = item.Date;
 }
Esempio n. 2
0
 protected void AddRecordToUserLogin(User user,UserRole roleId)
 {
     var userLogin = new UserLogin(user) {RoleId = (int) roleId};
     UserLoginDao.MergeAndFlush(userLogin);
 }
Esempio n. 3
0
 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);
         }
     }
 }