From 766bbf50a9c8f7004027470a8b0cedc96af46253 Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Thu, 14 Oct 2021 15:22:43 +0200 Subject: [PATCH] Add new field ExternalId to the brand entity --- src/API/Grand.Api/DTOs/Catalog/BrandDto.cs | 1 + .../Services/ExportImport/ExportManager.cs | 3 ++- .../Services/ExportImport/ImportManager.cs | 3 +++ src/Core/Grand.Domain/Catalog/Brand.cs | 5 +++++ .../Admin/Views/Brand/_CreateOrUpdate.TabInfo.cshtml | 7 +++++++ src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs | 8 ++++---- src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml | 3 +++ 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/API/Grand.Api/DTOs/Catalog/BrandDto.cs b/src/API/Grand.Api/DTOs/Catalog/BrandDto.cs index 7d3fbe83c..b86971242 100644 --- a/src/API/Grand.Api/DTOs/Catalog/BrandDto.cs +++ b/src/API/Grand.Api/DTOs/Catalog/BrandDto.cs @@ -20,6 +20,7 @@ public partial class BrandDto : BaseApiEntityModel public bool IncludeInMenu { get; set; } public string Icon { get; set; } public bool Published { get; set; } + public string ExternalId { get; set; } public int DisplayOrder { get; set; } } } diff --git a/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs b/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs index af0abf882..36cf75ea2 100644 --- a/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs +++ b/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs @@ -74,7 +74,8 @@ public virtual byte[] ExportBrandsToXlsx(IEnumerable brands) new PropertyByName("AllowCustomersToSelectPageSize", p => p.AllowCustomersToSelectPageSize), new PropertyByName("PageSizeOptions", p => p.PageSizeOptions), new PropertyByName("Published", p => p.Published), - new PropertyByName("DisplayOrder", p => p.DisplayOrder) + new PropertyByName("DisplayOrder", p => p.DisplayOrder), + new PropertyByName("ExternalId", p => p.ExternalId) }; return ExportToXlsx(properties, brands); diff --git a/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs b/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs index 2fc551875..d4d945a62 100644 --- a/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs +++ b/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs @@ -701,6 +701,9 @@ protected virtual void PrepareBrandMapping(Brand brand, PropertyManager m case "displayorder": brand.DisplayOrder = property.IntValue; break; + case "externalid": + brand.ExternalId = property.StringValue; + break; } } } diff --git a/src/Core/Grand.Domain/Catalog/Brand.cs b/src/Core/Grand.Domain/Catalog/Brand.cs index 210d2a2d1..f4d707827 100644 --- a/src/Core/Grand.Domain/Catalog/Brand.cs +++ b/src/Core/Grand.Domain/Catalog/Brand.cs @@ -112,6 +112,11 @@ public Brand() public bool LimitedToStores { get; set; } public IList Stores { get; set; } + /// + /// Gets or sets the ExternalId + /// + public string ExternalId { get; set; } + /// /// Gets or sets a value indicating whether the entity is published /// diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/_CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/_CreateOrUpdate.TabInfo.cshtml index 56b581486..2b53c19a4 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/_CreateOrUpdate.TabInfo.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/_CreateOrUpdate.TabInfo.cshtml @@ -201,6 +201,13 @@ +
+ +
+ + +
+
\ No newline at end of file diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs index 67fd3b5af..5a63a136e 100644 --- a/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs +++ b/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs @@ -24,15 +24,12 @@ public BrandModel() } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.Name")] - public string Name { get; set; } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.Description")] - public string Description { get; set; } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.BottomDescription")] - public string BottomDescription { get; set; } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.BrandLayout")] @@ -40,7 +37,6 @@ public BrandModel() public IList AvailableBrandLayouts { get; set; } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.MetaKeywords")] - public string MetaKeywords { get; set; } [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.MetaDescription")] @@ -84,6 +80,9 @@ public BrandModel() [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.DisplayOrder")] public int DisplayOrder { get; set; } + [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.ExternalId")] + public string ExternalId { get; set; } + public IList Locales { get; set; } //ACL @@ -143,5 +142,6 @@ public partial class BrandLocalizedModel : ILocalizedModelLocal, ISlugModelLocal [GrandResourceDisplayName("Admin.Catalog.Brands.Fields.SeName")] public string SeName { get; set; } + } } \ No newline at end of file diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml index dfac5cf64..43a279236 100644 --- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml +++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml @@ -2013,6 +2013,9 @@ Display order + + External identifier + Icon