diff --git a/Mango.Nop.Core/Dtos/MgOrderDto.cs b/Mango.Nop.Core/Dtos/MgOrderDto.cs index ff924b5..4f426a8 100644 --- a/Mango.Nop.Core/Dtos/MgOrderDto.cs +++ b/Mango.Nop.Core/Dtos/MgOrderDto.cs @@ -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; diff --git a/Mango.Nop.Core/Dtos/MgOrderItemDto.cs b/Mango.Nop.Core/Dtos/MgOrderItemDto.cs index 68f0174..327209f 100644 --- a/Mango.Nop.Core/Dtos/MgOrderItemDto.cs +++ b/Mango.Nop.Core/Dtos/MgOrderItemDto.cs @@ -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 : 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() diff --git a/Mango.Nop.Core/Dtos/MgProductDto.cs b/Mango.Nop.Core/Dtos/MgProductDto.cs index 9d67870..da9d793 100644 --- a/Mango.Nop.Core/Dtos/MgProductDto.cs +++ b/Mango.Nop.Core/Dtos/MgProductDto.cs @@ -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, IMgProductDto//, IDiscountSupported +public abstract class MgProductDto : MgEntityBase, IMgProductDto//IModelDtoBase//, IDiscountSupported { //public int Id { get; set; } public int ProductTypeId { get; set; } @@ -28,6 +27,9 @@ public abstract class MgProductDto : MgEntityBase, IModelDtoBase, 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, 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; + //} } \ No newline at end of file diff --git a/Mango.Nop.Core/Extensions/GenericAttributeExtensions.cs b/Mango.Nop.Core/Extensions/GenericAttributeExtensions.cs index 9106794..beebc44 100644 --- a/Mango.Nop.Core/Extensions/GenericAttributeExtensions.cs +++ b/Mango.Nop.Core/Extensions/GenericAttributeExtensions.cs @@ -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(ga.Value); + return CommonHelper2.To(ga.Value); } public static TValue GetValueOrDefault(this IEnumerable src, string key, TValue defaultValue = default) where TValue : struct { var gaValue = GetValueOrNull(src, key); - return gaValue == null ? defaultValue : CommonHelper.To(gaValue); + return gaValue == null ? defaultValue : CommonHelper2.To(gaValue); } public static bool TryGetValue(this IEnumerable src, string key, [NotNullWhen(true)] out TValue? value) where TValue : struct @@ -30,7 +28,7 @@ public static class GenericAttributeExtensions var gaValue = GetValueOrNull(src, key); if (gaValue == null) return false; - value = CommonHelper.To(gaValue); + value = CommonHelper2.To(gaValue); return true; } } \ No newline at end of file diff --git a/Mango.Nop.Core/Interfaces/IMgProductDto.cs b/Mango.Nop.Core/Interfaces/IMgProductDto.cs index f8c5169..b07e55c 100644 --- a/Mango.Nop.Core/Interfaces/IMgProductDto.cs +++ b/Mango.Nop.Core/Interfaces/IMgProductDto.cs @@ -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; diff --git a/Mango.Nop.Core/Mango.Nop.Core.csproj b/Mango.Nop.Core/Mango.Nop.Core.csproj index 2a7ca75..cd5f2e9 100644 --- a/Mango.Nop.Core/Mango.Nop.Core.csproj +++ b/Mango.Nop.Core/Mango.Nop.Core.csproj @@ -1,50 +1,48 @@  - - net9.0 - enable - enable - bin\FruitBank - False - + + net9.0 + enable + enable + bin\FruitBank + False + true + true + - - - - - + + + + + - - - + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll + + - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll - - - - - - - + + + + diff --git a/Mango.Nop.Core/NopDependencies/BaseEntity.cs b/Mango.Nop.Core/NopDependencies/BaseEntity.cs new file mode 100644 index 0000000..f4a759f --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/BaseEntity.cs @@ -0,0 +1,18 @@ +//namespace Nop.Core.Domain.Common; +namespace Nop.Core; + +/// +/// Represents the base class for entities +/// +public abstract partial class BaseEntity : IBaseEntity +{ + /// + /// Gets or sets the entity identifier + /// + public int Id { get; set; } +} + +public interface IBaseEntity +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/Customer.cs b/Mango.Nop.Core/NopDependencies/Catalogs/Customer.cs new file mode 100644 index 0000000..90cfa3a --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/Customer.cs @@ -0,0 +1,267 @@ +using Nop.Core.Domain.Common; +using Nop.Core.Domain.Tax; + +namespace Nop.Core.Domain.Customers; + +/// +/// Represents a customer +/// +public partial class Customer : BaseEntity, ISoftDeletedEntity +{ + public Customer() + { + CustomerGuid = Guid.NewGuid(); + } + + /// + /// Gets or sets the customer GUID + /// + public Guid CustomerGuid { get; set; } + + /// + /// Gets or sets the username + /// + public string Username { get; set; } + + /// + /// Gets or sets the email + /// + public string Email { get; set; } + + /// + /// Gets or sets the first name + /// + public string FirstName { get; set; } + + /// + /// Gets or sets the last name + /// + public string LastName { get; set; } + + /// + /// Gets or sets the gender + /// + public string Gender { get; set; } + + /// + /// Gets or sets the date of birth + /// + public DateTime? DateOfBirth { get; set; } + + /// + /// Gets or sets the company + /// + public string Company { get; set; } + + /// + /// Gets or sets the street address + /// + public string StreetAddress { get; set; } + + /// + /// Gets or sets the street address 2 + /// + public string StreetAddress2 { get; set; } + + /// + /// Gets or sets the zip + /// + public string ZipPostalCode { get; set; } + + /// + /// Gets or sets the city + /// + public string City { get; set; } + + /// + /// Gets or sets the county + /// + public string County { get; set; } + + /// + /// Gets or sets the country id + /// + public int CountryId { get; set; } + + /// + /// Gets or sets the state province id + /// + public int StateProvinceId { get; set; } + + /// + /// Gets or sets the phone number + /// + public string Phone { get; set; } + + /// + /// Gets or sets the fax + /// + public string Fax { get; set; } + + /// + /// Gets or sets the vat number + /// + public string VatNumber { get; set; } + + /// + /// Gets or sets the vat number status id + /// + public int VatNumberStatusId { get; set; } + + /// + /// Gets or sets the time zone id + /// + public string TimeZoneId { get; set; } + + /// + /// Gets or sets the custom attributes + /// + public string CustomCustomerAttributesXML { get; set; } + + /// + /// Gets or sets the currency id + /// + public int? CurrencyId { get; set; } + + /// + /// Gets or sets the language id + /// + public int? LanguageId { get; set; } + + /// + /// Gets or sets the tax display type id + /// + public int? TaxDisplayTypeId { get; set; } + + /// + /// 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. + /// + public string EmailToRevalidate { get; set; } + + /// + /// Gets or sets the admin comment + /// + public string AdminComment { get; set; } + + /// + /// Gets or sets a value indicating whether the customer is tax exempt + /// + public bool IsTaxExempt { get; set; } + + /// + /// Gets or sets the affiliate identifier + /// + public int AffiliateId { get; set; } + + /// + /// Gets or sets the vendor identifier with which this customer is associated (manager) + /// + public int VendorId { get; set; } + + /// + /// Gets or sets a value indicating whether this customer has some products in the shopping cart + /// 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 + /// + /// + public bool HasShoppingCartItems { get; set; } + + /// + /// Gets or sets a value indicating whether the customer is required to re-login + /// + public bool RequireReLogin { get; set; } + + /// + /// Gets or sets a value indicating number of failed login attempts (wrong password) + /// + public int FailedLoginAttempts { get; set; } + + /// + /// Gets or sets the date and time until which a customer cannot login (locked out) + /// + public DateTime? CannotLoginUntilDateUtc { get; set; } + + /// + /// Gets or sets a value indicating whether the customer is active + /// + public bool Active { get; set; } + + /// + /// Gets or sets a value indicating whether the customer has been deleted + /// + public bool Deleted { get; set; } + + /// + /// Gets or sets a value indicating whether the customer account is system + /// + public bool IsSystemAccount { get; set; } + + /// + /// Gets or sets the customer system name + /// + public string SystemName { get; set; } + + /// + /// Gets or sets the last IP address + /// + public string LastIpAddress { get; set; } + + /// + /// Gets or sets the date and time of entity creation + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the date and time of last login + /// + public DateTime? LastLoginDateUtc { get; set; } + + /// + /// Gets or sets the date and time of last activity + /// + public DateTime LastActivityDateUtc { get; set; } + + /// + /// Gets or sets the store identifier in which customer registered + /// + public int RegisteredInStoreId { get; set; } + + /// + /// Gets or sets the billing address identifier + /// + public int? BillingAddressId { get; set; } + + /// + /// Gets or sets a value indicating whether the customer is required to change password + /// + public bool MustChangePassword { get; set; } + + /// + /// Gets or sets the shipping address identifier + /// + public int? ShippingAddressId { get; set; } + + #region Custom properties + + /// + /// Gets or sets the vat number status + /// + public VatNumberStatus VatNumberStatus + { + get => (VatNumberStatus)VatNumberStatusId; + set => VatNumberStatusId = (int)value; + } + + /// + /// Gets or sets the tax display type + /// + public TaxDisplayType? TaxDisplayType + { + get => TaxDisplayTypeId.HasValue ? (TaxDisplayType)TaxDisplayTypeId : null; + set => TaxDisplayTypeId = value.HasValue ? (int)value : null; + } + + #endregion +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/CustomerRole.cs b/Mango.Nop.Core/NopDependencies/Catalogs/CustomerRole.cs new file mode 100644 index 0000000..3ea2215 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/CustomerRole.cs @@ -0,0 +1,58 @@ +namespace Nop.Core.Domain.Customers; + +/// +/// Represents a customer role +/// +public partial class CustomerRole : BaseEntity +{ + /// + /// Gets or sets the customer role name + /// + public string Name { get; set; } + + /// + /// Gets or sets a value indicating whether the customer role is marked as free shipping + /// + public bool FreeShipping { get; set; } + + /// + /// Gets or sets a value indicating whether the customer role is marked as tax exempt + /// + public bool TaxExempt { get; set; } + + /// + /// Gets or sets a value indicating whether the customer role is active + /// + public bool Active { get; set; } + + /// + /// Gets or sets a value indicating whether the customer role is system + /// + public bool IsSystemRole { get; set; } + + /// + /// Gets or sets the customer role system name + /// + public string SystemName { get; set; } + + /// + /// Gets or sets a value indicating whether the customers must change passwords after a specified time + /// + public bool EnablePasswordLifetime { get; set; } + + /// + /// Gets or sets a value indicating whether the customers of this role have other tax display type chosen instead of the default one + /// + public bool OverrideTaxDisplayType { get; set; } + + /// + /// Gets or sets identifier of the default tax display type (used only with "OverrideTaxDisplayType" enabled) + /// + public int DefaultTaxDisplayTypeId { get; set; } + + /// + /// 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. + /// + public int PurchasedWithProductId { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/DiscountMapping.cs b/Mango.Nop.Core/NopDependencies/Catalogs/DiscountMapping.cs new file mode 100644 index 0000000..87e530d --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/DiscountMapping.cs @@ -0,0 +1,19 @@ +namespace Nop.Core.Domain.Discounts; + +public abstract partial class DiscountMapping : BaseEntity +{ + /// + /// Gets the entity identifier + /// + public new int Id { get; } + + /// + /// Gets or sets the discount identifier + /// + public int DiscountId { get; set; } + + /// + /// Gets or sets the entity identifier + /// + public abstract int EntityId { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/DiscountProductMapping.cs b/Mango.Nop.Core/NopDependencies/Catalogs/DiscountProductMapping.cs new file mode 100644 index 0000000..d7bcaf8 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/DiscountProductMapping.cs @@ -0,0 +1,12 @@ +namespace Nop.Core.Domain.Discounts; + +/// +/// Represents a discount-product mapping class +/// +public partial class DiscountProductMapping : DiscountMapping +{ + /// + /// Gets or sets the product identifier + /// + public override int EntityId { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs b/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs new file mode 100644 index 0000000..ff0b6cb --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs @@ -0,0 +1,37 @@ +namespace Nop.Core.Domain.Common; + +/// +/// Represents a generic attribute +/// +public partial class GenericAttribute : BaseEntity +{ + /// + /// Gets or sets the entity identifier + /// + public int EntityId { get; set; } + + /// + /// Gets or sets the key group + /// + public string KeyGroup { get; set; } + + /// + /// Gets or sets the key + /// + public string Key { get; set; } + + /// + /// Gets or sets the value + /// + public string Value { get; set; } + + /// + /// Gets or sets the store identifier + /// + public int StoreId { get; set; } + + /// + /// Gets or sets the created or updated date + /// + public DateTime? CreatedOrUpdatedDateUTC { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/Order.cs b/Mango.Nop.Core/NopDependencies/Catalogs/Order.cs new file mode 100644 index 0000000..d076057 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/Order.cs @@ -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; + +/// +/// Represents an order +/// +public partial class Order : BaseEntity, ISoftDeletedEntity +{ + #region Properties + + /// + /// Gets or sets the order identifier + /// + public Guid OrderGuid { get; set; } + + /// + /// Gets or sets the store identifier + /// + public int StoreId { get; set; } + + /// + /// Gets or sets the customer identifier + /// + public int CustomerId { get; set; } + + /// + /// Gets or sets the billing address identifier + /// + public int BillingAddressId { get; set; } + + /// + /// Gets or sets the shipping address identifier + /// + public int? ShippingAddressId { get; set; } + + /// + /// Gets or sets the pickup address identifier + /// + public int? PickupAddressId { get; set; } + + /// + /// Gets or sets a value indicating whether a customer chose "pick up in store" shipping option + /// + public bool PickupInStore { get; set; } + + /// + /// Gets or sets an order status identifier + /// + public int OrderStatusId { get; set; } + + /// + /// Gets or sets the shipping status identifier + /// + public int ShippingStatusId { get; set; } + + /// + /// Gets or sets the payment status identifier + /// + public int PaymentStatusId { get; set; } + + /// + /// Gets or sets the payment method system name + /// + public string PaymentMethodSystemName { get; set; } + + /// + /// Gets or sets the customer currency code (at the moment of order placing) + /// + public string CustomerCurrencyCode { get; set; } + + /// + /// Gets or sets the currency rate + /// + public decimal CurrencyRate { get; set; } + + /// + /// Gets or sets the customer tax display type identifier + /// + public int CustomerTaxDisplayTypeId { get; set; } + + /// + /// Gets or sets the VAT number (the European Union Value Added Tax) + /// + public string VatNumber { get; set; } + + /// + /// Gets or sets the order subtotal (include tax) + /// + public decimal OrderSubtotalInclTax { get; set; } + + /// + /// Gets or sets the order subtotal (exclude tax) + /// + public decimal OrderSubtotalExclTax { get; set; } + + /// + /// Gets or sets the order subtotal discount (include tax) + /// + public decimal OrderSubTotalDiscountInclTax { get; set; } + + /// + /// Gets or sets the order subtotal discount (exclude tax) + /// + public decimal OrderSubTotalDiscountExclTax { get; set; } + + /// + /// Gets or sets the order shipping (include tax) + /// + public decimal OrderShippingInclTax { get; set; } + + /// + /// Gets or sets the order shipping (exclude tax) + /// + public decimal OrderShippingExclTax { get; set; } + + /// + /// Gets or sets the payment method additional fee (incl tax) + /// + public decimal PaymentMethodAdditionalFeeInclTax { get; set; } + + /// + /// Gets or sets the payment method additional fee (exclude tax) + /// + public decimal PaymentMethodAdditionalFeeExclTax { get; set; } + + /// + /// Gets or sets the tax rates + /// + public string TaxRates { get; set; } + + /// + /// Gets or sets the order tax + /// + public decimal OrderTax { get; set; } + + /// + /// Gets or sets the order discount (applied to order total) + /// + public decimal OrderDiscount { get; set; } + + /// + /// Gets or sets the order total + /// + public decimal OrderTotal { get; set; } + + /// + /// Gets or sets the refunded amount + /// + public decimal RefundedAmount { get; set; } + + /// + /// Gets or sets the reward points history entry identifier when reward points were earned (gained) for placing this order + /// + public int? RewardPointsHistoryEntryId { get; set; } + + /// + /// Gets or sets the checkout attribute description + /// + public string CheckoutAttributeDescription { get; set; } + + /// + /// Gets or sets the checkout attributes in XML format + /// + public string CheckoutAttributesXml { get; set; } + + /// + /// Gets or sets the customer language identifier + /// + public int CustomerLanguageId { get; set; } + + /// + /// Gets or sets the affiliate identifier + /// + public int AffiliateId { get; set; } + + /// + /// Gets or sets the customer IP address + /// + public string CustomerIp { get; set; } + + /// + /// Gets or sets a value indicating whether storing of credit card number is allowed + /// + public bool AllowStoringCreditCardNumber { get; set; } + + /// + /// Gets or sets the card type + /// + public string CardType { get; set; } + + /// + /// Gets or sets the card name + /// + public string CardName { get; set; } + + /// + /// Gets or sets the card number + /// + public string CardNumber { get; set; } + + /// + /// Gets or sets the masked credit card number + /// + public string MaskedCreditCardNumber { get; set; } + + /// + /// Gets or sets the card CVV2 + /// + public string CardCvv2 { get; set; } + + /// + /// Gets or sets the card expiration month + /// + public string CardExpirationMonth { get; set; } + + /// + /// Gets or sets the card expiration year + /// + public string CardExpirationYear { get; set; } + + /// + /// Gets or sets the authorization transaction identifier + /// + public string AuthorizationTransactionId { get; set; } + + /// + /// Gets or sets the authorization transaction code + /// + public string AuthorizationTransactionCode { get; set; } + + /// + /// Gets or sets the authorization transaction result + /// + public string AuthorizationTransactionResult { get; set; } + + /// + /// Gets or sets the capture transaction identifier + /// + public string CaptureTransactionId { get; set; } + + /// + /// Gets or sets the capture transaction result + /// + public string CaptureTransactionResult { get; set; } + + /// + /// Gets or sets the subscription transaction identifier + /// + public string SubscriptionTransactionId { get; set; } + + /// + /// Gets or sets the paid date and time + /// + public DateTime? PaidDateUtc { get; set; } + + /// + /// Gets or sets the shipping method + /// + public string ShippingMethod { get; set; } + + /// + /// Gets or sets the shipping rate computation method identifier or the pickup point provider identifier (if PickupInStore is true) + /// + public string ShippingRateComputationMethodSystemName { get; set; } + + /// + /// Gets or sets the serialized CustomValues (values from ProcessPaymentRequest) + /// + public string CustomValuesXml { get; set; } + + /// + /// Gets or sets a value indicating whether the entity has been deleted + /// + public bool Deleted { get; set; } + + /// + /// Gets or sets the date and time of order creation + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the custom order number without prefix + /// + public string CustomOrderNumber { get; set; } + + /// + /// Gets or sets the reward points history record (spent by a customer when placing this order) + /// + public virtual int? RedeemedRewardPointsEntryId { get; set; } + + #endregion + + #region Custom properties + + /// + /// Gets or sets the order status + /// + public OrderStatus OrderStatus + { + get => (OrderStatus)OrderStatusId; + set => OrderStatusId = (int)value; + } + + /// + /// Gets or sets the payment status + /// + public PaymentStatus PaymentStatus + { + get => (PaymentStatus)PaymentStatusId; + set => PaymentStatusId = (int)value; + } + + /// + /// Gets or sets the shipping status + /// + public ShippingStatus ShippingStatus + { + get => (ShippingStatus)ShippingStatusId; + set => ShippingStatusId = (int)value; + } + + /// + /// Gets or sets the customer tax display type + /// + public TaxDisplayType CustomerTaxDisplayType + { + get => (TaxDisplayType)CustomerTaxDisplayTypeId; + set => CustomerTaxDisplayTypeId = (int)value; + } + + #endregion +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/OrderItem.cs b/Mango.Nop.Core/NopDependencies/Catalogs/OrderItem.cs new file mode 100644 index 0000000..d3824b7 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/OrderItem.cs @@ -0,0 +1,103 @@ +namespace Nop.Core.Domain.Orders; + +/// +/// Represents an order item +/// +public partial class OrderItem : BaseEntity +{ + /// + /// Gets or sets the order item identifier + /// + public Guid OrderItemGuid { get; set; } + + /// + /// Gets or sets the order identifier + /// + public int OrderId { get; set; } + + /// + /// Gets or sets the product identifier + /// + public int ProductId { get; set; } + + /// + /// Gets or sets the quantity + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the unit price in primary store currency (include tax) + /// + public decimal UnitPriceInclTax { get; set; } + + /// + /// Gets or sets the unit price in primary store currency (exclude tax) + /// + public decimal UnitPriceExclTax { get; set; } + + /// + /// Gets or sets the price in primary store currency (include tax) + /// + public decimal PriceInclTax { get; set; } + + /// + /// Gets or sets the price in primary store currency (exclude tax) + /// + public decimal PriceExclTax { get; set; } + + /// + /// Gets or sets the discount amount (include tax) + /// + public decimal DiscountAmountInclTax { get; set; } + + /// + /// Gets or sets the discount amount (exclude tax) + /// + public decimal DiscountAmountExclTax { get; set; } + + /// + /// Gets or sets the original cost of this order item (when an order was placed), qty 1 + /// + public decimal OriginalProductCost { get; set; } + + /// + /// Gets or sets the attribute description + /// + public string AttributeDescription { get; set; } + + /// + /// Gets or sets the product attributes in XML format + /// + public string AttributesXml { get; set; } + + /// + /// Gets or sets the download count + /// + public int DownloadCount { get; set; } + + /// + /// Gets or sets a value indicating whether download is activated + /// + public bool IsDownloadActivated { get; set; } + + /// + /// Gets or sets a license download identifier (in case this is a downloadable product) + /// + public int? LicenseDownloadId { get; set; } + + /// + /// 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 + /// + public decimal? ItemWeight { get; set; } + + /// + /// Gets or sets the rental product start date (null if it's not a rental product) + /// + public DateTime? RentalStartDateUtc { get; set; } + + /// + /// Gets or sets the rental product end date (null if it's not a rental product) + /// + public DateTime? RentalEndDateUtc { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/Product.cs b/Mango.Nop.Core/NopDependencies/Catalogs/Product.cs new file mode 100644 index 0000000..09d0df7 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/Product.cs @@ -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; + +///// +///// Represents a product +///// +//public partial class Product : BaseEntity, ILocalizedEntity, ISlugSupported, IAclSupported, IStoreMappingSupported, IDiscountSupported, ISoftDeletedEntity +//{ +// /// +// /// Gets or sets the product type identifier +// /// +// public int ProductTypeId { get; set; } + +// /// +// /// Gets or sets the parent product identifier. It's used to identify associated products (only with "grouped" products) +// /// +// public int ParentGroupedProductId { get; set; } + +// /// +// /// 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 +// /// +// public bool VisibleIndividually { get; set; } + +// /// +// /// Gets or sets the name +// /// +// public string Name { get; set; } + +// /// +// /// Gets or sets the short description +// /// +// public string ShortDescription { get; set; } + +// /// +// /// Gets or sets the full description +// /// +// public string FullDescription { get; set; } + +// /// +// /// Gets or sets the admin comment +// /// +// public string AdminComment { get; set; } + +// /// +// /// Gets or sets a value of used product template identifier +// /// +// public int ProductTemplateId { get; set; } + +// /// +// /// Gets or sets a vendor identifier +// /// +// public int VendorId { get; set; } + +// /// +// /// Gets or sets a value indicating whether to show the product on home page +// /// +// public bool ShowOnHomepage { get; set; } + +// /// +// /// Gets or sets the meta keywords +// /// +// public string MetaKeywords { get; set; } + +// /// +// /// Gets or sets the meta description +// /// +// public string MetaDescription { get; set; } + +// /// +// /// Gets or sets the meta title +// /// +// public string MetaTitle { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product allows customer reviews +// /// +// public bool AllowCustomerReviews { get; set; } + +// /// +// /// Gets or sets the rating sum (approved reviews) +// /// +// public int ApprovedRatingSum { get; set; } + +// /// +// /// Gets or sets the rating sum (not approved reviews) +// /// +// public int NotApprovedRatingSum { get; set; } + +// /// +// /// Gets or sets the total rating votes (approved reviews) +// /// +// public int ApprovedTotalReviews { get; set; } + +// /// +// /// Gets or sets the total rating votes (not approved reviews) +// /// +// public int NotApprovedTotalReviews { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity is subject to ACL +// /// +// public bool SubjectToAcl { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity is limited/restricted to certain stores +// /// +// public bool LimitedToStores { get; set; } + +// /// +// /// Gets or sets the SKU +// /// +// public string Sku { get; set; } + +// /// +// /// Gets or sets the manufacturer part number +// /// +// public string ManufacturerPartNumber { get; set; } + +// /// +// /// 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). +// /// +// public string Gtin { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product is gift card +// /// +// public bool IsGiftCard { get; set; } + +// /// +// /// Gets or sets the gift card type identifier +// /// +// public int GiftCardTypeId { get; set; } + +// /// +// /// Gets or sets gift card amount that can be used after purchase. If not specified, then product price will be used. +// /// +// public decimal? OverriddenGiftCardAmount { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product requires that other products are added to the cart (Product X requires Product Y) +// /// +// public bool RequireOtherProducts { get; set; } + +// /// +// /// Gets or sets a required product identifiers (comma separated) +// /// +// public string RequiredProductIds { get; set; } + +// /// +// /// Gets or sets a value indicating whether required products are automatically added to the cart +// /// +// public bool AutomaticallyAddRequiredProducts { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product is download +// /// +// public bool IsDownload { get; set; } + +// /// +// /// Gets or sets the download identifier +// /// +// public int DownloadId { get; set; } + +// /// +// /// Gets or sets a value indicating whether this downloadable product can be downloaded unlimited number of times +// /// +// public bool UnlimitedDownloads { get; set; } + +// /// +// /// Gets or sets the maximum number of downloads +// /// +// public int MaxNumberOfDownloads { get; set; } + +// /// +// /// Gets or sets the number of days during customers keeps access to the file. +// /// +// public int? DownloadExpirationDays { get; set; } + +// /// +// /// Gets or sets the download activation type +// /// +// public int DownloadActivationTypeId { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product has a sample download file +// /// +// public bool HasSampleDownload { get; set; } + +// /// +// /// Gets or sets the sample download identifier +// /// +// public int SampleDownloadId { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product has user agreement +// /// +// public bool HasUserAgreement { get; set; } + +// /// +// /// Gets or sets the text of license agreement +// /// +// public string UserAgreementText { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product is recurring +// /// +// public bool IsRecurring { get; set; } + +// /// +// /// Gets or sets the cycle length +// /// +// public int RecurringCycleLength { get; set; } + +// /// +// /// Gets or sets the cycle period +// /// +// public int RecurringCyclePeriodId { get; set; } + +// /// +// /// Gets or sets the total cycles +// /// +// public int RecurringTotalCycles { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product is rental +// /// +// public bool IsRental { get; set; } + +// /// +// /// Gets or sets the rental length for some period (price for this period) +// /// +// public int RentalPriceLength { get; set; } + +// /// +// /// Gets or sets the rental period (price for this period) +// /// +// public int RentalPricePeriodId { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity is ship enabled +// /// +// public bool IsShipEnabled { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity is free shipping +// /// +// public bool IsFreeShipping { get; set; } + +// /// +// /// Gets or sets a value this product should be shipped separately (each item) +// /// +// public bool ShipSeparately { get; set; } + +// /// +// /// Gets or sets the additional shipping charge +// /// +// public decimal AdditionalShippingCharge { get; set; } + +// /// +// /// Gets or sets a delivery date identifier +// /// +// public int DeliveryDateId { get; set; } + +// /// +// /// Gets or sets a value indicating whether the product is marked as tax exempt +// /// +// public bool IsTaxExempt { get; set; } + +// /// +// /// Gets or sets the tax category identifier +// /// +// public int TaxCategoryId { get; set; } + +// /// +// /// Gets or sets a value indicating how to manage inventory +// /// +// public int ManageInventoryMethodId { get; set; } + +// /// +// /// Gets or sets a product availability range identifier +// /// +// public int ProductAvailabilityRangeId { get; set; } + +// /// +// /// Gets or sets a value indicating whether multiple warehouses are used for this product +// /// +// public bool UseMultipleWarehouses { get; set; } + +// /// +// /// Gets or sets a warehouse identifier +// /// +// public int WarehouseId { get; set; } + +// /// +// /// Gets or sets the stock quantity +// /// +// public int StockQuantity { get; set; } + +// /// +// /// Gets or sets a value indicating whether to display stock availability +// /// +// public bool DisplayStockAvailability { get; set; } + +// /// +// /// Gets or sets a value indicating whether to display stock quantity +// /// +// public bool DisplayStockQuantity { get; set; } + +// /// +// /// Gets or sets the minimum stock quantity +// /// +// public int MinStockQuantity { get; set; } + +// /// +// /// Gets or sets the low stock activity identifier +// /// +// public int LowStockActivityId { get; set; } + +// /// +// /// Gets or sets the quantity when admin should be notified +// /// +// public int NotifyAdminForQuantityBelow { get; set; } + +// /// +// /// Gets or sets a value backorder mode identifier +// /// +// public int BackorderModeId { get; set; } + +// /// +// /// Gets or sets a value indicating whether to back in stock subscriptions are allowed +// /// +// public bool AllowBackInStockSubscriptions { get; set; } + +// /// +// /// Gets or sets the order minimum quantity +// /// +// public int OrderMinimumQuantity { get; set; } + +// /// +// /// Gets or sets the order maximum quantity +// /// +// public int OrderMaximumQuantity { get; set; } + +// /// +// /// Gets or sets the comma separated list of allowed quantities. null or empty if any quantity is allowed +// /// +// public string AllowedQuantities { get; set; } + +// /// +// /// 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" +// /// +// public bool AllowAddingOnlyExistingAttributeCombinations { get; set; } + +// /// +// /// Gets or sets a value indicating whether to display attribute combination images only +// /// +// public bool DisplayAttributeCombinationImagesOnly { get; set; } + +// /// +// /// Gets or sets a value indicating whether this product is returnable (a customer is allowed to submit return request with this product) +// /// +// public bool NotReturnable { get; set; } + +// /// +// /// Gets or sets a value indicating whether to disable buy (Add to cart) button +// /// +// public bool DisableBuyButton { get; set; } + +// /// +// /// Gets or sets a value indicating whether to disable "Add to wishlist" button +// /// +// public bool DisableWishlistButton { get; set; } + +// /// +// /// Gets or sets a value indicating whether this item is available for Pre-Order +// /// +// public bool AvailableForPreOrder { get; set; } + +// /// +// /// Gets or sets the start date and time of the product availability (for pre-order products) +// /// +// public DateTime? PreOrderAvailabilityStartDateTimeUtc { get; set; } + +// /// +// /// Gets or sets a value indicating whether to show "Call for Pricing" or "Call for quote" instead of price +// /// +// public bool CallForPrice { get; set; } + +// /// +// /// Gets or sets the price +// /// +// public decimal Price { get; set; } + +// /// +// /// Gets or sets the old price +// /// +// public decimal OldPrice { get; set; } + +// /// +// /// Gets or sets the product cost +// /// +// public decimal ProductCost { get; set; } + +// /// +// /// Gets or sets a value indicating whether a customer enters price +// /// +// public bool CustomerEntersPrice { get; set; } + +// /// +// /// Gets or sets the minimum price entered by a customer +// /// +// public decimal MinimumCustomerEnteredPrice { get; set; } + +// /// +// /// Gets or sets the maximum price entered by a customer +// /// +// public decimal MaximumCustomerEnteredPrice { get; set; } + +// /// +// /// Gets or sets a value indicating whether base price (PAngV) is enabled. Used by German users. +// /// +// public bool BasepriceEnabled { get; set; } + +// /// +// /// Gets or sets an amount in product for PAngV +// /// +// public decimal BasepriceAmount { get; set; } + +// /// +// /// Gets or sets a unit of product for PAngV (MeasureWeight entity) +// /// +// public int BasepriceUnitId { get; set; } + +// /// +// /// Gets or sets a reference amount for PAngV +// /// +// public decimal BasepriceBaseAmount { get; set; } + +// /// +// /// Gets or sets a reference unit for PAngV (MeasureWeight entity) +// /// +// public int BasepriceBaseUnitId { get; set; } + +// /// +// /// Gets or sets a value indicating whether this product is marked as new +// /// +// public bool MarkAsNew { get; set; } + +// /// +// /// Gets or sets the start date and time of the new product (set product as "New" from date). Leave empty to ignore this property +// /// +// public DateTime? MarkAsNewStartDateTimeUtc { get; set; } + +// /// +// /// Gets or sets the end date and time of the new product (set product as "New" to date). Leave empty to ignore this property +// /// +// public DateTime? MarkAsNewEndDateTimeUtc { get; set; } + +// /// +// /// Gets or sets the weight +// /// +// public decimal Weight { get; set; } + +// /// +// /// Gets or sets the length +// /// +// public decimal Length { get; set; } + +// /// +// /// Gets or sets the width +// /// +// public decimal Width { get; set; } + +// /// +// /// Gets or sets the height +// /// +// public decimal Height { get; set; } + +// /// +// /// Gets or sets the available start date and time +// /// +// public DateTime? AvailableStartDateTimeUtc { get; set; } + +// /// +// /// Gets or sets the available end date and time +// /// +// public DateTime? AvailableEndDateTimeUtc { get; set; } + +// /// +// /// 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 +// /// +// public int DisplayOrder { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity is published +// /// +// public bool Published { get; set; } + +// /// +// /// Gets or sets a value indicating whether the entity has been deleted +// /// +// public bool Deleted { get; set; } + +// /// +// /// Gets or sets the date and time of product creation +// /// +// public DateTime CreatedOnUtc { get; set; } + +// /// +// /// Gets or sets the date and time of product update +// /// +// public DateTime UpdatedOnUtc { get; set; } + +// /// +// /// Gets or sets the product type +// /// +// public ProductType ProductType +// { +// get => (ProductType)ProductTypeId; +// set => ProductTypeId = (int)value; +// } + +// /// +// /// Gets or sets the backorder mode +// /// +// public BackorderMode BackorderMode +// { +// get => (BackorderMode)BackorderModeId; +// set => BackorderModeId = (int)value; +// } + +// /// +// /// Gets or sets the download activation type +// /// +// public DownloadActivationType DownloadActivationType +// { +// get => (DownloadActivationType)DownloadActivationTypeId; +// set => DownloadActivationTypeId = (int)value; +// } + +// /// +// /// Gets or sets the gift card type +// /// +// public GiftCardType GiftCardType +// { +// get => (GiftCardType)GiftCardTypeId; +// set => GiftCardTypeId = (int)value; +// } + +// /// +// /// Gets or sets the low stock activity +// /// +// public LowStockActivity LowStockActivity +// { +// get => (LowStockActivity)LowStockActivityId; +// set => LowStockActivityId = (int)value; +// } + +// /// +// /// Gets or sets the value indicating how to manage inventory +// /// +// public ManageInventoryMethod ManageInventoryMethod +// { +// get => (ManageInventoryMethod)ManageInventoryMethodId; +// set => ManageInventoryMethodId = (int)value; +// } + +// /// +// /// Gets or sets the cycle period for recurring products +// /// +// public RecurringProductCyclePeriod RecurringCyclePeriod +// { +// get => (RecurringProductCyclePeriod)RecurringCyclePeriodId; +// set => RecurringCyclePeriodId = (int)value; +// } + +// /// +// /// Gets or sets the period for rental products +// /// +// public RentalPricePeriod RentalPricePeriod +// { +// get => (RentalPricePeriod)RentalPricePeriodId; +// set => RentalPricePeriodId = (int)value; +// } +//} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/IAclSupported.cs b/Mango.Nop.Core/NopDependencies/IAclSupported.cs new file mode 100644 index 0000000..2b25f1b --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/IAclSupported.cs @@ -0,0 +1,12 @@ +namespace Nop.Core.Domain.Security; + +/// +/// Represents an entity which supports ACL +/// +public partial interface IAclSupported +{ + /// + /// Gets or sets a value indicating whether the entity is subject to ACL + /// + bool SubjectToAcl { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/IDiscountSupported.cs b/Mango.Nop.Core/NopDependencies/IDiscountSupported.cs new file mode 100644 index 0000000..7378c44 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/IDiscountSupported.cs @@ -0,0 +1,9 @@ +namespace Nop.Core.Domain.Discounts; + +/// +/// Represents an entity which supports discounts +/// +public partial interface IDiscountSupported where T : DiscountMapping +{ + int Id { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/ILocalizedEntity.cs b/Mango.Nop.Core/NopDependencies/ILocalizedEntity.cs new file mode 100644 index 0000000..472e48e --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/ILocalizedEntity.cs @@ -0,0 +1,8 @@ +namespace Nop.Core.Domain.Localization; + +/// +/// Represents a localized entity +/// +public partial interface ILocalizedEntity +{ +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/ISlugSupported.cs b/Mango.Nop.Core/NopDependencies/ISlugSupported.cs new file mode 100644 index 0000000..a095aa5 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/ISlugSupported.cs @@ -0,0 +1,8 @@ +namespace Nop.Core.Domain.Seo; + +/// +/// Represents an entity which supports slug (SEO friendly one-word URLs) +/// +public partial interface ISlugSupported +{ +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/ISoftDeletedEntity.cs b/Mango.Nop.Core/NopDependencies/ISoftDeletedEntity.cs new file mode 100644 index 0000000..0ab5f39 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/ISoftDeletedEntity.cs @@ -0,0 +1,12 @@ +//namespace Mango.Nop.Core.NopDependencies; +namespace Nop.Core.Domain.Common; +/// +/// Represents a soft-deleted (without actually deleting from storage) entity +/// +public partial interface ISoftDeletedEntity +{ + /// + /// Gets or sets a value indicating whether the entity has been deleted + /// + bool Deleted { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/IStoreMappingSupported.cs b/Mango.Nop.Core/NopDependencies/IStoreMappingSupported.cs new file mode 100644 index 0000000..f8d9959 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/IStoreMappingSupported.cs @@ -0,0 +1,12 @@ +namespace Nop.Core.Domain.Stores; + +/// +/// Represents an entity which supports store mapping +/// +public partial interface IStoreMappingSupported +{ + /// + /// Gets or sets a value indicating whether the entity is limited/restricted to certain stores + /// + bool LimitedToStores { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/OrderStatus.cs b/Mango.Nop.Core/NopDependencies/OrderStatus.cs new file mode 100644 index 0000000..cb7317b --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/OrderStatus.cs @@ -0,0 +1,27 @@ +namespace Nop.Core.Domain.Orders; + +/// +/// Represents an order status enumeration +/// +public enum OrderStatus +{ + /// + /// Pending + /// + Pending = 10, + + /// + /// Processing + /// + Processing = 20, + + /// + /// Complete + /// + Complete = 30, + + /// + /// Cancelled + /// + Cancelled = 40 +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/PaymentStatus.cs b/Mango.Nop.Core/NopDependencies/PaymentStatus.cs new file mode 100644 index 0000000..3308df0 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/PaymentStatus.cs @@ -0,0 +1,37 @@ +namespace Nop.Core.Domain.Payments; + +/// +/// Represents a payment status enumeration +/// +public enum PaymentStatus +{ + /// + /// Pending + /// + Pending = 10, + + /// + /// Authorized + /// + Authorized = 20, + + /// + /// Paid + /// + Paid = 30, + + /// + /// Partially Refunded + /// + PartiallyRefunded = 35, + + /// + /// Refunded + /// + Refunded = 40, + + /// + /// Voided + /// + Voided = 50 +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/ShippingStatus.cs b/Mango.Nop.Core/NopDependencies/ShippingStatus.cs new file mode 100644 index 0000000..eb18de6 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/ShippingStatus.cs @@ -0,0 +1,32 @@ +namespace Nop.Core.Domain.Shipping; + +/// +/// Represents the shipping status enumeration +/// +public enum ShippingStatus +{ + /// + /// Shipping not required + /// + ShippingNotRequired = 10, + + /// + /// Not yet shipped + /// + NotYetShipped = 20, + + /// + /// Partially shipped + /// + PartiallyShipped = 25, + + /// + /// Shipped + /// + Shipped = 30, + + /// + /// Delivered + /// + Delivered = 40 +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/TaxDisplayType.cs b/Mango.Nop.Core/NopDependencies/TaxDisplayType.cs new file mode 100644 index 0000000..9a8abe4 --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/TaxDisplayType.cs @@ -0,0 +1,17 @@ +namespace Nop.Core.Domain.Tax; + +/// +/// Represents the tax display type enumeration +/// +public enum TaxDisplayType +{ + /// + /// Including tax + /// + IncludingTax = 0, + + /// + /// Excluding tax + /// + ExcludingTax = 10 +} \ No newline at end of file diff --git a/Mango.Nop.Core/NopDependencies/VatNumberStatus.cs b/Mango.Nop.Core/NopDependencies/VatNumberStatus.cs new file mode 100644 index 0000000..f65de8e --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/VatNumberStatus.cs @@ -0,0 +1,27 @@ +namespace Nop.Core.Domain.Tax; + +/// +/// Represents the VAT number status enumeration +/// +public enum VatNumberStatus +{ + /// + /// Unknown + /// + Unknown = 0, + + /// + /// Empty + /// + Empty = 10, + + /// + /// Valid + /// + Valid = 20, + + /// + /// Invalid + /// + Invalid = 30 +} \ No newline at end of file diff --git a/Mango.Nop.Core/Utils/CommonHelper2.cs b/Mango.Nop.Core/Utils/CommonHelper2.cs new file mode 100644 index 0000000..ec0bb94 --- /dev/null +++ b/Mango.Nop.Core/Utils/CommonHelper2.cs @@ -0,0 +1,312 @@ +using System.ComponentModel; +using System.Globalization; +using System.Net; +using System.Text.RegularExpressions; + +namespace Mango.Nop.Core.Utils; + +/// +/// Represents a common helper +/// +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 + + /// + /// Get email validation regex + /// + /// Regular expression + [GeneratedRegex(EMAIL_EXPRESSION, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture, "en-US")] + public static partial Regex GetEmailRegex(); + + /// + /// Ensures the subscriber email or throw. + /// + /// The email. + /// + 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; + } + + /// + /// Verifies that a string is in valid e-mail format + /// + /// Email to verify + /// true if the string is a valid e-mail address and false if it's not + public static bool IsValidEmail(string email) + { + if (string.IsNullOrEmpty(email)) + return false; + + email = email.Trim(); + + return GetEmailRegex().IsMatch(email); + } + + /// + /// Verifies that string is an valid IP-Address + /// + /// IPAddress to verify + /// true if the string is a valid IpAddress and false if it's not + public static bool IsValidIpAddress(string ipAddress) + { + return IPAddress.TryParse(ipAddress, out var _); + } + + ///// + ///// Generate random digit code + ///// + ///// Length + ///// Result string + //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; + //} + + ///// + ///// Returns an random integer number within a specified rage + ///// + ///// Minimum number + ///// Maximum number + ///// Result + //public static int GenerateRandomInteger(int min = 0, int max = int.MaxValue) + //{ + // using var random = new SecureRandomNumberGenerator(); + // return random.Next(min, max); + //} + + /// + /// Ensure that a string doesn't exceed maximum allowed length + /// + /// Input string + /// Maximum length + /// A string to add to the end if the original string was shorten + /// Input string if its length is OK; otherwise, truncated input string + 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; + } + + /// + /// Ensures that a string only contains numeric values + /// + /// Input string + /// Input string with only numeric values, empty string if input is null/empty + public static string EnsureNumericOnly(string str) + { + return string.IsNullOrEmpty(str) ? string.Empty : new string(str.Where(char.IsDigit).ToArray()); + } + + /// + /// Ensure that a string is not null + /// + /// Input string + /// Result + public static string EnsureNotNull(string str) + { + return str ?? string.Empty; + } + + /// + /// Indicates whether the specified strings are null or empty strings + /// + /// Array of strings to validate + /// Boolean + public static bool AreNullOrEmpty(params string[] stringsToValidate) + { + return stringsToValidate.Any(string.IsNullOrEmpty); + } + + /// + /// Compare two arrays + /// + /// Type + /// Array 1 + /// Array 2 + /// Result + public static bool ArraysEqual(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.Default; + return !a1.Where((t, i) => !comparer.Equals(t, a2[i])).Any(); + } + + /// + /// Sets a property on an object to a value. + /// + /// The object whose property to set. + /// The name of the property to set. + /// The value to set the property to. + 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()); + } + + /// + /// Converts a value to a destination type. + /// + /// The value to convert. + /// The type to convert the value to. + /// The converted value. + public static object To(object value, Type destinationType) + { + return To(value, destinationType, CultureInfo.InvariantCulture); + } + + /// + /// Converts a value to a destination type. + /// + /// The value to convert. + /// The type to convert the value to. + /// Culture + /// The converted value. + 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; + } + + /// + /// Converts a value to a destination type. + /// + /// The value to convert. + /// The type to convert the value to. + /// The converted value. + public static T To(object value) + { + //return (T)Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture); + return (T)To(value, typeof(T)); + } + + /// + /// Splits the camel-case word into separate one + /// + /// Input string + /// Splitted string + 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; + } + + /// + /// Get difference in years + /// + /// + /// + /// + 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; + } + + /// + /// Get DateTime to the specified year, month, and day using the conventions of the current thread culture + /// + /// The year + /// The month + /// The day + /// An instance of the Nullable + 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 +} \ No newline at end of file diff --git a/Mango.Nop.Data/Mango.Nop.Data.csproj b/Mango.Nop.Data/Mango.Nop.Data.csproj index b7626e2..3dad459 100644 --- a/Mango.Nop.Data/Mango.Nop.Data.csproj +++ b/Mango.Nop.Data/Mango.Nop.Data.csproj @@ -6,6 +6,8 @@ enable bin\FruitBank False + true + true diff --git a/Mango.Nop.Services/Mango.Nop.Services.csproj b/Mango.Nop.Services/Mango.Nop.Services.csproj index 650482f..34f9cf5 100644 --- a/Mango.Nop.Services/Mango.Nop.Services.csproj +++ b/Mango.Nop.Services/Mango.Nop.Services.csproj @@ -1,48 +1,50 @@  - - net9.0 - enable - enable - bin\FruitBank - + + net9.0 + enable + enable + bin\FruitBank + true + true + - - - - + + + + - - - - - - - - + + + + + + + + - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll - - - ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll - - + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.Server.dll + + + ..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Utils.dll + +