32 changed files with 413 additions and 296 deletions
@ -0,0 +1,8 @@ |
|||||
|
namespace Lion.AbpPro; |
||||
|
|
||||
|
public class AbpProLocalizationErrorCodes |
||||
|
{ |
||||
|
public const string ErrorCode100001 = AbpProLocalizationConsts.NameSpace + ":100001"; |
||||
|
public const string ErrorCode100002 = AbpProLocalizationConsts.NameSpace + ":100002"; |
||||
|
public const string ErrorCode100003 = AbpProLocalizationConsts.NameSpace + ":100003"; |
||||
|
} |
||||
@ -1,9 +1,20 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.OrganizationUnits.Dto; |
namespace Lion.AbpPro.BasicManagement.OrganizationUnits.Dto; |
||||
|
|
||||
public class CreateOrganizationUnitInput |
public class CreateOrganizationUnitInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public string DisplayName { get; set; } |
public string DisplayName { get; set; } |
||||
|
|
||||
public Guid? ParentId { get; set; } |
public Guid? ParentId { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (DisplayName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayName)], |
||||
|
new[] { nameof(DisplayName) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
@ -1,9 +1,20 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.OrganizationUnits.Dto; |
namespace Lion.AbpPro.BasicManagement.OrganizationUnits.Dto; |
||||
|
|
||||
public class UpdateOrganizationUnitInput |
public class UpdateOrganizationUnitInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public string DisplayName { get; set; } |
public string DisplayName { get; set; } |
||||
|
|
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (DisplayName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayName)], |
||||
|
new[] { nameof(DisplayName) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
@ -1,10 +1,28 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Roles.Dtos |
namespace Lion.AbpPro.BasicManagement.Roles.Dtos |
||||
{ |
{ |
||||
public class GetPermissionInput |
public class GetPermissionInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public string ProviderName { get; set; } |
public string ProviderName { get; set; } |
||||
[Required] |
|
||||
public string ProviderKey { get; set; } |
public string ProviderKey { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (ProviderName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderName)], |
||||
|
new[] { nameof(ProviderName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (ProviderKey.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderKey)], |
||||
|
new[] { nameof(ProviderKey) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,13 +1,31 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Roles.Dtos |
namespace Lion.AbpPro.BasicManagement.Roles.Dtos |
||||
{ |
{ |
||||
public class UpdateRolePermissionsInput |
public class UpdateRolePermissionsInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public string ProviderName { get; set; } |
public string ProviderName { get; set; } |
||||
|
|
||||
[Required] |
|
||||
public string ProviderKey { get; set; } |
public string ProviderKey { get; set; } |
||||
|
|
||||
public UpdatePermissionsDto UpdatePermissionsDto { get; set; } |
public UpdatePermissionsDto UpdatePermissionsDto { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (ProviderName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderName)], |
||||
|
new[] { nameof(ProviderName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (ProviderKey.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderKey)], |
||||
|
new[] { nameof(ProviderKey) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,8 +1,20 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Tenants.Dtos |
namespace Lion.AbpPro.BasicManagement.Tenants.Dtos |
||||
{ |
{ |
||||
public class UpdateConnectionStringInput |
public class UpdateConnectionStringInput : IValidatableObject |
||||
{ |
{ |
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
[Required(ErrorMessage = "连接字符串不能为空")] public string ConnectionString { get; set; } |
public string ConnectionString { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (ConnectionString.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ConnectionString)], |
||||
|
new[] { nameof(ConnectionString) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,9 +1,21 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Tenants.Dtos |
namespace Lion.AbpPro.BasicManagement.Tenants.Dtos |
||||
{ |
{ |
||||
public class UpdateTenantInput |
public class UpdateTenantInput : IValidatableObject |
||||
{ |
{ |
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
|
|
||||
[Required(ErrorMessage = "租户名称不能为空")] public string Name { get; set; } |
public string Name { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (Name.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Name)], |
||||
|
new[] { nameof(Name) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,99 +0,0 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Users.Dtos; |
|
||||
|
|
||||
public class LoginGithubResponse |
|
||||
{ |
|
||||
public string login { get; set; } |
|
||||
|
|
||||
|
|
||||
public int id { get; set; } |
|
||||
|
|
||||
|
|
||||
public string node_id { get; set; } |
|
||||
|
|
||||
|
|
||||
public string avatar_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string gravatar_id { get; set; } |
|
||||
|
|
||||
|
|
||||
public string url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string html_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string followers_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string following_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string gists_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string starred_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string subscriptions_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string organizations_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string repos_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string events_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string received_events_url { get; set; } |
|
||||
|
|
||||
|
|
||||
public string type { get; set; } |
|
||||
|
|
||||
|
|
||||
public string site_admin { get; set; } |
|
||||
|
|
||||
|
|
||||
public string name { get; set; } |
|
||||
|
|
||||
|
|
||||
public string company { get; set; } |
|
||||
|
|
||||
|
|
||||
public string blog { get; set; } |
|
||||
|
|
||||
|
|
||||
public string location { get; set; } |
|
||||
|
|
||||
|
|
||||
public string email { get; set; } |
|
||||
|
|
||||
|
|
||||
public string hireable { get; set; } |
|
||||
|
|
||||
|
|
||||
public string bio { get; set; } |
|
||||
|
|
||||
|
|
||||
public string twitter_username { get; set; } |
|
||||
|
|
||||
|
|
||||
public int public_repos { get; set; } |
|
||||
|
|
||||
|
|
||||
public int public_gists { get; set; } |
|
||||
|
|
||||
|
|
||||
public int followers { get; set; } |
|
||||
|
|
||||
|
|
||||
public int following { get; set; } |
|
||||
|
|
||||
|
|
||||
public string created_at { get; set; } |
|
||||
|
|
||||
|
|
||||
public string updated_at { get; set; } |
|
||||
} |
|
||||
@ -1,21 +0,0 @@ |
|||||
namespace Lion.AbpPro.BasicManagement.Users.Dtos |
|
||||
{ |
|
||||
public class LoginStsResponse |
|
||||
{ |
|
||||
public string name { get; set; } |
|
||||
|
|
||||
public string preferred_username { get; set; } |
|
||||
|
|
||||
public string family_name { get; set; } |
|
||||
|
|
||||
public string email { get; set; } |
|
||||
|
|
||||
public string given_name { get; set; } |
|
||||
|
|
||||
public string avatar { get; set; } |
|
||||
|
|
||||
public string sub { get; set; } |
|
||||
|
|
||||
public Guid? tenantId { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,14 +1,33 @@ |
|||||
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
||||
{ |
{ |
||||
public class CreateDataDictinaryDetailInput |
public class CreateDataDictinaryDetailInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
[Required] |
|
||||
public string Code { get; set; } |
public string Code { get; set; } |
||||
[Required] |
|
||||
public string DisplayText { get; set; } |
public string DisplayText { get; set; } |
||||
public string Description { get; set; } |
public string Description { get; set; } |
||||
public int Order { get; set; } |
public int Order { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (Code.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Code)], |
||||
|
new[] { nameof(Code) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (DisplayText.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayText)], |
||||
|
new[] { nameof(DisplayText) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,11 +1,29 @@ |
|||||
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
||||
{ |
{ |
||||
public class CreateDataDictinaryInput |
public class CreateDataDictinaryInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public string Code { get; set; } |
public string Code { get; set; } |
||||
[Required] |
|
||||
public string DisplayText { get; set; } |
public string DisplayText { get; set; } |
||||
public string Description { get; set; } |
public string Description { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (Code.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Code)], |
||||
|
new[] { nameof(Code) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (DisplayText.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayText)], |
||||
|
new[] { nameof(DisplayText) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,13 +1,32 @@ |
|||||
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
||||
{ |
{ |
||||
public class UpdateDataDictinaryInput |
public class UpdateDataDictinaryInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] |
|
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
[Required] |
|
||||
public string Code { get; set; } |
public string Code { get; set; } |
||||
[Required] |
|
||||
public string DisplayText { get; set; } |
public string DisplayText { get; set; } |
||||
public string Description { get; set; } |
public string Description { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (Code.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Code)], |
||||
|
new[] { nameof(Code) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (DisplayText.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayText)], |
||||
|
new[] { nameof(DisplayText) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,16 +1,28 @@ |
|||||
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos |
||||
{ |
{ |
||||
public class UpdateDetailInput |
public class UpdateDetailInput : IValidatableObject |
||||
{ |
{ |
||||
[Required] public Guid DataDictionaryId { get; set; } |
public Guid DataDictionaryId { get; set; } |
||||
|
|
||||
[Required] public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
|
|
||||
[Required] public string DisplayText { get; set; } |
public string DisplayText { get; set; } |
||||
|
|
||||
public string Description { get; set; } |
public string Description { get; set; } |
||||
|
|
||||
public int Order { get; set; } |
public int Order { get; set; } |
||||
} |
|
||||
} |
|
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
|
||||
|
if (DisplayText.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayText)], |
||||
|
new[] { nameof(DisplayText) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,30 +1,63 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
|
||||
|
|
||||
namespace Lion.AbpPro.LanguageManagement.LanguageTexts; |
namespace Lion.AbpPro.LanguageManagement.LanguageTexts; |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 创建语言文本
|
/// 创建语言文本
|
||||
/// </summary>
|
/// </summary>
|
||||
public class CreateLanguageTextInput |
public class CreateLanguageTextInput : IValidatableObject |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 资源名称
|
/// 资源名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "资源名称不能为空")] |
public string ResourceName { get; set; } |
||||
public string ResourceName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 语言名称
|
/// 语言名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "语言名称不能为空")] |
public string CultureName { get; set; } |
||||
public string CultureName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 名称
|
/// 名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "名称不能为空")] |
public string Name { get; set; } |
||||
public string Name { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 值
|
/// 值
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "值不能为空")] |
public string Value { get; set; } |
||||
public string Value { get; set; } |
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (CultureName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(CultureName)], |
||||
|
new[] { nameof(CultureName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (ResourceName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ResourceName)], |
||||
|
new[] { nameof(ResourceName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (Name.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Name)], |
||||
|
new[] { nameof(Name) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (Value.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(Value)], |
||||
|
new[] { nameof(Value) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
@ -1,34 +1,60 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
|
||||
|
|
||||
namespace Lion.AbpPro.LanguageManagement.Languages; |
namespace Lion.AbpPro.LanguageManagement.Languages; |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 创建语言
|
/// 创建语言
|
||||
/// </summary>
|
/// </summary>
|
||||
public class CreateLanguageInput |
public class CreateLanguageInput : IValidatableObject |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 语言名称
|
/// 语言名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "语言名称不能为空")] |
public string CultureName { get; set; } |
||||
public string CultureName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// Ui语言名称
|
/// Ui语言名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "Ui语言名称不能为空")] |
public string UiCultureName { get; set; } |
||||
public string UiCultureName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 显示名称
|
/// 显示名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "显示名称不能为空")] |
public string DisplayName { get; set; } |
||||
public string DisplayName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 图标
|
/// 图标
|
||||
/// </summary>
|
/// </summary>
|
||||
public string FlagIcon { get; set; } |
public string FlagIcon { get; set; } |
||||
/// <summary>
|
|
||||
/// 是否启用
|
/// <summary>
|
||||
/// </summary>
|
/// 是否启用
|
||||
[Required(ErrorMessage = "是否启用不能为空")] |
/// </summary>
|
||||
public bool IsEnabled { get; set; } |
public bool IsEnabled { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (CultureName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(CultureName)], |
||||
|
new[] { nameof(CultureName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (UiCultureName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(UiCultureName)], |
||||
|
new[] { nameof(UiCultureName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (DisplayName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayName)], |
||||
|
new[] { nameof(DisplayName) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
@ -1,39 +1,65 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
|
||||
|
|
||||
namespace Lion.AbpPro.LanguageManagement.Languages; |
namespace Lion.AbpPro.LanguageManagement.Languages; |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 删除语言
|
/// 删除语言
|
||||
/// </summary>
|
/// </summary>
|
||||
public class UpdateLanguageInput |
public class UpdateLanguageInput : IValidatableObject |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 语言Id
|
/// 语言Id
|
||||
/// </summary>
|
/// </summary>
|
||||
public Guid Id { get; set; } |
public Guid Id { get; set; } |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 语言名称
|
/// 语言名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "语言名称不能为空")] |
public string CultureName { get; set; } |
||||
public string CultureName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// Ui语言名称
|
/// Ui语言名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "Ui语言名称不能为空")] |
public string UiCultureName { get; set; } |
||||
public string UiCultureName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 显示名称
|
/// 显示名称
|
||||
/// </summary>
|
/// </summary>
|
||||
[Required(ErrorMessage = "显示名称不能为空")] |
public string DisplayName { get; set; } |
||||
public string DisplayName { get; set; } |
|
||||
/// <summary>
|
/// <summary>
|
||||
/// 图标
|
/// 图标
|
||||
/// </summary>
|
/// </summary>
|
||||
public string FlagIcon { get; set; } |
public string FlagIcon { get; set; } |
||||
/// <summary>
|
|
||||
/// 是否启用
|
/// <summary>
|
||||
/// </summary>
|
/// 是否启用
|
||||
[Required(ErrorMessage = "是否启用不能为空")] |
/// </summary>
|
||||
public bool IsEnabled { get; set; } |
public bool IsEnabled { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); |
||||
|
if (CultureName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(CultureName)], |
||||
|
new[] { nameof(CultureName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (UiCultureName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(UiCultureName)], |
||||
|
new[] { nameof(UiCultureName) } |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
if (DisplayName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(DisplayName)], |
||||
|
new[] { nameof(DisplayName) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
Loading…
Reference in new issue