Class GroupService
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
The GroupService class providing methods for querying and saving the Group aggregate to and from persistence.
public class GroupService : ICacheStorage<GroupKey, Group>, ICacheStorage<GroupKey>, ICacheStorage
- Inheritance
-
GroupService
- Implements
- Inherited Members
Methods
AddRelatedProductId(Group, string, string)
Adds the related product to group.
public void AddRelatedProductId(Group group, string relatedGroupId, string productId)
Parameters
groupGroup- The group.
relatedGroupIdstring- The relation group ID.
productIdstring- The product ID.
AddRelatedProductId(Group, string, string, string)
Adds the related product to group.
public void AddRelatedProductId(Group group, string relatedGroupId, string productId, string variantId)
Parameters
groupGroup- The group.
relatedGroupIdstring- The relation group ID.
productIdstring- The product ID.
variantIdstring- The variant ID.
AddSubgroup(Group, Group)
Adds a subgroup to group.
public void AddSubgroup(Group toGroup, Group subgroup)
Parameters
ClearCache()
Clears all the product group cache.
public void ClearCache()
ClearCache(GroupKey)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(GroupKey key)
Parameters
keyGroupKey- Key to reset
ClearCache(bool)
Clears the product group cache.
[Obsolete("Use ClearCache() instead.")]
public void ClearCache(bool clearAssortmentsNavigationCache)
Parameters
clearAssortmentsNavigationCachebool- The indicator whether to clear assortment navigation cache also.
ClearCache(IEnumerable<GroupKey>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<GroupKey> keys)
Parameters
keysIEnumerable<GroupKey>- Keys to reset
ClearOrderLineFieldCache(Group)
Clears order line fields cache.
[Obsolete("No longer used. Cached fields are cleared when changes are made to fields or field relations.")]
public void ClearOrderLineFieldCache(Group group)
Parameters
groupGroup
ClearProductGroupRelationCache()
Clears the product group relation cache
public void ClearProductGroupRelationCache()
ClearProductGroupRelationCache(string)
Clears the product group relation cache
public void ClearProductGroupRelationCache(string productId)
Parameters
productIdstring
CreateProductGroupRelation(string, string, bool?)
Creates the new product group relation.
public ProductGroupRelation CreateProductGroupRelation(string productId, string groupId, bool? isPrimary = null)
Parameters
productIdstring- The product Id.
groupIdstring- The group Id.
isPrimarybool?- Is this group primary.
Returns
Delete(Group, string)
Deletes the group.
public void Delete(Group group, string languageId)
Parameters
Delete(GroupCollection)
Deletes all groups from provided collection.
public void Delete(GroupCollection groups)
Parameters
groupsGroupCollection- The group collection.
DeleteAll(GroupCollection)
Deletes appropriate relations between shops, other groups and products as well.
public void DeleteAll(GroupCollection groups)
Parameters
groupsGroupCollection- The groups collection.
DeleteRelatedProductId(Group, string, string)
Deletes the related product from relation.
public void DeleteRelatedProductId(Group group, string relatedGroupId, string productId)
Parameters
groupGroup- The group.
relatedGroupIdstring- The relation group ID.
productIdstring- The product ID to delete.
DeleteRelatedProductId(Group, string, string, string)
Deletes the related product from relation.
public void DeleteRelatedProductId(Group group, string relatedGroupId, string productId, string variantId)
Parameters
groupGroup- The group.
relatedGroupIdstring- The relation group ID.
productIdstring- The product ID to delete.
variantIdstring- The product variant ID to delete.
DeleteRelatedProducts(Group, string)
Deletes the related products from group.
public void DeleteRelatedProducts(Group group, string relatedGroupId)
Parameters
DeleteRelation(ProductGroupRelation)
Deletes the specified product relation.
public void DeleteRelation(ProductGroupRelation relation)
Parameters
relationProductGroupRelation- The product group relation.
DeleteRelation(string, string)
Deletes the specified product relation.
public void DeleteRelation(string productId, string groupId)
Parameters
DeleteRelations(IEnumerable<Product>)
Deletes the specified product relations.
public int DeleteRelations(IEnumerable<Product> products)
Parameters
productsIEnumerable<Product>- The products.
Returns
- int
- The number of rows affected by the command.
DeleteRelations(IEnumerable<Product>, string)
Deletes the specified product relations.
public int DeleteRelations(IEnumerable<Product> products, string groupId)
Parameters
productsIEnumerable<Product>- The products
groupIdstring- The group Id.
Returns
- int
- The number of rows affected by the command.
FindGroups(string, int)
Finds the groups by keyword.
public IEnumerable<Group> FindGroups(string keyword, int maxAmount)
Parameters
Returns
FindGroups(string, int, string)
Finds the groups by keyword.
public IEnumerable<Group> FindGroups(string keyword, int maxAmount, string shopId)
Parameters
keywordstring- The keyword to find.
maxAmountint- The maximum number of returned results.
shopIdstring- The shop ID to search in.
Returns
FindPath(Shop, Group)
Find path from shop to group.
public IEnumerable<Group> FindPath(Shop fromShop, Group toGroup)
Parameters
Returns
- IEnumerable<Group>
- returns path to group include target group or empty if path not found
GetGroup(string)
Gets the group by ID.
public Group GetGroup(string groupId)
Parameters
groupIdstring- The group ID.
Returns
- Group
- The group.
GetGroup(string, string)
Gets the group.
public Group GetGroup(string groupId, string languageId)
Parameters
Returns
- Group
- The group.
GetGroup(string, string, bool)
Gets the group.
public Group GetGroup(string groupId, string languageId, bool showUnTranslated)
Parameters
Returns
- Group
- The group.
GetGroup(string, string, string)
Gets the group.
[Obsolete("Use overloaded GetGroup with showUnTranslated instead.")]
public Group GetGroup(string groupId, string languageId, string defaultLanguageId)
Parameters
groupIdstring- The group ID.
languageIdstring- The language ID.
defaultLanguageIdstring- The default language ID.
Returns
- Group
- The group.
GetGroups()
Gets all product groups sorted by name.
public IEnumerable<Group> GetGroups()
Returns
- IEnumerable<Group>
- The GroupCollection.
GetGroups(IEnumerable<string>)
Gets groups by provided group IDs.
public IEnumerable<Group> GetGroups(IEnumerable<string> groupIds)
Parameters
groupIdsIEnumerable<string>- The list of group IDs.
Returns
- IEnumerable<Group>
- Groups ordered by name
GetGroups(IEnumerable<string>, bool)
Gets groups by provided group IDs.
[Obsolete("Use overloaded GetGroups with specified languageId and showUnTranslated instead.")]
public IEnumerable<Group> GetGroups(IEnumerable<string> groupIds, bool applyFiltering)
Parameters
groupIdsIEnumerable<string>- The list of group IDs.
applyFilteringbool- The filter results by current language.
Returns
GetGroups(IEnumerable<string>, string)
Gets groups by provided group IDs.
public IEnumerable<Group> GetGroups(IEnumerable<string> groupIds, string languageId)
Parameters
groupIdsIEnumerable<string>- The list of group IDs.
languageIdstring
Returns
- IEnumerable<Group>
- Groups ordered by name
GetGroups(IEnumerable<string>, string, bool, bool)
Gets groups by provided group IDs.
public IEnumerable<Group> GetGroups(IEnumerable<string> groupIds, string languageId, bool showUnTranslated, bool keepSortOrder)
Parameters
groupIdsIEnumerable<string>- The list of group IDs.
languageIdstring- The language ID.
showUnTranslatedboolkeepSortOrderbool- Group sorting is based on order of specified group Ids.
Returns
GetGroups(string)
Gets groups by language ID.
public IEnumerable<Group> GetGroups(string languageId)
Parameters
languageIdstring- The language ID.
Returns
- IEnumerable<Group>
- The GroupCollection.
GetGroupShops(string)
Gets the shops for specified group.
public IEnumerable<Shop> GetGroupShops(string groupId)
Parameters
groupIdstring- The group ID.
Returns
- IEnumerable<Shop>
- The collections of the Shop.
GetProductCountByGroupsForBackendTree(GroupCollection)
Gets products count in groups for current language, without variants.
[Obsolete("It is not used.")]
public Dictionary<string, int> GetProductCountByGroupsForBackendTree(GroupCollection groups)
Parameters
groupsGroupCollection
Returns
GetProductCountForBackendTree(string, string)
Gets the number of the products in the group.
public int GetProductCountForBackendTree(string groupId, string languageId)
Parameters
Returns
- int
- The number of products with the specified language ID in the group.
GetProductGroupRelation(string, string)
Gets the product group relation.
public ProductGroupRelation GetProductGroupRelation(string productId, string groupId)
Parameters
Returns
GetProductGroupRelations(string)
Gets the product group relations.
public IEnumerable<ProductGroupRelation> GetProductGroupRelations(string productId)
Parameters
productIdstring- The product Id.
Returns
GetRelatedGroups(IEnumerable<ProductGroupRelation>)
Gets the related groups.
[Obsolete("Use 'Services.ProductGroups.GetRelatedGroups(relations, languageId)' instead")]
public IEnumerable<Group> GetRelatedGroups(IEnumerable<ProductGroupRelation> relations)
Parameters
relationsIEnumerable<ProductGroupRelation>
Returns
- IEnumerable<Group>
- The group collection.
GetRelatedGroups(IEnumerable<ProductGroupRelation>, string)
public IEnumerable<Group> GetRelatedGroups(IEnumerable<ProductGroupRelation> relations, string languageId)
Parameters
relationsIEnumerable<ProductGroupRelation>languageIdstring
Returns
GetRelatedProductIds(Group, string)
Gets the string with list of related product IDs for relation group. Related products are used as default list of related products for child products.
public string GetRelatedProductIds(Group group, string relatedGroupId)
Parameters
Returns
- string
- Related product ids, delimited by "#;#"
GetRelatedProducts(Group, string)
Gets the list of related products for relation group. Related products are used as default list of related products for child products.
public IEnumerable<Product> GetRelatedProducts(Group group, string relatedGroupId)
Parameters
Returns
- IEnumerable<Product>
- Related products collection
GetSubgroups(Group)
Gets the subgroups for this Group in the same language as the group.
public IEnumerable<Group> GetSubgroups(Group group)
Parameters
groupGroup
Returns
GetSubgroups(Group, bool)
Gets the list of child groups in current or default language.
public IEnumerable<Group> GetSubgroups(Group group, bool showUnTranslated)
Parameters
Returns
GetToplevelGroups()
Gets the top level groups.
public IEnumerable<Group> GetToplevelGroups()
Returns
- IEnumerable<Group>
- The GroupCollection.
GetToplevelGroups(string)
Gets the top level groups in specified language.
public IEnumerable<Group> GetToplevelGroups(string languageId)
Parameters
languageIdstring- The language ID.
Returns
- IEnumerable<Group>
- The GroupCollection.
HasProducts(Group)
Determines whether the group contains products.
public bool HasProducts(Group group)
Parameters
groupGroup- The group.
Returns
- bool
True, if group contains at least one product, otherwise,False.
HasProductsWithoutVariants(Group)
Determines whether the group contains products without variants.
public bool HasProductsWithoutVariants(Group group)
Parameters
groupGroup- The group.
Returns
- bool
True, if group contains at least one product, otherwise,False.
HasProductsWithVariants(Group)
Determines whether the group contains products with variants.
public bool HasProductsWithVariants(Group group)
Parameters
groupGroup- The group.
Returns
- bool
True, if group contains at least one product, otherwise,False.
HasSubgroups(Group)
Defines if a group includes child elements.
public bool HasSubgroups(Group group)
Parameters
groupGroup
Returns
MoveToGroup(IEnumerable<Product>, string, string)
Moves to group.
public int MoveToGroup(IEnumerable<Product> products, string toGroupId, string fromGroupId)
Parameters
productsIEnumerable<Product>- The products.
toGroupIdstring- The destination group id.
fromGroupIdstring- The source group id.
Returns
- int
- The number of rows affected by the command.
Save(Group)
Saves the group.
public void Save(Group group)
Parameters
groupGroup- The group.
Save(Group, string)
Saves the group.
public void Save(Group group, string groupId)
Parameters
Save(ProductGroupRelation)
Saves the product group relation
public void Save(ProductGroupRelation relation)
Parameters
relationProductGroupRelation- The product group relation.
UpdateGroupId(Group, string)
Updates the group ID in all related tables.
public void UpdateGroupId(Group group, string newGroupId)