Try to use attributes for enum to string conversion

This commit is contained in:
2025-11-05 11:34:38 +09:00
parent 3d3ee858c4
commit 0169e5724d
2 changed files with 6 additions and 17 deletions

View File

@ -40,11 +40,7 @@
</Template>
<Columns>
<RadzenDataGridColumn TItem="Campaign" Property="Id" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
<RadzenDataGridColumn TItem="Campaign" Property="Type" Title="Тип кампании">
<Template Context="campaign">
@CampaignTypeToString(campaign.Type)
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Campaign" Property="Type" Title="Тип кампании" />
<RadzenDataGridColumn TItem="Campaign" Property="CreatedAt" Title="Дата создания" Resizable="false" Width="150px" MaxWidth="150px" />
<RadzenDataGridColumn TItem="Campaign" Property="StartedAt" Title="Дата начала" Resizable="false" Width="150px" MaxWidth="150px" />
<RadzenDataGridColumn TItem="Campaign" Property="StartedAt" Title="Дата окончания" Resizable="false" Width="150px" MaxWidth="150px" />
@ -127,17 +123,6 @@
});
}
string CampaignTypeToString(Campaign.CampaignType campaignType)
{
return campaignType switch
{
Campaign.CampaignType.ExportPrivateRegistryElements_15_7_0_1 => "Экспорт частных справочников",
Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1 => "Экспорт общих справочников",
_ => "???"
};
}
public void Dispose()
{
CampaignManagementState.OnCampaignCreated -= OnCampaignCreated;