Class CompletionRuleService
- Namespace
- Dynamicweb.Ecommerce.Products.CompletionRules
- Assembly
- Dynamicweb.Ecommerce.dll
The CompletionRuleService class providing methods for querying and saving the product completion rule data and computing pruduct completion.
public class CompletionRuleService : ICacheStorage<int, CompletionRule>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
CompletionRuleService
- Implements
- Inherited Members
Properties
ColorSchema
public CompletionColorSchema ColorSchema { get; }
Property Value
Methods
AssignRulesToGroup(Group, IEnumerable<CompletionRule>, IEnumerable<string>)
Assign rules info to group
public void AssignRulesToGroup(Group group, IEnumerable<CompletionRule> rules, IEnumerable<string> languagesIds)
Parameters
group
Group- The group
rules
IEnumerable<CompletionRule>- The group rules
languagesIds
IEnumerable<string>- The group rules languages
AssignRulesToShop(Shop, IEnumerable<CompletionRule>)
Return amount of the rule usages
public void AssignRulesToShop(Shop shop, IEnumerable<CompletionRule> rules)
Parameters
shop
Shop- The shop
rules
IEnumerable<CompletionRule>- The shop rules
CalculateProductCompleteness(IEnumerable<Product>, CompletenessOptions)
Gets the product completeness value
public CompletnessResult CalculateProductCompleteness(IEnumerable<Product> productFamily, CompletenessOptions options)
Parameters
productFamily
IEnumerable<Product>- The products list that is one product family. The family is all products with same product.Id
options
CompletenessOptions- The calculation options
Returns
- CompletnessResult
- Return product completeness value which is weight value means how much the product satisfies the completion rules. This value is in range [0, 100].
Exceptions
- ArgumentNullException
- If
options
is null. - ArgumentException
- If
productFamily
parameter contains products from different families. - ArgumentException
- If
productFamily
contains not unuque products.
CalculateProductCompleteness(string, CompletenessOptions)
Gets the product completeness value
public CompletnessResult CalculateProductCompleteness(string productId, CompletenessOptions options)
Parameters
productId
string- The product id
options
CompletenessOptions- The calculation options
Returns
- CompletnessResult
- Return product completeness value which is weight value means how much the product satisfies the completion rules. This value is in range [0, 100].
CalculateProductCompletenessForMultipleFamilies(IEnumerable<Product>, CompletenessOptions)
Gets the completeness values per products family id
public IDictionary<string, CompletnessResult> CalculateProductCompletenessForMultipleFamilies(IEnumerable<Product> productFamilies, CompletenessOptions options)
Parameters
productFamilies
IEnumerable<Product>- The products list that are multiple product families.
options
CompletenessOptions- The calculation options
Returns
- IDictionary<string, CompletnessResult>
- Return product completeness value which is weight value means how much the product satisfies the completion rules. This value is in range [0, 100].
Exceptions
- ArgumentException
- If
productFamilies
contains not unuque products.
CalculateProductCompletenessForMultipleFamilies(IEnumerable<string>, CompletenessOptions)
Gets the completeness values per products family id
public IDictionary<string, CompletnessResult> CalculateProductCompletenessForMultipleFamilies(IEnumerable<string> productsIds, CompletenessOptions options)
Parameters
productsIds
IEnumerable<string>- The products ids
options
CompletenessOptions- The calculation options
Returns
- IDictionary<string, CompletnessResult>
- Return products completeness value which is weight value means how much the product satisfies the completion rules. This value is in range [0, 100].
CalculateQueryProductCompleteness(string, CompletenessOptions)
Gets the product completeness value. Use it if you get a product from a Query.
public CompletnessResult CalculateQueryProductCompleteness(string productId, CompletenessOptions options)
Parameters
productId
string- The product id
options
CompletenessOptions- The calculation options
Returns
- CompletnessResult
- Return product completeness value which is weight value means how much the product satisfies the completion rules. This value is in range [0, 100].
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<int> keys)
Parameters
keys
IEnumerable<int>- Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(int key)
Parameters
key
int- Key to reset
Delete(int)
Delete the completion rule.
public void Delete(int ruleId)
Parameters
ruleId
int- The completion rule
GetAll()
Gets all completion rules.
public IEnumerable<CompletionRule> GetAll()
Returns
GetById(int)
Gets the completion rule by id.
public CompletionRule GetById(int ruleId)
Parameters
ruleId
int- The completion rule id
Returns
GetByIds(IEnumerable<int>)
Gets completion rules by ids.
public IEnumerable<CompletionRule> GetByIds(IEnumerable<int> ruleIds)
Parameters
ruleIds
IEnumerable<int>- The completion rule ids to be found
Returns
GetGroupsRules(IEnumerable<Group>)
return list of the unique rules assigned to shop
public IEnumerable<CompletionRule> GetGroupsRules(IEnumerable<Group> groups)
Parameters
groups
IEnumerable<Group>- The groups
Returns
GetShopsRules(IEnumerable<Shop>)
return list of the unique rules assigned to shop
public IEnumerable<CompletionRule> GetShopsRules(IEnumerable<Shop> shops)
Parameters
shops
IEnumerable<Shop>- The shops
Returns
GetUsages(CompletionRule)
Return list of shops where rule is used
public IEnumerable<CompletionSettingsSource> GetUsages(CompletionRule rule)
Parameters
rule
CompletionRule- The completion rule
Returns
GetUsages(IEnumerable<CompletionRule>)
Return list of shops where rule is used
public IEnumerable<KeyValuePair<CompletionRule, IEnumerable<CompletionSettingsSource>>> GetUsages(IEnumerable<CompletionRule> rules)
Parameters
rules
IEnumerable<CompletionRule>- The completion rules
Returns
Save(CompletionRule)
Saves the completion rule.
public void Save(CompletionRule rule)
Parameters
rule
CompletionRule- The rule