Skip to content

Commit 45c2a1b

Browse files
Closes smartstore#627 InstallDataSeeder: Seed initial data for Quantity Units
1 parent a008292 commit 45c2a1b

3 files changed

Lines changed: 70 additions & 2 deletions

File tree

src/Libraries/SmartStore.Core/Domain/Directory/QuantityUnit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace SmartStore.Core.Domain.Directory
66
{
77
/// <summary>
8-
/// Represents a currency
8+
/// Represents a quantity unit
99
/// </summary>
1010
[DataContract]
1111
public partial class QuantityUnit : BaseEntity, ILocalizedEntity
@@ -17,7 +17,7 @@ public partial class QuantityUnit : BaseEntity, ILocalizedEntity
1717
public string Name { get; set; }
1818

1919
/// <summary>
20-
/// Gets or sets the hex value
20+
/// Gets or sets the description
2121
/// </summary>
2222
[DataMember]
2323
public string Description { get; set; }

src/Libraries/SmartStore.Data/Setup/SeedData/InvariantSeedData.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8868,6 +8868,43 @@ public IList<DeliveryTime> DeliveryTimes()
88688868

88698869
#endregion Deliverytimes
88708870

8871+
#region QuantityUnits
8872+
8873+
public IList<QuantityUnit> QuantityUnits()
8874+
{
8875+
var entities = new List<QuantityUnit>()
8876+
{
8877+
new QuantityUnit
8878+
{
8879+
Name = "Piece",
8880+
Description = "Piece",
8881+
IsDefault = true,
8882+
DisplayOrder = 0,
8883+
},
8884+
new QuantityUnit
8885+
{
8886+
Name = "Box",
8887+
Description = "Box",
8888+
DisplayOrder = 1,
8889+
},
8890+
new QuantityUnit
8891+
{
8892+
Name = "Parcel",
8893+
Description = "Parcel",
8894+
DisplayOrder = 2,
8895+
},
8896+
new QuantityUnit
8897+
{
8898+
Name = "Palette",
8899+
Description = "Palette",
8900+
DisplayOrder = 3,
8901+
},
8902+
};
8903+
this.Alter(entities);
8904+
return entities;
8905+
}
8906+
8907+
#endregion
88718908

88728909
#region BlogPost
88738910
public IList<BlogPost> BlogPosts()
@@ -9129,6 +9166,10 @@ protected virtual void Alter(IList<DeliveryTime> entities)
91299166
{
91309167
}
91319168

9169+
protected virtual void Alter(IList<QuantityUnit> entities)
9170+
{
9171+
}
9172+
91329173
protected virtual void Alter(IList<EmailAccount> entities)
91339174
{
91349175
}

src/Presentation/SmartStore.Web/Infrastructure/Installation/DeDESeedData.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,6 +3562,33 @@ protected override void Alter(IList<DeliveryTime> entities)
35623562
});
35633563
}
35643564

3565+
protected override void Alter(IList<QuantityUnit> entities)
3566+
{
3567+
base.Alter(entities);
3568+
3569+
entities.WithKey(x => x.DisplayOrder)
3570+
.Alter(0, x =>
3571+
{
3572+
x.Name = "Stück";
3573+
x.Description = "Stück";
3574+
})
3575+
.Alter(1, x =>
3576+
{
3577+
x.Name = "Schachtel";
3578+
x.Description = "Schachtel";
3579+
})
3580+
.Alter(2, x =>
3581+
{
3582+
x.Name = "Paket";
3583+
x.Description = "Paket";
3584+
})
3585+
.Alter(3, x =>
3586+
{
3587+
x.Name = "Palette";
3588+
x.Description = "Palette";
3589+
});
3590+
}
3591+
35653592
protected override void Alter(IList<Store> entities)
35663593
{
35673594
base.Alter(entities);

0 commit comments

Comments
 (0)