using System.Collections.Generic; using Abp.Application.Services.Dto; using Abp.AutoMapper; using WeOnlineApp.Authorization.Users; using IwbZero.Runtime.Session; namespace WeOnlineApp.BaseSystem.Sessions.Dto { [AutoMapFrom(typeof(User))] public class UserLoginInfoDto : EntityDto { public string Name { get; set; } public string Surname { get; set; } public string UserName { get; set; } public string EmailAddress { get; set; } public string AvatarImagePath { get; set; } public int? AccountType { get; set; } public string AccountNo { get; set; } public int? UserType { get; set; } public List UserRoles { get; set; } public List UserRoleIds { get; set; } } public static class UserLoginInfoDtoExtensions { public static UserLoginInfoDto GetCurrentUser(this IIwbSession abpSession) { if (!abpSession.UserId.HasValue) { return null; } var dto = new UserLoginInfoDto() { Name = abpSession.RealName, UserName = abpSession.UserName, EmailAddress = abpSession.EmailAddress, AvatarImagePath = abpSession.AvatarImagePath, UserType = abpSession.UserType, AccountType = abpSession.AccountType, AccountNo = abpSession.AccountNo, UserRoles = abpSession.UserRoles, UserRoleIds = abpSession.UserRoleIds, }; return dto; } } }