using Abp.Auditing; using Abp.AutoMapper; using Abp.Runtime.Validation; using System.ComponentModel.DataAnnotations; using VberZero.AppService.Base.Dto; using VberZero.BaseSystem.Users; namespace VberZero.AppService.Users.Dto; [AutoMapTo(typeof(User))] public class CreateUserDto : VzEntityDto, IShouldNormalize { public CreateUserDto() { Gender = VzDefinition.GenderType.Man; AccountType = VzDefinition.AccountType.Client; UserType = VzDefinition.UserType.Ordinary; } [StringLength(User.MaxUserNameLength)] public string UserName { get; set; } [StringLength(User.MaxNameLength)] public string Name { get; set; } = ""; [Required] [StringLength(User.MaxSurnameLength)] public string Surname { get; set; } [Required] [EmailAddress] [StringLength(User.MaxEmailAddressLength)] public string EmailAddress { get; set; } [StringLength(User.MaxPhoneNumberLength)] public string PhoneNumber { get; set; } public VzDefinition.GenderType Gender { get; set; } public VzDefinition.UserType UserType { get; set; } public VzDefinition.AccountType AccountType { get; set; } public string AccountNo { get; set; } public bool IsActive { get; set; } public string[] RoleNames { get; set; } public string[] PermissionNames { get; set; } [StringLength(User.MaxPlainPasswordLength)] [DisableAuditing] public string Password { get; set; } public void Normalize() { if (RoleNames != null) return; RoleNames = Array.Empty(); } }