Skip to content

Commit 02ed271

Browse files
committed
Refactoring. Clearing source code. Nop.Services
Removed unused namespace, removed redundant blank lines, added necessary blank lines, simplify some source code, removed redundant source code, Formatted some source code
1 parent cbef5d6 commit 02ed271

File tree

127 files changed

+3870
-4131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3870
-4131
lines changed

src/Libraries/Nop.Services/Affiliates/AffiliateExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public static string GetFullName(this Affiliate affiliate)
3535
return fullName;
3636
}
3737

38-
3938
/// <summary>
4039
/// Generate affiliate URL
4140
/// </summary>
@@ -74,14 +73,12 @@ public static string ValidateFriendlyUrlName(this Affiliate affiliate, string fr
7473
//ensure we have only valid chars
7574
friendlyUrlName = SeoExtensions.GetSeName(friendlyUrlName);
7675

77-
7876
//max length
7977
//For long URLs we can get the following error:
8078
//"the specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters"
8179
//that's why we limit it to 200 here (consider a store URL + probably added {0}-{1} below)
8280
friendlyUrlName = CommonHelper.EnsureMaximumLength(friendlyUrlName, 200);
8381

84-
8582
//ensure this name is not reserved yet
8683
//empty? nothing to check
8784
if (string.IsNullOrEmpty(friendlyUrlName))
@@ -103,7 +100,6 @@ public static string ValidateFriendlyUrlName(this Affiliate affiliate, string fr
103100
}
104101
friendlyUrlName = tempName;
105102

106-
107103
return friendlyUrlName;
108104
}
109105
}

src/Libraries/Nop.Services/Authentication/CookieAuthenticationService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public partial class CookieAuthenticationService : IAuthenticationService
1717
private readonly CustomerSettings _customerSettings;
1818
private readonly ICustomerService _customerService;
1919
private readonly IHttpContextAccessor _httpContextAccessor;
20-
2120
private Customer _cachedCustomer;
2221

2322
#endregion

src/Libraries/Nop.Services/Authentication/External/Events.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public CustomerAutoRegisteredByExternalMethodEvent(Customer customer, ExternalAu
1616
/// <summary>
1717
/// Gets or sets customer
1818
/// </summary>
19-
public Customer Customer { get; private set; }
19+
public Customer Customer { get; }
2020

2121
/// <summary>
2222
/// Gets or sets external authentication parameters
2323
/// </summary>
24-
public ExternalAuthenticationParameters AuthenticationParameters { get; private set; }
24+
public ExternalAuthenticationParameters AuthenticationParameters { get; }
2525
}
2626
}

src/Libraries/Nop.Services/Catalog/ICategoryService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ IList<Category> GetAllCategoriesByParentCategoryId(int parentCategoryId,
4343
/// <param name="showHidden">A value indicating whether to show hidden records</param>
4444
/// <returns>Categories</returns>
4545
IList<Category> GetAllCategoriesDisplayedOnHomePage(bool showHidden = false);
46-
46+
4747
/// <summary>
4848
/// Gets a category
4949
/// </summary>
@@ -62,7 +62,7 @@ IList<Category> GetAllCategoriesByParentCategoryId(int parentCategoryId,
6262
/// </summary>
6363
/// <param name="category">Category</param>
6464
void UpdateCategory(Category category);
65-
65+
6666
/// <summary>
6767
/// Deletes a product category mapping
6868
/// </summary>
@@ -87,6 +87,7 @@ IPagedList<ProductCategory> GetProductCategoriesByCategoryId(int categoryId,
8787
/// <param name="showHidden">A value indicating whether to show hidden records</param>
8888
/// <returns>Product category mapping collection</returns>
8989
IList<ProductCategory> GetProductCategoriesByProductId(int productId, bool showHidden = false);
90+
9091
/// <summary>
9192
/// Gets a product category mapping collection
9293
/// </summary>
@@ -134,6 +135,6 @@ IPagedList<ProductCategory> GetProductCategoriesByCategoryId(int categoryId,
134135
/// </summary>
135136
/// <param name="categoryIds">Category identifiers</param>
136137
/// <returns>Categories</returns>
137-
List<Category> GetCategoriesByIds(int [] categoryIds);
138+
List<Category> GetCategoriesByIds(int[] categoryIds);
138139
}
139140
}

src/Libraries/Nop.Services/Catalog/IManufacturerService.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial interface IManufacturerService
1414
/// </summary>
1515
/// <param name="manufacturer">Manufacturer</param>
1616
void DeleteManufacturer(Manufacturer manufacturer);
17-
17+
1818
/// <summary>
1919
/// Gets all manufacturers
2020
/// </summary>
@@ -48,14 +48,13 @@ IPagedList<Manufacturer> GetAllManufacturers(string manufacturerName = "",
4848
/// </summary>
4949
/// <param name="manufacturer">Manufacturer</param>
5050
void UpdateManufacturer(Manufacturer manufacturer);
51-
5251

5352
/// <summary>
5453
/// Deletes a product manufacturer mapping
5554
/// </summary>
5655
/// <param name="productManufacturer">Product manufacturer mapping</param>
5756
void DeleteProductManufacturer(ProductManufacturer productManufacturer);
58-
57+
5958
/// <summary>
6059
/// Gets product manufacturer collection
6160
/// </summary>
@@ -74,7 +73,7 @@ IPagedList<ProductManufacturer> GetProductManufacturersByManufacturerId(int manu
7473
/// <param name="showHidden">A value indicating whether to show hidden records</param>
7574
/// <returns>Product manufacturer mapping collection</returns>
7675
IList<ProductManufacturer> GetProductManufacturersByProductId(int productId, bool showHidden = false);
77-
76+
7877
/// <summary>
7978
/// Gets a product manufacturer mapping
8079
/// </summary>

src/Libraries/Nop.Services/Catalog/IPriceCalculationService.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ decimal GetFinalPrice(Product product,
2626
decimal additionalCharge = decimal.Zero,
2727
bool includeDiscounts = true,
2828
int quantity = 1);
29+
2930
/// <summary>
3031
/// Gets the final price
3132
/// </summary>
@@ -44,6 +45,7 @@ decimal GetFinalPrice(Product product,
4445
int quantity,
4546
out decimal discountAmount,
4647
out List<DiscountForCaching> appliedDiscounts);
48+
4749
/// <summary>
4850
/// Gets the final price
4951
/// </summary>
@@ -67,8 +69,6 @@ decimal GetFinalPrice(Product product,
6769
out decimal discountAmount,
6870
out List<DiscountForCaching> appliedDiscounts);
6971

70-
71-
7272
/// <summary>
7373
/// Gets the shopping cart unit price (one item)
7474
/// </summary>
@@ -77,6 +77,7 @@ decimal GetFinalPrice(Product product,
7777
/// <returns>Shopping cart unit price (one item)</returns>
7878
decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
7979
bool includeDiscounts = true);
80+
8081
/// <summary>
8182
/// Gets the shopping cart unit price (one item)
8283
/// </summary>
@@ -89,6 +90,7 @@ decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
8990
bool includeDiscounts,
9091
out decimal discountAmount,
9192
out List<DiscountForCaching> appliedDiscounts);
93+
9294
/// <summary>
9395
/// Gets the shopping cart unit price (one item)
9496
/// </summary>
@@ -114,6 +116,7 @@ decimal GetUnitPrice(Product product,
114116
bool includeDiscounts,
115117
out decimal discountAmount,
116118
out List<DiscountForCaching> appliedDiscounts);
119+
117120
/// <summary>
118121
/// Gets the shopping cart item sub total
119122
/// </summary>
@@ -122,6 +125,7 @@ decimal GetUnitPrice(Product product,
122125
/// <returns>Shopping cart item sub total</returns>
123126
decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
124127
bool includeDiscounts = true);
128+
125129
/// <summary>
126130
/// Gets the shopping cart item sub total
127131
/// </summary>
@@ -144,9 +148,6 @@ decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
144148
/// <param name="attributesXml">Shopping cart item attributes in XML</param>
145149
/// <returns>Product cost (one item)</returns>
146150
decimal GetProductCost(Product product, string attributesXml);
147-
148-
149-
150151

151152
/// <summary>
152153
/// Get a price adjustment of a product attribute value

src/Libraries/Nop.Services/Catalog/IPriceFormatter.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ string FormatPrice(decimal price, bool showCurrency,
9191
/// <returns>Rental product price with period</returns>
9292
string FormatRentalProductPeriod(Product product, string price);
9393

94-
95-
9694
/// <summary>
9795
/// Formats the shipping price
9896
/// </summary>
@@ -112,6 +110,7 @@ string FormatPrice(decimal price, bool showCurrency,
112110
/// <returns>Price</returns>
113111
string FormatShippingPrice(decimal price, bool showCurrency,
114112
Currency targetCurrency, Language language, bool priceIncludesTax);
113+
115114
/// <summary>
116115
/// Formats the shipping price
117116
/// </summary>
@@ -137,8 +136,6 @@ string FormatShippingPrice(decimal price, bool showCurrency,
137136
string FormatShippingPrice(decimal price, bool showCurrency,
138137
string currencyCode, Language language, bool priceIncludesTax);
139138

140-
141-
142139
/// <summary>
143140
/// Formats the payment method additional fee
144141
/// </summary>
@@ -184,8 +181,6 @@ string FormatPaymentMethodAdditionalFee(decimal price, bool showCurrency,
184181
string FormatPaymentMethodAdditionalFee(decimal price, bool showCurrency,
185182
string currencyCode, Language language, bool priceIncludesTax);
186183

187-
188-
189184
/// <summary>
190185
/// Formats a tax rate
191186
/// </summary>

src/Libraries/Nop.Services/Catalog/ManufacturerExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ public static ProductManufacturer FindProductManufacturer(this IList<ProductManu
2424

2525
return null;
2626
}
27-
2827
}
2928
}

src/Libraries/Nop.Services/Catalog/ManufacturerService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Nop.Services.Catalog
1818
public partial class ManufacturerService : IManufacturerService
1919
{
2020
#region Constants
21+
2122
/// <summary>
2223
/// Key for caching
2324
/// </summary>
@@ -110,6 +111,7 @@ public ManufacturerService(ICacheManager cacheManager,
110111
this._catalogSettings = catalogSettings;
111112
this._eventPublisher = eventPublisher;
112113
}
114+
113115
#endregion
114116

115117
#region Methods
@@ -239,7 +241,6 @@ public virtual void UpdateManufacturer(Manufacturer manufacturer)
239241
//event notification
240242
_eventPublisher.EntityUpdated(manufacturer);
241243
}
242-
243244

244245
/// <summary>
245246
/// Deletes a product manufacturer mapping
@@ -458,7 +459,6 @@ public virtual IDictionary<int, int[]> GetProductManufacturerIds(int[] productId
458459
.ToDictionary(items => items.Key, items => items.Select(a => a.ManufacturerId).ToArray());
459460
}
460461

461-
462462
/// <summary>
463463
/// Returns a list of names of not existing manufacturers
464464
/// </summary>

src/Libraries/Nop.Services/Catalog/PriceCalculationService.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public ProductPriceForCaching()
7575
public decimal AppliedDiscountAmount { get; set; }
7676
public List<DiscountForCaching> AppliedDiscounts { get; set; }
7777
}
78+
7879
#endregion
7980

8081
#region Utilities
@@ -315,6 +316,7 @@ public virtual decimal GetFinalPrice(Product product,
315316
null, null,
316317
out discountAmount, out appliedDiscounts);
317318
}
319+
318320
/// <summary>
319321
/// Gets the final price
320322
/// </summary>
@@ -341,6 +343,7 @@ public virtual decimal GetFinalPrice(Product product,
341343
return GetFinalPrice(product, customer, null, additionalCharge, includeDiscounts, quantity,
342344
rentalStartDate, rentalEndDate, out discountAmount, out appliedDiscounts);
343345
}
346+
344347
/// <summary>
345348
/// Gets the final price
346349
/// </summary>
@@ -437,8 +440,6 @@ public virtual decimal GetFinalPrice(Product product,
437440
return cachedPrice.Price;
438441
}
439442

440-
441-
442443
/// <summary>
443444
/// Gets the shopping cart unit price (one item)
444445
/// </summary>
@@ -453,6 +454,7 @@ public virtual decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
453454
return GetUnitPrice(shoppingCartItem, includeDiscounts,
454455
out discountAmount, out appliedDiscounts);
455456
}
457+
456458
/// <summary>
457459
/// Gets the shopping cart unit price (one item)
458460
/// </summary>
@@ -481,6 +483,7 @@ public virtual decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
481483
out discountAmount,
482484
out appliedDiscounts);
483485
}
486+
484487
/// <summary>
485488
/// Gets the shopping cart unit price (one item)
486489
/// </summary>
@@ -586,6 +589,7 @@ public virtual decimal GetUnitPrice(Product product,
586589

587590
return finalPrice;
588591
}
592+
589593
/// <summary>
590594
/// Gets the shopping cart item sub total
591595
/// </summary>
@@ -597,6 +601,7 @@ public virtual decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
597601
{
598602
return GetSubTotal(shoppingCartItem, includeDiscounts, out decimal _, out List<DiscountForCaching> _, out int? _);
599603
}
604+
600605
/// <summary>
601606
/// Gets the shopping cart item sub total
602607
/// </summary>
@@ -662,7 +667,6 @@ public virtual decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
662667
return subTotal;
663668
}
664669

665-
666670
/// <summary>
667671
/// Gets the product cost (one item)
668672
/// </summary>
@@ -702,8 +706,6 @@ public virtual decimal GetProductCost(Product product, string attributesXml)
702706
return cost;
703707
}
704708

705-
706-
707709
/// <summary>
708710
/// Get a price adjustment of a product attribute value
709711
/// </summary>

src/Libraries/Nop.Services/Catalog/PriceFormatter.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ public virtual string FormatRentalProductPeriod(Product product, string price)
271271
return result;
272272
}
273273

274-
275274
/// <summary>
276275
/// Formats the shipping price
277276
/// </summary>
@@ -336,8 +335,6 @@ public virtual string FormatShippingPrice(decimal price, bool showCurrency,
336335
return FormatShippingPrice(price, showCurrency, currency, language, priceIncludesTax);
337336
}
338337

339-
340-
341338
/// <summary>
342339
/// Formats the payment method additional fee
343340
/// </summary>
@@ -405,8 +402,6 @@ public virtual string FormatPaymentMethodAdditionalFee(decimal price, bool showC
405402
language, priceIncludesTax);
406403
}
407404

408-
409-
410405
/// <summary>
411406
/// Formats a tax rate
412407
/// </summary>

src/Libraries/Nop.Services/Catalog/ProductAttributeService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace Nop.Services.Catalog
1515
public partial class ProductAttributeService : IProductAttributeService
1616
{
1717
#region Constants
18+
1819
/// <summary>
1920
/// Key for caching
2021
/// </summary>
@@ -94,7 +95,6 @@ public partial class ProductAttributeService : IProductAttributeService
9495
private readonly IEventPublisher _eventPublisher;
9596
private readonly ICacheManager _cacheManager;
9697

97-
9898
#endregion
9999

100100
#region Ctor

0 commit comments

Comments
 (0)