Esempio n. 1
0
        public void ResolveReferralLimits(IMembership membership)
        {
            //Direct
            if (GetDirectReferralsCount() > membership.DirectReferralsLimit + (long)DirectReferralLimitEnlargedBy)
            {
                var  list    = GetDirectReferralsList();
                long howmany = list.Count - (long)membership.DirectReferralsLimit - DirectReferralLimitEnlargedBy;

                for (int i = 0; i < howmany; ++i)
                {
                    list[i].RemoveReferer();
                    list[i].Save();
                }
            }

            //Rented
            if (AppSettings.TitanFeatures.ReferralsRentedEnabled)
            {
                var rrm = new Prem.PTC.Referrals.RentReferralsSystem(Name, membership);
                if (AppSettings.TitanFeatures.ReferralsRentedEnabled && (rrm.GetUserRentedReferralsCount() > membership.RentedReferralsLimit))
                {
                    int howmany = rrm.GetUserRentedReferralsCount() - membership.RentedReferralsLimit;
                    rrm.DeleteRentedReferrals(howmany);
                }
            }
        }
Esempio n. 2
0
        public void Reactivate()
        {
            _mainBalance        = new Money(0);
            _trafficBalance     = new Money(0);
            _advertisingBalance = new Money(0);
            _pointsBalance      = 0;

            //DR
            foreach (var elem in GetDirectReferralsList())
            {
                elem.RemoveReferer();
                elem.Save();
            }

            //RR
            try
            {
                var rrm = new Prem.PTC.Referrals.RentReferralsSystem(this.Name, this.Membership);
                rrm.DeleteRentedReferrals(rrm.GetUserRentedReferralsCount());
            }
            catch (Exception ex) { }

            //Status
            MakeActive();

            SetUpToDateAsFalse();
        }