Esempio n. 1
0
        /// <summary>
        /// Initializes the specified reward point.
        /// </summary>
        /// <param name="rewardPoint">The reward point.</param>
        public virtual void Initialize(LoyaltyRewardPoint rewardPoint)
        {
            Assert.ArgumentNotNull(rewardPoint, "rewardPoint");

            this.ActivePoints    = rewardPoint.ActivePoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.CurrencyCode    = rewardPoint.CurrencyCode;
            this.Description     = rewardPoint.Description;
            this.ExpiredPoints   = rewardPoint.ExpiredPoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.IssuedPoints    = rewardPoint.IssuedPoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.RewardPointType = rewardPoint.RewardPointType.Name;
            this.UsedPoints      = rewardPoint.UsedPoints.ToString(Sitecore.Context.Language.CultureInfo);

            var transactions = rewardPoint.GetPropertyValue("Transactions") as List <LoyaltyCardTransaction>;

            if (transactions == null || transactions.Count <= 0)
            {
                return;
            }

            foreach (var transaction in transactions)
            {
                var result = new LoyaltyTransactionItemBaseJsonResult();
                result.Initialize(transaction);
                this.Transactions.Add(result);
            }
        }
        /// <summary>
        /// Initializes the specified reward point.
        /// </summary>
        /// <param name="rewardPoint">The reward point.</param>
        public virtual void Initialize(LoyaltyRewardPoint rewardPoint)
        {
            Assert.ArgumentNotNull(rewardPoint, "rewardPoint");

            this.ActivePoints = rewardPoint.ActivePoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.CurrencyCode = rewardPoint.CurrencyCode;
            this.Description = rewardPoint.Description;
            this.ExpiredPoints = rewardPoint.ExpiredPoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.IssuedPoints = rewardPoint.IssuedPoints.ToString(Sitecore.Context.Language.CultureInfo);
            this.RewardPointType = rewardPoint.RewardPointType.Name;
            this.UsedPoints = rewardPoint.UsedPoints.ToString(Sitecore.Context.Language.CultureInfo);

            var transactions = rewardPoint.GetPropertyValue("Transactions") as List<LoyaltyCardTransaction>;
            if (transactions == null || transactions.Count <= 0)
            {
                return;
            }

            foreach (var transaction in transactions)
            {
                var result = new LoyaltyTransactionItemBaseJsonResult();
                result.Initialize(transaction);
                this.Transactions.Add(result);
            }
        }