Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch dev with rel-4.4 #9486

Merged
merged 3 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,17 +494,17 @@ protected virtual async Task DeleteEntityAsync(TListViewModel entity)
await HandleErrorAsync(ex);
}
}

protected virtual Task OnDeletingEntityAsync()
{
return Task.CompletedTask;
}

protected virtual async Task OnDeletedEntityAsync()
{
await GetEntitiesAsync();
await InvokeAsync(StateHasChanged);
}
}

protected virtual string GetDeleteConfirmationMessage(TListViewModel entity)
{
Expand Down Expand Up @@ -596,7 +596,7 @@ protected virtual IEnumerable<TableColumn> GetExtensionTableColumns(string modul
if (propertyInfo.Type.IsEnum)
{
column.ValueConverter = (val) =>
EnumHelper.GetLocalizedMemberName(propertyInfo.Type, val, StringLocalizerFactory);
EnumHelper.GetLocalizedMemberName(propertyInfo.Type, val.As<ExtensibleObject>().ExtraProperties[propertyInfo.Name], StringLocalizerFactory);
}

yield return column;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

namespace Volo.Abp.Data
{
public static class ExtraPropertyDictionaryExtensions
{
public static T ToEnum<T>(this ExtraPropertyDictionary extraPropertyDictionary, string key)
where T : Enum
{
if (extraPropertyDictionary[key].GetType() == typeof(T))
{
return (T)extraPropertyDictionary[key];
}

extraPropertyDictionary[key] = Enum.Parse(typeof(T), extraPropertyDictionary[key].ToString(), ignoreCase: true);
return (T)extraPropertyDictionary[key];
}

public static object ToEnum(this ExtraPropertyDictionary extraPropertyDictionary, string key, Type enumType)
{
if (!enumType.IsEnum || extraPropertyDictionary[key].GetType() == enumType)
{
return extraPropertyDictionary[key];
}

extraPropertyDictionary[key] = Enum.Parse(enumType, extraPropertyDictionary[key].ToString(), ignoreCase: true);
return extraPropertyDictionary[key];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.Role.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.Role.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.UserInfo.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.UserInfo.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.Tenant.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
{
Model.Tenant.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
Expand Down