Mango.Nop.Core cleanup;

This commit is contained in:
Loretta 2025-11-05 14:56:40 +01:00
parent 0da0565134
commit 2bd97c88ca
29 changed files with 2101 additions and 146 deletions

View File

@ -1,10 +1,8 @@
using AutoMapper;
using AyCode.Core.Extensions;
using AyCode.Core.Extensions;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using Mango.Nop.Core.Interfaces;
using Nop.Core;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;

View File

@ -2,7 +2,7 @@
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using Mango.Nop.Core.Interfaces;
using Nop.Core.Domain.Catalog;
using Nop.Core;
using Nop.Core.Domain.Orders;
namespace Mango.Nop.Core.Dtos;
@ -25,7 +25,7 @@ public abstract class MgOrderItemDto<TProductDto> : MgEntityBase, IModelDtoBase<
public string ProductName => ProductDto?.Name ?? "ProductDto is null!!!";
[Association(ThisKey = nameof(ProductId), OtherKey = nameof(Product.Id), CanBeNull = true)]
[Association(ThisKey = nameof(ProductId), OtherKey = nameof(BaseEntity.Id), CanBeNull = true)]
public TProductDto? ProductDto { get; set; }
protected MgOrderItemDto() :base()

View File

@ -1,12 +1,11 @@
using AyCode.Interfaces.Entities;
using Mango.Nop.Core.Entities;
using Mango.Nop.Core.Interfaces;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Discounts;
//using Nop.Core.Domain.Catalog;
namespace Mango.Nop.Core.Dtos;
public abstract class MgProductDto : MgEntityBase, IModelDtoBase<Product>, IMgProductDto//, IDiscountSupported<DiscountProductMapping>
public abstract class MgProductDto : MgEntityBase, IMgProductDto//IModelDtoBase<Product>//, IDiscountSupported<DiscountProductMapping>
{
//public int Id { get; set; }
public int ProductTypeId { get; set; }
@ -28,6 +27,9 @@ public abstract class MgProductDto : MgEntityBase, IModelDtoBase<Product>, IMgPr
public bool Deleted { get; set; }
public bool SubjectToAcl { get; set; }
public bool LimitedToStores { get; set; }
protected MgProductDto() :base()
{ }
@ -36,64 +38,61 @@ public abstract class MgProductDto : MgEntityBase, IModelDtoBase<Product>, IMgPr
Id = productId;
}
protected MgProductDto(Product product)
{
CopyEntityValuesToDto(product);
}
//protected MgProductDto(Product product)
//{
// CopyEntityValuesToDto(product);
//}
public virtual void CopyDtoValuesToEntity(Product entity)
{
entity.Id = Id;
//public virtual void CopyDtoValuesToEntity(Product entity)
//{
// entity.Id = Id;
entity.ProductTypeId = ProductTypeId;
entity.ParentGroupedProductId = ParentGroupedProductId;
// entity.ProductTypeId = ProductTypeId;
// entity.ParentGroupedProductId = ParentGroupedProductId;
entity.Name = Name;
entity.ShortDescription = ShortDescription;
entity.FullDescription = FullDescription;
// entity.Name = Name;
// entity.ShortDescription = ShortDescription;
// entity.FullDescription = FullDescription;
entity.WarehouseId = WarehouseId;
entity.StockQuantity = StockQuantity;
// entity.WarehouseId = WarehouseId;
// entity.StockQuantity = StockQuantity;
entity.Weight = Weight;
entity.Length = Length;
entity.Width = Width;
entity.Height = Height;
// entity.Weight = Weight;
// entity.Length = Length;
// entity.Width = Width;
// entity.Height = Height;
entity.Deleted = Deleted;
}
// entity.Deleted = Deleted;
//}
public virtual void CopyEntityValuesToDto(Product entity)
{
Id = entity.Id;
ProductTypeId = entity.ProductTypeId;
ParentGroupedProductId = entity.ParentGroupedProductId;
//public virtual void CopyEntityValuesToDto(Product entity)
//{
// Id = entity.Id;
// ProductTypeId = entity.ProductTypeId;
// ParentGroupedProductId = entity.ParentGroupedProductId;
Name = entity.Name;
ShortDescription = entity.ShortDescription;
FullDescription = entity.FullDescription;
// Name = entity.Name;
// ShortDescription = entity.ShortDescription;
// FullDescription = entity.FullDescription;
WarehouseId = entity.WarehouseId;
StockQuantity = entity.StockQuantity;
// WarehouseId = entity.WarehouseId;
// StockQuantity = entity.StockQuantity;
Weight = entity.Weight;
Length = entity.Length;
Width = entity.Width;
Height = entity.Height;
// Weight = entity.Weight;
// Length = entity.Length;
// Width = entity.Width;
// Height = entity.Height;
Deleted = entity.Deleted;
}
// Deleted = entity.Deleted;
//}
public virtual Product CreateMainEntity()
{
//base.CreateMainEntity();
//public virtual Product CreateMainEntity()
//{
// //base.CreateMainEntity();
var product = new Product();
CopyDtoValuesToEntity(product);
// var product = new Product();
// CopyDtoValuesToEntity(product);
return product;
}
public bool SubjectToAcl { get; set; }
public bool LimitedToStores { get; set; }
// return product;
//}
}

View File

@ -1,7 +1,5 @@
using AyCode.Core.Interfaces;
using AyCode.Utils.Extensions;
using LinqToDB.Common;
using Nop.Core;
using AyCode.Utils.Extensions;
using Mango.Nop.Core.Utils;
using Nop.Core.Domain.Common;
using System.Diagnostics.CodeAnalysis;
@ -14,13 +12,13 @@ public static class GenericAttributeExtensions
var ga = src.SingleOrDefault(x => x.Key == key);
if (ga == null || ga.Value.IsNullOrWhiteSpace()) return null;
return CommonHelper.To<TValue>(ga.Value);
return CommonHelper2.To<TValue>(ga.Value);
}
public static TValue GetValueOrDefault<TValue>(this IEnumerable<GenericAttribute> src, string key, TValue defaultValue = default) where TValue : struct
{
var gaValue = GetValueOrNull<TValue>(src, key);
return gaValue == null ? defaultValue : CommonHelper.To<TValue>(gaValue);
return gaValue == null ? defaultValue : CommonHelper2.To<TValue>(gaValue);
}
public static bool TryGetValue<TValue>(this IEnumerable<GenericAttribute> src, string key, [NotNullWhen(true)] out TValue? value) where TValue : struct
@ -30,7 +28,7 @@ public static class GenericAttributeExtensions
var gaValue = GetValueOrNull<TValue>(src, key);
if (gaValue == null) return false;
value = CommonHelper.To<TValue>(gaValue);
value = CommonHelper2.To<TValue>(gaValue);
return true;
}
}

View File

@ -1,6 +1,5 @@
using AyCode.Interfaces.Entities;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Discounts;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Security;
using Nop.Core.Domain.Seo;

View File

@ -1,50 +1,48 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>bin\FruitBank</BaseOutputPath>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>bin\FruitBank</BaseOutputPath>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="linq2db" Version="5.4.1" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="linq2db" Version="5.4.1" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Core\Nop.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="ExtendedFactories\" />
<Folder Include="ExtendedModels\" />
</ItemGroup>
<ItemGroup>
<Folder Include="ExtendedFactories\" />
<Folder Include="ExtendedModels\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
//namespace Nop.Core.Domain.Common;
namespace Nop.Core;
/// <summary>
/// Represents the base class for entities
/// </summary>
public abstract partial class BaseEntity : IBaseEntity
{
/// <summary>
/// Gets or sets the entity identifier
/// </summary>
public int Id { get; set; }
}
public interface IBaseEntity
{
public int Id { get; set; }
}

View File

@ -0,0 +1,267 @@
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Tax;
namespace Nop.Core.Domain.Customers;
/// <summary>
/// Represents a customer
/// </summary>
public partial class Customer : BaseEntity, ISoftDeletedEntity
{
public Customer()
{
CustomerGuid = Guid.NewGuid();
}
/// <summary>
/// Gets or sets the customer GUID
/// </summary>
public Guid CustomerGuid { get; set; }
/// <summary>
/// Gets or sets the username
/// </summary>
public string Username { get; set; }
/// <summary>
/// Gets or sets the email
/// </summary>
public string Email { get; set; }
/// <summary>
/// Gets or sets the first name
/// </summary>
public string FirstName { get; set; }
/// <summary>
/// Gets or sets the last name
/// </summary>
public string LastName { get; set; }
/// <summary>
/// Gets or sets the gender
/// </summary>
public string Gender { get; set; }
/// <summary>
/// Gets or sets the date of birth
/// </summary>
public DateTime? DateOfBirth { get; set; }
/// <summary>
/// Gets or sets the company
/// </summary>
public string Company { get; set; }
/// <summary>
/// Gets or sets the street address
/// </summary>
public string StreetAddress { get; set; }
/// <summary>
/// Gets or sets the street address 2
/// </summary>
public string StreetAddress2 { get; set; }
/// <summary>
/// Gets or sets the zip
/// </summary>
public string ZipPostalCode { get; set; }
/// <summary>
/// Gets or sets the city
/// </summary>
public string City { get; set; }
/// <summary>
/// Gets or sets the county
/// </summary>
public string County { get; set; }
/// <summary>
/// Gets or sets the country id
/// </summary>
public int CountryId { get; set; }
/// <summary>
/// Gets or sets the state province id
/// </summary>
public int StateProvinceId { get; set; }
/// <summary>
/// Gets or sets the phone number
/// </summary>
public string Phone { get; set; }
/// <summary>
/// Gets or sets the fax
/// </summary>
public string Fax { get; set; }
/// <summary>
/// Gets or sets the vat number
/// </summary>
public string VatNumber { get; set; }
/// <summary>
/// Gets or sets the vat number status id
/// </summary>
public int VatNumberStatusId { get; set; }
/// <summary>
/// Gets or sets the time zone id
/// </summary>
public string TimeZoneId { get; set; }
/// <summary>
/// Gets or sets the custom attributes
/// </summary>
public string CustomCustomerAttributesXML { get; set; }
/// <summary>
/// Gets or sets the currency id
/// </summary>
public int? CurrencyId { get; set; }
/// <summary>
/// Gets or sets the language id
/// </summary>
public int? LanguageId { get; set; }
/// <summary>
/// Gets or sets the tax display type id
/// </summary>
public int? TaxDisplayTypeId { get; set; }
/// <summary>
/// Gets or sets the email that should be re-validated. Used in scenarios when a customer is already registered and wants to change an email address.
/// </summary>
public string EmailToRevalidate { get; set; }
/// <summary>
/// Gets or sets the admin comment
/// </summary>
public string AdminComment { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer is tax exempt
/// </summary>
public bool IsTaxExempt { get; set; }
/// <summary>
/// Gets or sets the affiliate identifier
/// </summary>
public int AffiliateId { get; set; }
/// <summary>
/// Gets or sets the vendor identifier with which this customer is associated (manager)
/// </summary>
public int VendorId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this customer has some products in the shopping cart
/// <remarks>The same as if we run ShoppingCartItems.Count > 0
/// We use this property for performance optimization:
/// if this property is set to false, then we do not need to load "ShoppingCartItems" navigation property for each page load
/// It's used only in a couple of places in the presentation layer
/// </remarks>
/// </summary>
public bool HasShoppingCartItems { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer is required to re-login
/// </summary>
public bool RequireReLogin { get; set; }
/// <summary>
/// Gets or sets a value indicating number of failed login attempts (wrong password)
/// </summary>
public int FailedLoginAttempts { get; set; }
/// <summary>
/// Gets or sets the date and time until which a customer cannot login (locked out)
/// </summary>
public DateTime? CannotLoginUntilDateUtc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer is active
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer has been deleted
/// </summary>
public bool Deleted { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer account is system
/// </summary>
public bool IsSystemAccount { get; set; }
/// <summary>
/// Gets or sets the customer system name
/// </summary>
public string SystemName { get; set; }
/// <summary>
/// Gets or sets the last IP address
/// </summary>
public string LastIpAddress { get; set; }
/// <summary>
/// Gets or sets the date and time of entity creation
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the date and time of last login
/// </summary>
public DateTime? LastLoginDateUtc { get; set; }
/// <summary>
/// Gets or sets the date and time of last activity
/// </summary>
public DateTime LastActivityDateUtc { get; set; }
/// <summary>
/// Gets or sets the store identifier in which customer registered
/// </summary>
public int RegisteredInStoreId { get; set; }
/// <summary>
/// Gets or sets the billing address identifier
/// </summary>
public int? BillingAddressId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer is required to change password
/// </summary>
public bool MustChangePassword { get; set; }
/// <summary>
/// Gets or sets the shipping address identifier
/// </summary>
public int? ShippingAddressId { get; set; }
#region Custom properties
/// <summary>
/// Gets or sets the vat number status
/// </summary>
public VatNumberStatus VatNumberStatus
{
get => (VatNumberStatus)VatNumberStatusId;
set => VatNumberStatusId = (int)value;
}
/// <summary>
/// Gets or sets the tax display type
/// </summary>
public TaxDisplayType? TaxDisplayType
{
get => TaxDisplayTypeId.HasValue ? (TaxDisplayType)TaxDisplayTypeId : null;
set => TaxDisplayTypeId = value.HasValue ? (int)value : null;
}
#endregion
}

View File

@ -0,0 +1,58 @@
namespace Nop.Core.Domain.Customers;
/// <summary>
/// Represents a customer role
/// </summary>
public partial class CustomerRole : BaseEntity
{
/// <summary>
/// Gets or sets the customer role name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer role is marked as free shipping
/// </summary>
public bool FreeShipping { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer role is marked as tax exempt
/// </summary>
public bool TaxExempt { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer role is active
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customer role is system
/// </summary>
public bool IsSystemRole { get; set; }
/// <summary>
/// Gets or sets the customer role system name
/// </summary>
public string SystemName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customers must change passwords after a specified time
/// </summary>
public bool EnablePasswordLifetime { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the customers of this role have other tax display type chosen instead of the default one
/// </summary>
public bool OverrideTaxDisplayType { get; set; }
/// <summary>
/// Gets or sets identifier of the default tax display type (used only with "OverrideTaxDisplayType" enabled)
/// </summary>
public int DefaultTaxDisplayTypeId { get; set; }
/// <summary>
/// Gets or sets a product identifier that is required by this customer role.
/// A customer is added to this customer role once a specified product is purchased.
/// </summary>
public int PurchasedWithProductId { get; set; }
}

View File

@ -0,0 +1,19 @@
namespace Nop.Core.Domain.Discounts;
public abstract partial class DiscountMapping : BaseEntity
{
/// <summary>
/// Gets the entity identifier
/// </summary>
public new int Id { get; }
/// <summary>
/// Gets or sets the discount identifier
/// </summary>
public int DiscountId { get; set; }
/// <summary>
/// Gets or sets the entity identifier
/// </summary>
public abstract int EntityId { get; set; }
}

View File

@ -0,0 +1,12 @@
namespace Nop.Core.Domain.Discounts;
/// <summary>
/// Represents a discount-product mapping class
/// </summary>
public partial class DiscountProductMapping : DiscountMapping
{
/// <summary>
/// Gets or sets the product identifier
/// </summary>
public override int EntityId { get; set; }
}

View File

@ -0,0 +1,37 @@
namespace Nop.Core.Domain.Common;
/// <summary>
/// Represents a generic attribute
/// </summary>
public partial class GenericAttribute : BaseEntity
{
/// <summary>
/// Gets or sets the entity identifier
/// </summary>
public int EntityId { get; set; }
/// <summary>
/// Gets or sets the key group
/// </summary>
public string KeyGroup { get; set; }
/// <summary>
/// Gets or sets the key
/// </summary>
public string Key { get; set; }
/// <summary>
/// Gets or sets the value
/// </summary>
public string Value { get; set; }
/// <summary>
/// Gets or sets the store identifier
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// Gets or sets the created or updated date
/// </summary>
public DateTime? CreatedOrUpdatedDateUTC { get; set; }
}

View File

@ -0,0 +1,336 @@
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Payments;
using Nop.Core.Domain.Shipping;
using Nop.Core.Domain.Tax;
namespace Nop.Core.Domain.Orders;
/// <summary>
/// Represents an order
/// </summary>
public partial class Order : BaseEntity, ISoftDeletedEntity
{
#region Properties
/// <summary>
/// Gets or sets the order identifier
/// </summary>
public Guid OrderGuid { get; set; }
/// <summary>
/// Gets or sets the store identifier
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// Gets or sets the customer identifier
/// </summary>
public int CustomerId { get; set; }
/// <summary>
/// Gets or sets the billing address identifier
/// </summary>
public int BillingAddressId { get; set; }
/// <summary>
/// Gets or sets the shipping address identifier
/// </summary>
public int? ShippingAddressId { get; set; }
/// <summary>
/// Gets or sets the pickup address identifier
/// </summary>
public int? PickupAddressId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether a customer chose "pick up in store" shipping option
/// </summary>
public bool PickupInStore { get; set; }
/// <summary>
/// Gets or sets an order status identifier
/// </summary>
public int OrderStatusId { get; set; }
/// <summary>
/// Gets or sets the shipping status identifier
/// </summary>
public int ShippingStatusId { get; set; }
/// <summary>
/// Gets or sets the payment status identifier
/// </summary>
public int PaymentStatusId { get; set; }
/// <summary>
/// Gets or sets the payment method system name
/// </summary>
public string PaymentMethodSystemName { get; set; }
/// <summary>
/// Gets or sets the customer currency code (at the moment of order placing)
/// </summary>
public string CustomerCurrencyCode { get; set; }
/// <summary>
/// Gets or sets the currency rate
/// </summary>
public decimal CurrencyRate { get; set; }
/// <summary>
/// Gets or sets the customer tax display type identifier
/// </summary>
public int CustomerTaxDisplayTypeId { get; set; }
/// <summary>
/// Gets or sets the VAT number (the European Union Value Added Tax)
/// </summary>
public string VatNumber { get; set; }
/// <summary>
/// Gets or sets the order subtotal (include tax)
/// </summary>
public decimal OrderSubtotalInclTax { get; set; }
/// <summary>
/// Gets or sets the order subtotal (exclude tax)
/// </summary>
public decimal OrderSubtotalExclTax { get; set; }
/// <summary>
/// Gets or sets the order subtotal discount (include tax)
/// </summary>
public decimal OrderSubTotalDiscountInclTax { get; set; }
/// <summary>
/// Gets or sets the order subtotal discount (exclude tax)
/// </summary>
public decimal OrderSubTotalDiscountExclTax { get; set; }
/// <summary>
/// Gets or sets the order shipping (include tax)
/// </summary>
public decimal OrderShippingInclTax { get; set; }
/// <summary>
/// Gets or sets the order shipping (exclude tax)
/// </summary>
public decimal OrderShippingExclTax { get; set; }
/// <summary>
/// Gets or sets the payment method additional fee (incl tax)
/// </summary>
public decimal PaymentMethodAdditionalFeeInclTax { get; set; }
/// <summary>
/// Gets or sets the payment method additional fee (exclude tax)
/// </summary>
public decimal PaymentMethodAdditionalFeeExclTax { get; set; }
/// <summary>
/// Gets or sets the tax rates
/// </summary>
public string TaxRates { get; set; }
/// <summary>
/// Gets or sets the order tax
/// </summary>
public decimal OrderTax { get; set; }
/// <summary>
/// Gets or sets the order discount (applied to order total)
/// </summary>
public decimal OrderDiscount { get; set; }
/// <summary>
/// Gets or sets the order total
/// </summary>
public decimal OrderTotal { get; set; }
/// <summary>
/// Gets or sets the refunded amount
/// </summary>
public decimal RefundedAmount { get; set; }
/// <summary>
/// Gets or sets the reward points history entry identifier when reward points were earned (gained) for placing this order
/// </summary>
public int? RewardPointsHistoryEntryId { get; set; }
/// <summary>
/// Gets or sets the checkout attribute description
/// </summary>
public string CheckoutAttributeDescription { get; set; }
/// <summary>
/// Gets or sets the checkout attributes in XML format
/// </summary>
public string CheckoutAttributesXml { get; set; }
/// <summary>
/// Gets or sets the customer language identifier
/// </summary>
public int CustomerLanguageId { get; set; }
/// <summary>
/// Gets or sets the affiliate identifier
/// </summary>
public int AffiliateId { get; set; }
/// <summary>
/// Gets or sets the customer IP address
/// </summary>
public string CustomerIp { get; set; }
/// <summary>
/// Gets or sets a value indicating whether storing of credit card number is allowed
/// </summary>
public bool AllowStoringCreditCardNumber { get; set; }
/// <summary>
/// Gets or sets the card type
/// </summary>
public string CardType { get; set; }
/// <summary>
/// Gets or sets the card name
/// </summary>
public string CardName { get; set; }
/// <summary>
/// Gets or sets the card number
/// </summary>
public string CardNumber { get; set; }
/// <summary>
/// Gets or sets the masked credit card number
/// </summary>
public string MaskedCreditCardNumber { get; set; }
/// <summary>
/// Gets or sets the card CVV2
/// </summary>
public string CardCvv2 { get; set; }
/// <summary>
/// Gets or sets the card expiration month
/// </summary>
public string CardExpirationMonth { get; set; }
/// <summary>
/// Gets or sets the card expiration year
/// </summary>
public string CardExpirationYear { get; set; }
/// <summary>
/// Gets or sets the authorization transaction identifier
/// </summary>
public string AuthorizationTransactionId { get; set; }
/// <summary>
/// Gets or sets the authorization transaction code
/// </summary>
public string AuthorizationTransactionCode { get; set; }
/// <summary>
/// Gets or sets the authorization transaction result
/// </summary>
public string AuthorizationTransactionResult { get; set; }
/// <summary>
/// Gets or sets the capture transaction identifier
/// </summary>
public string CaptureTransactionId { get; set; }
/// <summary>
/// Gets or sets the capture transaction result
/// </summary>
public string CaptureTransactionResult { get; set; }
/// <summary>
/// Gets or sets the subscription transaction identifier
/// </summary>
public string SubscriptionTransactionId { get; set; }
/// <summary>
/// Gets or sets the paid date and time
/// </summary>
public DateTime? PaidDateUtc { get; set; }
/// <summary>
/// Gets or sets the shipping method
/// </summary>
public string ShippingMethod { get; set; }
/// <summary>
/// Gets or sets the shipping rate computation method identifier or the pickup point provider identifier (if PickupInStore is true)
/// </summary>
public string ShippingRateComputationMethodSystemName { get; set; }
/// <summary>
/// Gets or sets the serialized CustomValues (values from ProcessPaymentRequest)
/// </summary>
public string CustomValuesXml { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the entity has been deleted
/// </summary>
public bool Deleted { get; set; }
/// <summary>
/// Gets or sets the date and time of order creation
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the custom order number without prefix
/// </summary>
public string CustomOrderNumber { get; set; }
/// <summary>
/// Gets or sets the reward points history record (spent by a customer when placing this order)
/// </summary>
public virtual int? RedeemedRewardPointsEntryId { get; set; }
#endregion
#region Custom properties
/// <summary>
/// Gets or sets the order status
/// </summary>
public OrderStatus OrderStatus
{
get => (OrderStatus)OrderStatusId;
set => OrderStatusId = (int)value;
}
/// <summary>
/// Gets or sets the payment status
/// </summary>
public PaymentStatus PaymentStatus
{
get => (PaymentStatus)PaymentStatusId;
set => PaymentStatusId = (int)value;
}
/// <summary>
/// Gets or sets the shipping status
/// </summary>
public ShippingStatus ShippingStatus
{
get => (ShippingStatus)ShippingStatusId;
set => ShippingStatusId = (int)value;
}
/// <summary>
/// Gets or sets the customer tax display type
/// </summary>
public TaxDisplayType CustomerTaxDisplayType
{
get => (TaxDisplayType)CustomerTaxDisplayTypeId;
set => CustomerTaxDisplayTypeId = (int)value;
}
#endregion
}

View File

@ -0,0 +1,103 @@
namespace Nop.Core.Domain.Orders;
/// <summary>
/// Represents an order item
/// </summary>
public partial class OrderItem : BaseEntity
{
/// <summary>
/// Gets or sets the order item identifier
/// </summary>
public Guid OrderItemGuid { get; set; }
/// <summary>
/// Gets or sets the order identifier
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// Gets or sets the product identifier
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// Gets or sets the quantity
/// </summary>
public int Quantity { get; set; }
/// <summary>
/// Gets or sets the unit price in primary store currency (include tax)
/// </summary>
public decimal UnitPriceInclTax { get; set; }
/// <summary>
/// Gets or sets the unit price in primary store currency (exclude tax)
/// </summary>
public decimal UnitPriceExclTax { get; set; }
/// <summary>
/// Gets or sets the price in primary store currency (include tax)
/// </summary>
public decimal PriceInclTax { get; set; }
/// <summary>
/// Gets or sets the price in primary store currency (exclude tax)
/// </summary>
public decimal PriceExclTax { get; set; }
/// <summary>
/// Gets or sets the discount amount (include tax)
/// </summary>
public decimal DiscountAmountInclTax { get; set; }
/// <summary>
/// Gets or sets the discount amount (exclude tax)
/// </summary>
public decimal DiscountAmountExclTax { get; set; }
/// <summary>
/// Gets or sets the original cost of this order item (when an order was placed), qty 1
/// </summary>
public decimal OriginalProductCost { get; set; }
/// <summary>
/// Gets or sets the attribute description
/// </summary>
public string AttributeDescription { get; set; }
/// <summary>
/// Gets or sets the product attributes in XML format
/// </summary>
public string AttributesXml { get; set; }
/// <summary>
/// Gets or sets the download count
/// </summary>
public int DownloadCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether download is activated
/// </summary>
public bool IsDownloadActivated { get; set; }
/// <summary>
/// Gets or sets a license download identifier (in case this is a downloadable product)
/// </summary>
public int? LicenseDownloadId { get; set; }
/// <summary>
/// Gets or sets the total weight of one item
/// It's nullable for compatibility with the previous version of nopCommerce where was no such property
/// </summary>
public decimal? ItemWeight { get; set; }
/// <summary>
/// Gets or sets the rental product start date (null if it's not a rental product)
/// </summary>
public DateTime? RentalStartDateUtc { get; set; }
/// <summary>
/// Gets or sets the rental product end date (null if it's not a rental product)
/// </summary>
public DateTime? RentalEndDateUtc { get; set; }
}

View File

@ -0,0 +1,596 @@
//using Nop.Core.Domain.Common;
//using Nop.Core.Domain.Discounts;
//using Nop.Core.Domain.Localization;
//using Nop.Core.Domain.Security;
//using Nop.Core.Domain.Seo;
//using Nop.Core.Domain.Stores;
//namespace Nop.Core.Domain.Catalog;
///// <summary>
///// Represents a product
///// </summary>
//public partial class Product : BaseEntity, ILocalizedEntity, ISlugSupported, IAclSupported, IStoreMappingSupported, IDiscountSupported<DiscountProductMapping>, ISoftDeletedEntity
//{
// /// <summary>
// /// Gets or sets the product type identifier
// /// </summary>
// public int ProductTypeId { get; set; }
// /// <summary>
// /// Gets or sets the parent product identifier. It's used to identify associated products (only with "grouped" products)
// /// </summary>
// public int ParentGroupedProductId { get; set; }
// /// <summary>
// /// Gets or sets the values indicating whether this product is visible in catalog or search results.
// /// It's used when this product is associated to some "grouped" one
// /// This way associated products could be accessed/added/etc only from a grouped product details page
// /// </summary>
// public bool VisibleIndividually { get; set; }
// /// <summary>
// /// Gets or sets the name
// /// </summary>
// public string Name { get; set; }
// /// <summary>
// /// Gets or sets the short description
// /// </summary>
// public string ShortDescription { get; set; }
// /// <summary>
// /// Gets or sets the full description
// /// </summary>
// public string FullDescription { get; set; }
// /// <summary>
// /// Gets or sets the admin comment
// /// </summary>
// public string AdminComment { get; set; }
// /// <summary>
// /// Gets or sets a value of used product template identifier
// /// </summary>
// public int ProductTemplateId { get; set; }
// /// <summary>
// /// Gets or sets a vendor identifier
// /// </summary>
// public int VendorId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to show the product on home page
// /// </summary>
// public bool ShowOnHomepage { get; set; }
// /// <summary>
// /// Gets or sets the meta keywords
// /// </summary>
// public string MetaKeywords { get; set; }
// /// <summary>
// /// Gets or sets the meta description
// /// </summary>
// public string MetaDescription { get; set; }
// /// <summary>
// /// Gets or sets the meta title
// /// </summary>
// public string MetaTitle { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product allows customer reviews
// /// </summary>
// public bool AllowCustomerReviews { get; set; }
// /// <summary>
// /// Gets or sets the rating sum (approved reviews)
// /// </summary>
// public int ApprovedRatingSum { get; set; }
// /// <summary>
// /// Gets or sets the rating sum (not approved reviews)
// /// </summary>
// public int NotApprovedRatingSum { get; set; }
// /// <summary>
// /// Gets or sets the total rating votes (approved reviews)
// /// </summary>
// public int ApprovedTotalReviews { get; set; }
// /// <summary>
// /// Gets or sets the total rating votes (not approved reviews)
// /// </summary>
// public int NotApprovedTotalReviews { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity is subject to ACL
// /// </summary>
// public bool SubjectToAcl { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity is limited/restricted to certain stores
// /// </summary>
// public bool LimitedToStores { get; set; }
// /// <summary>
// /// Gets or sets the SKU
// /// </summary>
// public string Sku { get; set; }
// /// <summary>
// /// Gets or sets the manufacturer part number
// /// </summary>
// public string ManufacturerPartNumber { get; set; }
// /// <summary>
// /// Gets or sets the Global Trade Item Number (GTIN). These identifiers include UPC (in North America), EAN (in Europe), JAN (in Japan), and ISBN (for books).
// /// </summary>
// public string Gtin { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product is gift card
// /// </summary>
// public bool IsGiftCard { get; set; }
// /// <summary>
// /// Gets or sets the gift card type identifier
// /// </summary>
// public int GiftCardTypeId { get; set; }
// /// <summary>
// /// Gets or sets gift card amount that can be used after purchase. If not specified, then product price will be used.
// /// </summary>
// public decimal? OverriddenGiftCardAmount { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product requires that other products are added to the cart (Product X requires Product Y)
// /// </summary>
// public bool RequireOtherProducts { get; set; }
// /// <summary>
// /// Gets or sets a required product identifiers (comma separated)
// /// </summary>
// public string RequiredProductIds { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether required products are automatically added to the cart
// /// </summary>
// public bool AutomaticallyAddRequiredProducts { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product is download
// /// </summary>
// public bool IsDownload { get; set; }
// /// <summary>
// /// Gets or sets the download identifier
// /// </summary>
// public int DownloadId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether this downloadable product can be downloaded unlimited number of times
// /// </summary>
// public bool UnlimitedDownloads { get; set; }
// /// <summary>
// /// Gets or sets the maximum number of downloads
// /// </summary>
// public int MaxNumberOfDownloads { get; set; }
// /// <summary>
// /// Gets or sets the number of days during customers keeps access to the file.
// /// </summary>
// public int? DownloadExpirationDays { get; set; }
// /// <summary>
// /// Gets or sets the download activation type
// /// </summary>
// public int DownloadActivationTypeId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product has a sample download file
// /// </summary>
// public bool HasSampleDownload { get; set; }
// /// <summary>
// /// Gets or sets the sample download identifier
// /// </summary>
// public int SampleDownloadId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product has user agreement
// /// </summary>
// public bool HasUserAgreement { get; set; }
// /// <summary>
// /// Gets or sets the text of license agreement
// /// </summary>
// public string UserAgreementText { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product is recurring
// /// </summary>
// public bool IsRecurring { get; set; }
// /// <summary>
// /// Gets or sets the cycle length
// /// </summary>
// public int RecurringCycleLength { get; set; }
// /// <summary>
// /// Gets or sets the cycle period
// /// </summary>
// public int RecurringCyclePeriodId { get; set; }
// /// <summary>
// /// Gets or sets the total cycles
// /// </summary>
// public int RecurringTotalCycles { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product is rental
// /// </summary>
// public bool IsRental { get; set; }
// /// <summary>
// /// Gets or sets the rental length for some period (price for this period)
// /// </summary>
// public int RentalPriceLength { get; set; }
// /// <summary>
// /// Gets or sets the rental period (price for this period)
// /// </summary>
// public int RentalPricePeriodId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity is ship enabled
// /// </summary>
// public bool IsShipEnabled { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity is free shipping
// /// </summary>
// public bool IsFreeShipping { get; set; }
// /// <summary>
// /// Gets or sets a value this product should be shipped separately (each item)
// /// </summary>
// public bool ShipSeparately { get; set; }
// /// <summary>
// /// Gets or sets the additional shipping charge
// /// </summary>
// public decimal AdditionalShippingCharge { get; set; }
// /// <summary>
// /// Gets or sets a delivery date identifier
// /// </summary>
// public int DeliveryDateId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the product is marked as tax exempt
// /// </summary>
// public bool IsTaxExempt { get; set; }
// /// <summary>
// /// Gets or sets the tax category identifier
// /// </summary>
// public int TaxCategoryId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating how to manage inventory
// /// </summary>
// public int ManageInventoryMethodId { get; set; }
// /// <summary>
// /// Gets or sets a product availability range identifier
// /// </summary>
// public int ProductAvailabilityRangeId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether multiple warehouses are used for this product
// /// </summary>
// public bool UseMultipleWarehouses { get; set; }
// /// <summary>
// /// Gets or sets a warehouse identifier
// /// </summary>
// public int WarehouseId { get; set; }
// /// <summary>
// /// Gets or sets the stock quantity
// /// </summary>
// public int StockQuantity { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to display stock availability
// /// </summary>
// public bool DisplayStockAvailability { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to display stock quantity
// /// </summary>
// public bool DisplayStockQuantity { get; set; }
// /// <summary>
// /// Gets or sets the minimum stock quantity
// /// </summary>
// public int MinStockQuantity { get; set; }
// /// <summary>
// /// Gets or sets the low stock activity identifier
// /// </summary>
// public int LowStockActivityId { get; set; }
// /// <summary>
// /// Gets or sets the quantity when admin should be notified
// /// </summary>
// public int NotifyAdminForQuantityBelow { get; set; }
// /// <summary>
// /// Gets or sets a value backorder mode identifier
// /// </summary>
// public int BackorderModeId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to back in stock subscriptions are allowed
// /// </summary>
// public bool AllowBackInStockSubscriptions { get; set; }
// /// <summary>
// /// Gets or sets the order minimum quantity
// /// </summary>
// public int OrderMinimumQuantity { get; set; }
// /// <summary>
// /// Gets or sets the order maximum quantity
// /// </summary>
// public int OrderMaximumQuantity { get; set; }
// /// <summary>
// /// Gets or sets the comma separated list of allowed quantities. null or empty if any quantity is allowed
// /// </summary>
// public string AllowedQuantities { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether we allow adding to the cart/wishlist only attribute combinations that exist and have stock greater than zero.
// /// This option is used only when we have "manage inventory" set to "track inventory by product attributes"
// /// </summary>
// public bool AllowAddingOnlyExistingAttributeCombinations { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to display attribute combination images only
// /// </summary>
// public bool DisplayAttributeCombinationImagesOnly { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether this product is returnable (a customer is allowed to submit return request with this product)
// /// </summary>
// public bool NotReturnable { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to disable buy (Add to cart) button
// /// </summary>
// public bool DisableBuyButton { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to disable "Add to wishlist" button
// /// </summary>
// public bool DisableWishlistButton { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether this item is available for Pre-Order
// /// </summary>
// public bool AvailableForPreOrder { get; set; }
// /// <summary>
// /// Gets or sets the start date and time of the product availability (for pre-order products)
// /// </summary>
// public DateTime? PreOrderAvailabilityStartDateTimeUtc { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether to show "Call for Pricing" or "Call for quote" instead of price
// /// </summary>
// public bool CallForPrice { get; set; }
// /// <summary>
// /// Gets or sets the price
// /// </summary>
// public decimal Price { get; set; }
// /// <summary>
// /// Gets or sets the old price
// /// </summary>
// public decimal OldPrice { get; set; }
// /// <summary>
// /// Gets or sets the product cost
// /// </summary>
// public decimal ProductCost { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether a customer enters price
// /// </summary>
// public bool CustomerEntersPrice { get; set; }
// /// <summary>
// /// Gets or sets the minimum price entered by a customer
// /// </summary>
// public decimal MinimumCustomerEnteredPrice { get; set; }
// /// <summary>
// /// Gets or sets the maximum price entered by a customer
// /// </summary>
// public decimal MaximumCustomerEnteredPrice { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether base price (PAngV) is enabled. Used by German users.
// /// </summary>
// public bool BasepriceEnabled { get; set; }
// /// <summary>
// /// Gets or sets an amount in product for PAngV
// /// </summary>
// public decimal BasepriceAmount { get; set; }
// /// <summary>
// /// Gets or sets a unit of product for PAngV (MeasureWeight entity)
// /// </summary>
// public int BasepriceUnitId { get; set; }
// /// <summary>
// /// Gets or sets a reference amount for PAngV
// /// </summary>
// public decimal BasepriceBaseAmount { get; set; }
// /// <summary>
// /// Gets or sets a reference unit for PAngV (MeasureWeight entity)
// /// </summary>
// public int BasepriceBaseUnitId { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether this product is marked as new
// /// </summary>
// public bool MarkAsNew { get; set; }
// /// <summary>
// /// Gets or sets the start date and time of the new product (set product as "New" from date). Leave empty to ignore this property
// /// </summary>
// public DateTime? MarkAsNewStartDateTimeUtc { get; set; }
// /// <summary>
// /// Gets or sets the end date and time of the new product (set product as "New" to date). Leave empty to ignore this property
// /// </summary>
// public DateTime? MarkAsNewEndDateTimeUtc { get; set; }
// /// <summary>
// /// Gets or sets the weight
// /// </summary>
// public decimal Weight { get; set; }
// /// <summary>
// /// Gets or sets the length
// /// </summary>
// public decimal Length { get; set; }
// /// <summary>
// /// Gets or sets the width
// /// </summary>
// public decimal Width { get; set; }
// /// <summary>
// /// Gets or sets the height
// /// </summary>
// public decimal Height { get; set; }
// /// <summary>
// /// Gets or sets the available start date and time
// /// </summary>
// public DateTime? AvailableStartDateTimeUtc { get; set; }
// /// <summary>
// /// Gets or sets the available end date and time
// /// </summary>
// public DateTime? AvailableEndDateTimeUtc { get; set; }
// /// <summary>
// /// Gets or sets a display order.
// /// This value is used when sorting associated products (used with "grouped" products)
// /// This value is used when sorting home page products
// /// </summary>
// public int DisplayOrder { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity is published
// /// </summary>
// public bool Published { get; set; }
// /// <summary>
// /// Gets or sets a value indicating whether the entity has been deleted
// /// </summary>
// public bool Deleted { get; set; }
// /// <summary>
// /// Gets or sets the date and time of product creation
// /// </summary>
// public DateTime CreatedOnUtc { get; set; }
// /// <summary>
// /// Gets or sets the date and time of product update
// /// </summary>
// public DateTime UpdatedOnUtc { get; set; }
// /// <summary>
// /// Gets or sets the product type
// /// </summary>
// public ProductType ProductType
// {
// get => (ProductType)ProductTypeId;
// set => ProductTypeId = (int)value;
// }
// /// <summary>
// /// Gets or sets the backorder mode
// /// </summary>
// public BackorderMode BackorderMode
// {
// get => (BackorderMode)BackorderModeId;
// set => BackorderModeId = (int)value;
// }
// /// <summary>
// /// Gets or sets the download activation type
// /// </summary>
// public DownloadActivationType DownloadActivationType
// {
// get => (DownloadActivationType)DownloadActivationTypeId;
// set => DownloadActivationTypeId = (int)value;
// }
// /// <summary>
// /// Gets or sets the gift card type
// /// </summary>
// public GiftCardType GiftCardType
// {
// get => (GiftCardType)GiftCardTypeId;
// set => GiftCardTypeId = (int)value;
// }
// /// <summary>
// /// Gets or sets the low stock activity
// /// </summary>
// public LowStockActivity LowStockActivity
// {
// get => (LowStockActivity)LowStockActivityId;
// set => LowStockActivityId = (int)value;
// }
// /// <summary>
// /// Gets or sets the value indicating how to manage inventory
// /// </summary>
// public ManageInventoryMethod ManageInventoryMethod
// {
// get => (ManageInventoryMethod)ManageInventoryMethodId;
// set => ManageInventoryMethodId = (int)value;
// }
// /// <summary>
// /// Gets or sets the cycle period for recurring products
// /// </summary>
// public RecurringProductCyclePeriod RecurringCyclePeriod
// {
// get => (RecurringProductCyclePeriod)RecurringCyclePeriodId;
// set => RecurringCyclePeriodId = (int)value;
// }
// /// <summary>
// /// Gets or sets the period for rental products
// /// </summary>
// public RentalPricePeriod RentalPricePeriod
// {
// get => (RentalPricePeriod)RentalPricePeriodId;
// set => RentalPricePeriodId = (int)value;
// }
//}

View File

@ -0,0 +1,12 @@
namespace Nop.Core.Domain.Security;
/// <summary>
/// Represents an entity which supports ACL
/// </summary>
public partial interface IAclSupported
{
/// <summary>
/// Gets or sets a value indicating whether the entity is subject to ACL
/// </summary>
bool SubjectToAcl { get; set; }
}

View File

@ -0,0 +1,9 @@
namespace Nop.Core.Domain.Discounts;
/// <summary>
/// Represents an entity which supports discounts
/// </summary>
public partial interface IDiscountSupported<T> where T : DiscountMapping
{
int Id { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace Nop.Core.Domain.Localization;
/// <summary>
/// Represents a localized entity
/// </summary>
public partial interface ILocalizedEntity
{
}

View File

@ -0,0 +1,8 @@
namespace Nop.Core.Domain.Seo;
/// <summary>
/// Represents an entity which supports slug (SEO friendly one-word URLs)
/// </summary>
public partial interface ISlugSupported
{
}

View File

@ -0,0 +1,12 @@
//namespace Mango.Nop.Core.NopDependencies;
namespace Nop.Core.Domain.Common;
/// <summary>
/// Represents a soft-deleted (without actually deleting from storage) entity
/// </summary>
public partial interface ISoftDeletedEntity
{
/// <summary>
/// Gets or sets a value indicating whether the entity has been deleted
/// </summary>
bool Deleted { get; set; }
}

View File

@ -0,0 +1,12 @@
namespace Nop.Core.Domain.Stores;
/// <summary>
/// Represents an entity which supports store mapping
/// </summary>
public partial interface IStoreMappingSupported
{
/// <summary>
/// Gets or sets a value indicating whether the entity is limited/restricted to certain stores
/// </summary>
bool LimitedToStores { get; set; }
}

View File

@ -0,0 +1,27 @@
namespace Nop.Core.Domain.Orders;
/// <summary>
/// Represents an order status enumeration
/// </summary>
public enum OrderStatus
{
/// <summary>
/// Pending
/// </summary>
Pending = 10,
/// <summary>
/// Processing
/// </summary>
Processing = 20,
/// <summary>
/// Complete
/// </summary>
Complete = 30,
/// <summary>
/// Cancelled
/// </summary>
Cancelled = 40
}

View File

@ -0,0 +1,37 @@
namespace Nop.Core.Domain.Payments;
/// <summary>
/// Represents a payment status enumeration
/// </summary>
public enum PaymentStatus
{
/// <summary>
/// Pending
/// </summary>
Pending = 10,
/// <summary>
/// Authorized
/// </summary>
Authorized = 20,
/// <summary>
/// Paid
/// </summary>
Paid = 30,
/// <summary>
/// Partially Refunded
/// </summary>
PartiallyRefunded = 35,
/// <summary>
/// Refunded
/// </summary>
Refunded = 40,
/// <summary>
/// Voided
/// </summary>
Voided = 50
}

View File

@ -0,0 +1,32 @@
namespace Nop.Core.Domain.Shipping;
/// <summary>
/// Represents the shipping status enumeration
/// </summary>
public enum ShippingStatus
{
/// <summary>
/// Shipping not required
/// </summary>
ShippingNotRequired = 10,
/// <summary>
/// Not yet shipped
/// </summary>
NotYetShipped = 20,
/// <summary>
/// Partially shipped
/// </summary>
PartiallyShipped = 25,
/// <summary>
/// Shipped
/// </summary>
Shipped = 30,
/// <summary>
/// Delivered
/// </summary>
Delivered = 40
}

View File

@ -0,0 +1,17 @@
namespace Nop.Core.Domain.Tax;
/// <summary>
/// Represents the tax display type enumeration
/// </summary>
public enum TaxDisplayType
{
/// <summary>
/// Including tax
/// </summary>
IncludingTax = 0,
/// <summary>
/// Excluding tax
/// </summary>
ExcludingTax = 10
}

View File

@ -0,0 +1,27 @@
namespace Nop.Core.Domain.Tax;
/// <summary>
/// Represents the VAT number status enumeration
/// </summary>
public enum VatNumberStatus
{
/// <summary>
/// Unknown
/// </summary>
Unknown = 0,
/// <summary>
/// Empty
/// </summary>
Empty = 10,
/// <summary>
/// Valid
/// </summary>
Valid = 20,
/// <summary>
/// Invalid
/// </summary>
Invalid = 30
}

View File

@ -0,0 +1,312 @@
using System.ComponentModel;
using System.Globalization;
using System.Net;
using System.Text.RegularExpressions;
namespace Mango.Nop.Core.Utils;
/// <summary>
/// Represents a common helper
/// </summary>
public partial class CommonHelper2
{
#region Fields
//we use regular expression based on RFC 5322 Official Standard (see https://emailregex.com/)
private const string EMAIL_EXPRESSION = @"^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$";
#endregion
#region Methods
/// <summary>
/// Get email validation regex
/// </summary>
/// <returns>Regular expression</returns>
[GeneratedRegex(EMAIL_EXPRESSION, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture, "en-US")]
public static partial Regex GetEmailRegex();
/// <summary>
/// Ensures the subscriber email or throw.
/// </summary>
/// <param name="email">The email.</param>
/// <returns></returns>
public static string EnsureSubscriberEmailOrThrow(string email)
{
var output = EnsureNotNull(email);
output = output.Trim();
output = EnsureMaximumLength(output, 255);
if (!IsValidEmail(output))
{
throw new Exception("Email is not valid.");
}
return output;
}
/// <summary>
/// Verifies that a string is in valid e-mail format
/// </summary>
/// <param name="email">Email to verify</param>
/// <returns>true if the string is a valid e-mail address and false if it's not</returns>
public static bool IsValidEmail(string email)
{
if (string.IsNullOrEmpty(email))
return false;
email = email.Trim();
return GetEmailRegex().IsMatch(email);
}
/// <summary>
/// Verifies that string is an valid IP-Address
/// </summary>
/// <param name="ipAddress">IPAddress to verify</param>
/// <returns>true if the string is a valid IpAddress and false if it's not</returns>
public static bool IsValidIpAddress(string ipAddress)
{
return IPAddress.TryParse(ipAddress, out var _);
}
///// <summary>
///// Generate random digit code
///// </summary>
///// <param name="length">Length</param>
///// <returns>Result string</returns>
//public static string GenerateRandomDigitCode(int length)
//{
// using var random = new SecureRandomNumberGenerator();
// var str = string.Empty;
// for (var i = 0; i < length; i++)
// str = string.Concat(str, random.Next(10).ToString());
// return str;
//}
///// <summary>
///// Returns an random integer number within a specified rage
///// </summary>
///// <param name="min">Minimum number</param>
///// <param name="max">Maximum number</param>
///// <returns>Result</returns>
//public static int GenerateRandomInteger(int min = 0, int max = int.MaxValue)
//{
// using var random = new SecureRandomNumberGenerator();
// return random.Next(min, max);
//}
/// <summary>
/// Ensure that a string doesn't exceed maximum allowed length
/// </summary>
/// <param name="str">Input string</param>
/// <param name="maxLength">Maximum length</param>
/// <param name="postfix">A string to add to the end if the original string was shorten</param>
/// <returns>Input string if its length is OK; otherwise, truncated input string</returns>
public static string EnsureMaximumLength(string str, int maxLength, string postfix = null)
{
if (string.IsNullOrEmpty(str))
return str;
if (str.Length <= maxLength)
return str;
var pLen = postfix?.Length ?? 0;
var result = str[0..(maxLength - pLen)];
if (!string.IsNullOrEmpty(postfix))
{
result += postfix;
}
return result;
}
/// <summary>
/// Ensures that a string only contains numeric values
/// </summary>
/// <param name="str">Input string</param>
/// <returns>Input string with only numeric values, empty string if input is null/empty</returns>
public static string EnsureNumericOnly(string str)
{
return string.IsNullOrEmpty(str) ? string.Empty : new string(str.Where(char.IsDigit).ToArray());
}
/// <summary>
/// Ensure that a string is not null
/// </summary>
/// <param name="str">Input string</param>
/// <returns>Result</returns>
public static string EnsureNotNull(string str)
{
return str ?? string.Empty;
}
/// <summary>
/// Indicates whether the specified strings are null or empty strings
/// </summary>
/// <param name="stringsToValidate">Array of strings to validate</param>
/// <returns>Boolean</returns>
public static bool AreNullOrEmpty(params string[] stringsToValidate)
{
return stringsToValidate.Any(string.IsNullOrEmpty);
}
/// <summary>
/// Compare two arrays
/// </summary>
/// <typeparam name="T">Type</typeparam>
/// <param name="a1">Array 1</param>
/// <param name="a2">Array 2</param>
/// <returns>Result</returns>
public static bool ArraysEqual<T>(T[] a1, T[] a2)
{
//also see Enumerable.SequenceEqual(a1, a2);
if (ReferenceEquals(a1, a2))
return true;
if (a1 == null || a2 == null)
return false;
if (a1.Length != a2.Length)
return false;
var comparer = EqualityComparer<T>.Default;
return !a1.Where((t, i) => !comparer.Equals(t, a2[i])).Any();
}
/// <summary>
/// Sets a property on an object to a value.
/// </summary>
/// <param name="instance">The object whose property to set.</param>
/// <param name="propertyName">The name of the property to set.</param>
/// <param name="value">The value to set the property to.</param>
public static void SetProperty(object instance, string propertyName, object value)
{
ArgumentNullException.ThrowIfNull(instance);
ArgumentNullException.ThrowIfNull(propertyName);
var instanceType = instance.GetType();
var pi = instanceType.GetProperty(propertyName)
?? throw new Exception($"No property '{propertyName}' found on the instance of type '{instanceType}'.");
if (!pi.CanWrite)
throw new Exception($"No property '{propertyName}' found on the instance of type '{instanceType}'.");
if (value != null && !value.GetType().IsAssignableFrom(pi.PropertyType))
value = To(value, pi.PropertyType);
pi.SetValue(instance, value, Array.Empty<object>());
}
/// <summary>
/// Converts a value to a destination type.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="destinationType">The type to convert the value to.</param>
/// <returns>The converted value.</returns>
public static object To(object value, Type destinationType)
{
return To(value, destinationType, CultureInfo.InvariantCulture);
}
/// <summary>
/// Converts a value to a destination type.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="destinationType">The type to convert the value to.</param>
/// <param name="culture">Culture</param>
/// <returns>The converted value.</returns>
public static object To(object value, Type destinationType, CultureInfo culture)
{
if (value == null)
return null;
var sourceType = value.GetType();
var destinationConverter = TypeDescriptor.GetConverter(destinationType);
if (destinationConverter.CanConvertFrom(value.GetType()))
return destinationConverter.ConvertFrom(null, culture, value);
var sourceConverter = TypeDescriptor.GetConverter(sourceType);
if (sourceConverter.CanConvertTo(destinationType))
return sourceConverter.ConvertTo(null, culture, value, destinationType);
if (destinationType.IsEnum && value is int)
return Enum.ToObject(destinationType, (int)value);
if (!destinationType.IsInstanceOfType(value))
return Convert.ChangeType(value, destinationType, culture);
return value;
}
/// <summary>
/// Converts a value to a destination type.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <typeparam name="T">The type to convert the value to.</typeparam>
/// <returns>The converted value.</returns>
public static T To<T>(object value)
{
//return (T)Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture);
return (T)To(value, typeof(T));
}
/// <summary>
/// Splits the camel-case word into separate one
/// </summary>
/// <param name="str">Input string</param>
/// <returns>Splitted string</returns>
public static string SplitCamelCaseWord(string str)
{
if (string.IsNullOrEmpty(str))
return string.Empty;
var result = str.ToCharArray()
.Select(p => p.ToString())
.Aggregate(string.Empty, (current, c) => current + (c == c.ToUpperInvariant() ? $" {c}" : c));
//ensure no spaces (e.g. when the first letter is upper case)
result = result.TrimStart();
return result;
}
/// <summary>
/// Get difference in years
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public static int GetDifferenceInYears(DateTime startDate, DateTime endDate)
{
//source: http://stackoverflow.com/questions/9/how-do-i-calculate-someones-age-in-c
//this assumes you are looking for the western idea of age and not using East Asian reckoning.
var age = endDate.Year - startDate.Year;
if (startDate > endDate.AddYears(-age))
age--;
return age;
}
/// <summary>
/// Get DateTime to the specified year, month, and day using the conventions of the current thread culture
/// </summary>
/// <param name="year">The year</param>
/// <param name="month">The month</param>
/// <param name="day">The day</param>
/// <returns>An instance of the Nullable<System.DateTime></returns>
public static DateTime? ParseDate(int? year, int? month, int? day)
{
if (!year.HasValue || !month.HasValue || !day.HasValue)
return null;
DateTime? date = null;
try
{
date = new DateTime(year.Value, month.Value, day.Value, CultureInfo.CurrentCulture.Calendar);
}
catch { }
return date;
}
#endregion
}

View File

@ -6,6 +6,8 @@
<Nullable>enable</Nullable>
<BaseOutputPath>bin\FruitBank</BaseOutputPath>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
<ItemGroup>

View File

@ -1,48 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>bin\FruitBank</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>bin\FruitBank</BaseOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Core\Nop.Core.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Data\Nop.Data.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Services\Nop.Services.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
<ProjectReference Include="..\Mango.Nop.Core\Mango.Nop.Core.csproj" />
<ProjectReference Include="..\Mango.Nop.Data\Mango.Nop.Data.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Core\Nop.Core.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Data\Nop.Data.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Libraries\Nop.Services\Nop.Services.csproj" />
<ProjectReference Include="..\..\..\..\FruitBank\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
<ProjectReference Include="..\Mango.Nop.Core\Mango.Nop.Core.csproj" />
<ProjectReference Include="..\Mango.Nop.Data\Mango.Nop.Data.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll</HintPath>
</Reference>
</ItemGroup>
</Project>