Table of Contents

Class LoyaltyService

Namespace
Dynamicweb.Ecommerce.Loyalty
Assembly
Dynamicweb.Ecommerce.dll
public class LoyaltyService : ICacheStorage<int, Reward>, ICacheStorage<int>, ICacheStorage
Inheritance
LoyaltyService
Implements
Inherited Members

Properties

AllowEarnPointsFromPurchasedPoints

Gets the value indicating wheither the buying items with points should earn more points.
public bool AllowEarnPointsFromPurchasedPoints { get; }

Property Value

bool

Methods

ClearCache()

Resets all keys to the default value for objects stored in the object cache
public void ClearCache()

ClearCache(RewardKey)

[Obsolete("Use ClearCache(int) instead.")]
public void ClearCache(RewardKey key)

Parameters

key RewardKey

ClearCache(IEnumerable<RewardKey>)

[Obsolete("Use ClearCache(IEnumerable<int>) instead.")]
public void ClearCache(IEnumerable<RewardKey> keys)

Parameters

keys IEnumerable<RewardKey>

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

ClearRewardCache()

Remove all rewards from cache.
[Obsolete("Use ClearCache instead")]
public void ClearRewardCache()

ClearRewardRuleCache()

Remove all reward rules from cache.
public void ClearRewardRuleCache()

ClearUserTransactionCache()

Remove user transactions from cache.
[Obsolete("Use ClearUserTransactionCache(userId) instead.")]
public void ClearUserTransactionCache()

ClearUserTransactionCache(int)

Remove user transactions from cache.
public void ClearUserTransactionCache(int userId)

Parameters

userId int

CreateTransaction(UserTransaction)

Creates the user transaction
public void CreateTransaction(UserTransaction transaction)

Parameters

transaction UserTransaction
The UserTransaction.

CreateTransaction(UserTransaction, OrderLine)

Creates the user transaction
public void CreateTransaction(UserTransaction transaction, OrderLine orderLine)

Parameters

transaction UserTransaction
The UserTransaction.
orderLine OrderLine
The OrderLine.

CreateTransaction(UserTransaction, User)

Creates the user transaction
public void CreateTransaction(UserTransaction transaction, User user)

Parameters

transaction UserTransaction
The UserTransaction.
user User
The User.

DeleteReward(Reward)

Deletes the reward.
public void DeleteReward(Reward reward)

Parameters

reward Reward

DeleteRewardRule(RewardRule)

Deletes the instance.
public void DeleteRewardRule(RewardRule rewardRule)

Parameters

rewardRule RewardRule

FindPoints(OrderLine)

Finds the points.
public IPointInfo FindPoints(OrderLine orderLine)

Parameters

orderLine OrderLine
The order line.

Returns

IPointInfo
The IPointInfo.

FindPoints(Product)

Finds the points.
[Obsolete("Use overload with order instead")]
public ConditionPointInfo FindPoints(Product product)

Parameters

product Product
The product.

Returns

ConditionPointInfo
The IPointInfo.

FindPoints(Product, Order, DateTime)

Finds the points.
public ConditionPointInfo FindPoints(Product product, Order order, DateTime orderTime)

Parameters

product Product
The product.
order Order
The order.
orderTime DateTime
The order time.

Returns

ConditionPointInfo
The IPointInfo.

FindPoints(Product, Order, DateTime, string)

Finds the points.
public ConditionPointInfo FindPoints(Product product, Order order, DateTime orderTime, string unitId)

Parameters

product Product
The product.
order Order
The order.
orderTime DateTime
The order time.
unitId string
The unit ID.

Returns

ConditionPointInfo
The IPointInfo.

FindPoints(Product, Order, string, DateTime)

Finds the points.
[Obsolete("Use overload without country code")]
public ConditionPointInfo FindPoints(Product product, Order order, string countryCode2, DateTime orderTime)

Parameters

product Product
The product.
order Order
The order.
countryCode2 string
The country code2.
orderTime DateTime
The order time.

Returns

ConditionPointInfo
The IPointInfo.

FindPoints(Product, Order, string, DateTime, string)

Finds the points.
[Obsolete("Use overload without country code")]
public ConditionPointInfo FindPoints(Product product, Order order, string countryCode2, DateTime orderTime, string unitId)

Parameters

product Product
The product.
order Order
The order.
countryCode2 string
The country code2.
orderTime DateTime
The order time.
unitId string
The unit ID.

Returns

ConditionPointInfo
The IPointInfo.

GetPointsBalance(User)

Gets the transaction balance for user.
public double GetPointsBalance(User user)

Parameters

user User
The user

Returns

double

GetPointsBalance(int)

Gets the transaction balance by user id.
public double GetPointsBalance(int userId)

Parameters

userId int
The user id.

Returns

double

GetRewardById(int)

Gets reward by ID.
public Reward GetRewardById(int rewardId)

Parameters

rewardId int
The reward id.

Returns

Reward
The reward.

GetRewardById(int, string)

Gets the reward by reward id and language Id.
[Obsolete("Use GetRewardById(int) instead.")]
public Reward GetRewardById(int rewardId, string languageId)

Parameters

rewardId int
The reward id.
languageId string
The language id.

Returns

Reward
The reward.

GetRewardRule(int, int)

Gets the reward rule.
public RewardRule GetRewardRule(int rewardId, int id)

Parameters

rewardId int
The reward id.
id int
The reward id.

Returns

RewardRule
The RewardRule.

GetRewardRuleById(int)

Gets the reward rule by id.
[Obsolete("Use GetRewardRule instead")]
public RewardRule GetRewardRuleById(int id)

Parameters

id int
The reward id.

Returns

RewardRule
The RewardRule.

GetRewards()

Return all rewards.
public IEnumerable<Reward> GetRewards()

Returns

IEnumerable<Reward>

GetRewards(bool)

Return all rewards.
[Obsolete("Use GetRewards() instead. Call ClearCache() first, if needed.")]
public IEnumerable<Reward> GetRewards(bool force)

Parameters

force bool
Force cahce update.

Returns

IEnumerable<Reward>

GetRewards(bool, string)

Return all rewards.
[Obsolete("Use GetRewards() instead. Call ClearCache() first, if needed. Use Reward.Translations to access the translations for each reward.")]
public IEnumerable<Reward> GetRewards(bool force, string languageId)

Parameters

force bool
Force cahce update.
languageId string
The language id.

Returns

IEnumerable<Reward>
The RewardCollection.

GetRewards(bool, string, bool?, RewardCollectionSortDirection, RewardCollectionSortBy)

Return all rewards.
[Obsolete("Use GetRewards() instead. Call ClearCache() first, if needed. Use Reward.Translations to access the translations for each reward. Filter and sort the collection, if needed.")]
public IEnumerable<Reward> GetRewards(bool force, string languageId, bool? archiveMode, RewardCollectionSortDirection sortDirection, RewardCollectionSortBy sortBy)

Parameters

force bool
Force cahce update.
languageId string
The language id.
archiveMode bool?
The archive mode. Nothing - all, true - archived only, false - unarchived only.
sortDirection RewardCollectionSortDirection
sortBy RewardCollectionSortBy

Returns

IEnumerable<Reward>
The RewardCollection.

GetRewardsGiven(IEnumerable<Reward>)

Gets the points given for the specified list of rewards.
public IEnumerable<RewardPointsGiven> GetRewardsGiven(IEnumerable<Reward> rewards)

Parameters

rewards IEnumerable<Reward>
The rewards.

Returns

IEnumerable<RewardPointsGiven>
IEnumerable(Of RewardPointsGiven).

GetRewardUsageCount(Reward)

Gets the count of the reward usage.
public int GetRewardUsageCount(Reward reward)

Parameters

reward Reward

Returns

int
Number of the reward usage.

GetRulesForReward(int)

Gets rules for the reward id.
public IEnumerable<RewardRule> GetRulesForReward(int rewardId)

Parameters

rewardId int
The reward id.

Returns

IEnumerable<RewardRule>

GetTotalPoints(Reward, double, double, double)

Gets the total points.
public double GetTotalPoints(Reward reward, double productsPrice, double productsCount, double divisor)

Parameters

reward Reward
productsPrice double
The products price.
productsCount double
The products count.
divisor double
The divisor.

Returns

double
The total points.

GetUserTransactions()

Gets the collection of all user transactions.
[Obsolete("Use GetUserTransactions(userId) instead")]
public IEnumerable<UserTransaction> GetUserTransactions()

Returns

IEnumerable<UserTransaction>

GetUserTransactions(int)

Gets the collection of the user transactions by user id.
public IEnumerable<UserTransaction> GetUserTransactions(int userId)

Parameters

userId int
The user id.

Returns

IEnumerable<UserTransaction>

LoadRewardsFromUserTransaction(IEnumerable<UserTransaction>)

Loads the rewards from the user transaction collection.
public void LoadRewardsFromUserTransaction(IEnumerable<UserTransaction> userTransactions)

Parameters

userTransactions IEnumerable<UserTransaction>
The collection of user transactions.

LoadRulesForRewards(IEnumerable<Reward>)

Loads rules for specified rewards.
[Obsolete("Don't use this.")]
public void LoadRulesForRewards(IEnumerable<Reward> rewards)

Parameters

rewards IEnumerable<Reward>
The RewardCollection.

RedeemExpiredPoints()

public void RedeemExpiredPoints()

RedeemPoints(Order)

Redeem points from Order.
public void RedeemPoints(Order order)

Parameters

order Order
The Order.

RedeemPoints(double, string, int)

Redeem points.
public void RedeemPoints(double points, string comment, int userId)

Parameters

points double
The number of points.
comment string
The comment for transaction.
userId int
The user id.

RedeemPoints(double, string, int, DateTime)

Redeem points.
public void RedeemPoints(double points, string comment, int userId, DateTime transactionDate)

Parameters

points double
The number of points.
comment string
The comment for transaction.
userId int
The user id.
transactionDate DateTime
The transaction date.

RedeemPoints(double, string, int, DateTime, TransactionObjectType, string)

public void RedeemPoints(double points, string comment, int userId, DateTime transactionDate, TransactionObjectType transactionType, string transactionElement)

Parameters

points double
comment string
userId int
transactionDate DateTime
transactionType TransactionObjectType
transactionElement string

RewardPoints(Order)

Reward points from order lines on an order.
public void RewardPoints(Order order)

Parameters

order Order
The order.

RewardPoints(double, string, int)

Reward points.
public void RewardPoints(double points, string comment, int userId)

Parameters

points double
The number of points.
comment string
The comment for transaction.
userId int
The user id.

SaveReward(Reward)

Saves current reward to the database.
public void SaveReward(Reward reward)

Parameters

reward Reward

SaveRewardRule(RewardRule)

Saves the instance to the data base.
public void SaveRewardRule(RewardRule rewardRule)

Parameters

rewardRule RewardRule

SetNewRewardCurrency(Reward, Currency)

Sets new currency code and recalculates points count.
[Obsolete("Don't use this.")]
public void SetNewRewardCurrency(Reward reward, Currency currency)

Parameters

reward Reward
currency Currency
New currency.

TryUpdateRewards(Order)

Tries to update rewards.
public void TryUpdateRewards(Order order)

Parameters

order Order
The order.

UsePoints(Order)

Redeem points from Order and exchange points in case of Loyalty discount is used.
public void UsePoints(Order order)

Parameters

order Order
The Order.
To top