예제 #1
0
 public UserLoginItemDto(UserLogin item)
 {
     id = item.Id;
     fullName = item.User.FullName;
     userId = item.User.Id;
     date = item.Date;
 }
예제 #2
0
파일: LoginBL.cs 프로젝트: andreyu/Reports
 protected void AddRecordToUserLogin(User user,UserRole roleId)
 {
     var userLogin = new UserLogin(user) {RoleId = (int) roleId};
     UserLoginDao.MergeAndFlush(userLogin);
 }
예제 #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);
         }
     }
 }