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
Properties
DataModelPrefix
public virtual string DataModelPrefix { get; }
Property Value
Methods
AddGroupRelationForProductIds(IEnumerable<string>, IEnumerable<string>)
Adds group relation to specified product ids
public virtual void AddGroupRelationForProductIds(IEnumerable<string> groupIds, IEnumerable<string> productIds)
Parameters
groupIdsIEnumerable<string>The group ids
productIdsIEnumerable<string>The product ids
AddRelatedGroups(Group, IEnumerable<string>)
Adds related group ids to speficified group
public virtual void AddRelatedGroups(Group group, IEnumerable<string> relatedGroupIds)
Parameters
groupGroupThe group
relatedGroupIdsIEnumerable<string>The related group ids
AddRelatedProductId(Group, string, string, string)
Adds the related product to group.
public virtual void AddRelatedProductId(Group group, string relatedGroupId, string productId, string variantId)
Parameters
groupGroupThe group.
relatedGroupIdstringThe relation group ID.
productIdstringThe product ID.
variantIdstringThe variant ID.
AddSubgroup(Group, Group)
Adds a subgroup to group.
public virtual void AddSubgroup(Group toGroup, Group subgroup)
Parameters
ClearCache()
Clears all the product group cache.
public virtual void ClearCache()
ClearCache(GroupKey)
Resets the specified key to the default value for objects stored in the object cache
public virtual void ClearCache(GroupKey key)
Parameters
keyGroupKeyKey to reset
ClearCache(IEnumerable<GroupKey>)
Resets the specified keys to the default value for objects stored in the object cache
public virtual void ClearCache(IEnumerable<GroupKey> keys)
Parameters
keysIEnumerable<GroupKey>Keys to reset
CreateProductGroupRelation(string, string, bool?)
Creates the new product group relation.
public virtual ProductGroupRelation CreateProductGroupRelation(string productId, string groupId, bool? isPrimary = null)
Parameters
productIdstringThe product Id.
groupIdstringThe group Id.
isPrimarybool?Is this group primary.
Returns
Delete(Group)
Deletes the group.
public virtual void Delete(Group group)
Parameters
groupGroupThe group.
Delete(GroupCollection)
Deletes appropriate relations between shops, other groups and products as well.
public virtual void Delete(GroupCollection groups)
Parameters
groupsGroupCollectionThe groups collection.
DeleteGroupsAndProductsByGroupKeys(IEnumerable<GroupKey>)
Deletes groups by given group keys and also deletes the products from removed groups if the products only belong to those groups
public virtual void DeleteGroupsAndProductsByGroupKeys(IEnumerable<GroupKey> groupKeysToDelete)
Parameters
groupKeysToDeleteIEnumerable<GroupKey>The group keys to be deleted
DeleteRelatedProductId(Group, string, string, string)
Deletes the related product from relation.
public virtual void DeleteRelatedProductId(Group group, string relatedGroupId, string productId, string variantId)
Parameters
groupGroupThe group.
relatedGroupIdstringThe relation group ID.
productIdstringThe product ID to delete.
variantIdstringThe product variant ID to delete.
DeleteRelation(string, string)
Deletes the specified product relation.
public virtual void DeleteRelation(string productId, string groupId)
Parameters
DeleteRelations(IEnumerable<Product>, string)
Deletes the specified product relations.
public virtual int DeleteRelations(IEnumerable<Product> products, string groupId)
Parameters
productsIEnumerable<Product>The products
groupIdstringThe group Id.
Returns
- int
The number of rows affected by the command.
FindPath(Shop, Group)
Find path from shop to group.
public virtual IEnumerable<Group> FindPath(Shop fromShop, Group toGroup)
Parameters
Returns
- IEnumerable<Group>
returns path to group include target group or empty if path not found
GetDataModelSystemName(string)
public virtual string GetDataModelSystemName(string groupName)
Parameters
groupNamestring
Returns
GetGroup(string, string)
Gets the group.
public virtual Group? GetGroup(string groupId, string languageId)
Parameters
Returns
- Group
The group.
GetGroup(string, string, bool)
Gets the group.
public virtual Group? GetGroup(string groupId, string languageId, bool showUnTranslated)
Parameters
groupIdstringThe group ID.
languageIdstringThe language ID.
showUnTranslatedboolDetermines whether untranslated group could be returned.
Returns
- Group
The group.
GetGroups(IEnumerable<string>)
Gets groups by provided group IDs in default language.
public virtual IEnumerable<Group> GetGroups(IEnumerable<string> groupIds)
Parameters
groupIdsIEnumerable<string>The list of group IDs.
Returns
- IEnumerable<Group>
Groups ordered by name
GetGroups(string)
Gets groups by language ID.
public virtual IEnumerable<Group> GetGroups(string languageId)
Parameters
languageIdstringThe language ID.
Returns
- IEnumerable<Group>
The GroupCollection.
GetGroupsByKeys(IEnumerable<GroupKey>)
public virtual IEnumerable<Group> GetGroupsByKeys(IEnumerable<GroupKey> groupKeys)
Parameters
groupKeysIEnumerable<GroupKey>
Returns
GetProductCountForBackendTree(string, string?)
Gets the number of the products in the group.
public virtual 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 virtual ProductGroupRelation? GetProductGroupRelation(string productId, string groupId)
Parameters
Returns
GetProductGroupRelations(string)
Gets the product group relations.
public virtual IEnumerable<ProductGroupRelation> GetProductGroupRelations(string productId)
Parameters
productIdstringThe product Id.
Returns
GetRelatedGroups(IEnumerable<ProductGroupRelation>, string)
public virtual IEnumerable<Group> GetRelatedGroups(IEnumerable<ProductGroupRelation> relations, string languageId)
Parameters
relationsIEnumerable<ProductGroupRelation>languageIdstring
Returns
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 virtual 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 virtual IEnumerable<Group> GetSubgroups(Group group)
Parameters
groupGroup
Returns
GetSubgroups(Group, bool)
Gets the list of child groups in current or default language.
public virtual IEnumerable<Group> GetSubgroups(Group group, bool showUnTranslated)
Parameters
Returns
HasSubgroups(Group)
Defines if a group includes child elements.
public virtual bool HasSubgroups(Group group)
Parameters
groupGroup
Returns
IsParentGroup(Group, string)
Determines whether source group is a parent of target group (might be not direct parent).
public virtual bool IsParentGroup(Group sourceGroup, string targetGroupId)
Parameters
Returns
MoveToGroup(IEnumerable<Product>, string, string)
Moves to group.
public virtual int MoveToGroup(IEnumerable<Product> products, string toGroupId, string fromGroupId)
Parameters
productsIEnumerable<Product>The products.
toGroupIdstringThe destination group id.
fromGroupIdstringThe source group id.
Returns
- int
The number of rows affected by the command.
RemoveRelatedGroups(Group, IEnumerable<string>)
Removes related group ids from speficified group
public virtual void RemoveRelatedGroups(Group group, IEnumerable<string> relatedGroupIds)
Parameters
groupGroupThe group
relatedGroupIdsIEnumerable<string>The related group ids
Save(Group)
Saves the group.
public virtual void Save(Group group)
Parameters
groupGroupThe group.
Save(ProductGroupRelation)
Saves the product group relation
public virtual void Save(ProductGroupRelation relation)
Parameters
relationProductGroupRelationThe product group relation.