Skip to content

Commit 892f294

Browse files
committed
Creating an import profile
1 parent 09ad4aa commit 892f294

19 files changed

Lines changed: 677 additions & 175 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace SmartStore.Core.Domain.DataExchange
2+
{
3+
/// <summary>
4+
/// Supported entity types
5+
/// </summary>
6+
public enum ImportEntityType
7+
{
8+
Product = 0,
9+
Customer,
10+
NewsLetterSubscription
11+
}
12+
}

src/Libraries/SmartStore.Core/Domain/DataExchange/ImportProfile.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using SmartStore.Core.Domain.Tasks;
1+
using SmartStore.Core.Domain.DataExchange;
2+
using SmartStore.Core.Domain.Tasks;
23

34
namespace SmartStore.Core.Domain
45
{
@@ -15,9 +16,24 @@ public class ImportProfile : BaseEntity
1516
public string FolderName { get; set; }
1617

1718
/// <summary>
18-
/// The type of the entity
19+
/// The identifier of the entity type
1920
/// </summary>
20-
public string EntityType { get; set; }
21+
public int EntityTypeId { get; set; }
22+
23+
/// <summary>
24+
/// The entity type
25+
/// </summary>
26+
public ImportEntityType EntityType
27+
{
28+
get
29+
{
30+
return (ImportEntityType)EntityTypeId;
31+
}
32+
set
33+
{
34+
EntityTypeId = (int)value;
35+
}
36+
}
2137

2238
/// <summary>
2339
/// Whether the profile is enabled

src/Libraries/SmartStore.Core/SmartStore.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
<Compile Include="Domain\Catalog\PriceDisplayType.cs" />
169169
<Compile Include="Domain\Customers\CustomerNumberVisibility.cs" />
170170
<Compile Include="Domain\Customers\CustomerNumberMethod.cs" />
171+
<Compile Include="Domain\DataExchange\ImportEnums.cs" />
171172
<Compile Include="Domain\DataExchange\ImportProfile.cs" />
172173
<Compile Include="Domain\DataExchange\SyncMapping.cs" />
173174
<Compile Include="Domain\DataExchange\DataExchangeSettings.cs" />

src/Libraries/SmartStore.Data/Mapping/DataExchange/ImportProfileMap.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ public ImportProfileMap()
1212

1313
this.Property(x => x.Name).IsRequired().HasMaxLength(100);
1414
this.Property(x => x.FolderName).IsRequired().HasMaxLength(100);
15-
this.Property(x => x.EntityType).IsRequired().HasMaxLength(100);
1615
this.Property(x => x.FileTypeConfiguration).IsMaxLength();
1716
this.Property(x => x.ColumnMapping).IsMaxLength();
1817

18+
this.Ignore(x => x.EntityType);
19+
1920
this.HasRequired(x => x.ScheduleTask)
2021
.WithMany()
2122
.HasForeignKey(x => x.SchedulingTaskId)

src/Libraries/SmartStore.Data/Migrations/201512091408315_ImportFramework.resx

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/Libraries/SmartStore.Data/Migrations/201512091408315_ImportFramework.Designer.cs renamed to src/Libraries/SmartStore.Data/Migrations/201512101150534_ImportFramework.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Libraries/SmartStore.Data/Migrations/201512091408315_ImportFramework.cs renamed to src/Libraries/SmartStore.Data/Migrations/201512101150534_ImportFramework.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public override void Up()
1616
Id = c.Int(nullable: false, identity: true),
1717
Name = c.String(nullable: false, maxLength: 100),
1818
FolderName = c.String(nullable: false, maxLength: 100),
19-
EntityType = c.String(nullable: false, maxLength: 100),
19+
EntityTypeId = c.Int(nullable: false),
2020
Enabled = c.Boolean(nullable: false),
2121
Skip = c.Int(nullable: false),
2222
Take = c.Int(nullable: false),
@@ -59,14 +59,15 @@ public void Seed(SmartObjectContext context)
5959

6060
public void MigrateLocaleResources(LocaleResourcesBuilder builder)
6161
{
62-
builder.AddOrUpdate("Common.Files", "Files", "Dateien");
63-
6462
builder.AddOrUpdate("Admin.Common.RecordsSkip",
6563
"Skip",
6664
"Überspringen",
6765
"Specifies the number of records to be skipped.",
6866
"Legt die Anzahl der zu überspringenden Datensätze fest.");
6967

68+
builder.AddOrUpdate("Admin.Common.ImportFile", "Import file", "Importdatei");
69+
builder.AddOrUpdate("Admin.Common.ImportFiles", "Import files", "Importdateien");
70+
7071
builder.AddOrUpdate("Admin.Common.RecordsTake",
7172
"Limit",
7273
"Begrenzen",
@@ -77,10 +78,6 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
7778
"There were no import profiles found.",
7879
"Es wurden keine Importprofile gefunden.");
7980

80-
builder.AddOrUpdate("Admin.DataExchange.Import.FolderName.Validate",
81-
"Please enter a valid folder name.",
82-
"Bitte einen gültigen Ordnernamen eingeben.");
83-
8481
builder.AddOrUpdate("Admin.DataExchange.Import.Name",
8582
"Name of profile",
8683
"Name des Profils",
@@ -99,6 +96,19 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
9996
"Specifies whether to delete import files after an import.",
10097
"Legt fest, ob die Importdateien nach einem Import gelöscht werden sollen.");
10198

99+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ImportEntityType.Product", "Product", "Produkt");
100+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ImportEntityType.Customer", "Customer", "Kunde");
101+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ImportEntityType.NewsLetterSubscription", "Newsletter Subscribers", "Newsletter Abonnenten");
102+
103+
builder.AddOrUpdate("Admin.DataExchange.Import.FileUpload",
104+
"Upload import file...",
105+
"Importdatei hochladen...");
106+
107+
builder.AddOrUpdate("Admin.DataExchange.Import.MissingImportFile",
108+
"Please upload an import file.",
109+
"Bitte laden Sie eine Importdatei hoch.");
110+
111+
102112
builder.Delete(
103113
"Admin.DataExchange.Export.LastExecution",
104114
"Admin.DataExchange.Export.Offset",

src/Libraries/SmartStore.Data/Migrations/201512101150534_ImportFramework.resx

Lines changed: 126 additions & 0 deletions
Large diffs are not rendered by default.

src/Libraries/SmartStore.Data/SmartStore.Data.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@
372372
<Compile Include="Migrations\201511271019577_ExportFramework3.Designer.cs">
373373
<DependentUpon>201511271019577_ExportFramework3.cs</DependentUpon>
374374
</Compile>
375-
<Compile Include="Migrations\201512091408315_ImportFramework.cs" />
376-
<Compile Include="Migrations\201512091408315_ImportFramework.Designer.cs">
377-
<DependentUpon>201512091408315_ImportFramework.cs</DependentUpon>
375+
<Compile Include="Migrations\201512101150534_ImportFramework.cs" />
376+
<Compile Include="Migrations\201512101150534_ImportFramework.Designer.cs">
377+
<DependentUpon>201512101150534_ImportFramework.cs</DependentUpon>
378378
</Compile>
379379
<Compile Include="Setup\Builder\PermissionMigrator.cs" />
380380
<Compile Include="Setup\Builder\SettingsBuilder.cs" />
@@ -699,8 +699,8 @@
699699
<EmbeddedResource Include="Migrations\201511271019577_ExportFramework3.resx">
700700
<DependentUpon>201511271019577_ExportFramework3.cs</DependentUpon>
701701
</EmbeddedResource>
702-
<EmbeddedResource Include="Migrations\201512091408315_ImportFramework.resx">
703-
<DependentUpon>201512091408315_ImportFramework.cs</DependentUpon>
702+
<EmbeddedResource Include="Migrations\201512101150534_ImportFramework.resx">
703+
<DependentUpon>201512101150534_ImportFramework.cs</DependentUpon>
704704
</EmbeddedResource>
705705
<EmbeddedResource Include="Sql\Indexes.sql" />
706706
<EmbeddedResource Include="Sql\StoredProcedures.sql" />

src/Libraries/SmartStore.Services/DataExchange/Import/IImportProfileService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Linq;
22
using SmartStore.Core.Domain;
3+
using SmartStore.Core.Domain.DataExchange;
34

45
namespace SmartStore.Services.DataExchange.Import
56
{
@@ -11,7 +12,7 @@ public interface IImportProfileService
1112
/// <param name="name">Profile name</param>
1213
/// <param name="entityType"></param>
1314
/// <returns>Inserted import profile</returns>
14-
ImportProfile InsertImportProfile(string name, string entityType);
15+
ImportProfile InsertImportProfile(string name, ImportEntityType entityType);
1516

1617
/// <summary>
1718
/// Updates an import profile

0 commit comments

Comments
 (0)