示例#1
0
 public void SubtractFromMarketplaceBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     value = value.Positify();
     MarketplaceBalance -= value;
     BalanceLog.Add(this, BalanceType.MarketplaceBalance, value.Negatify().ToDecimal(), note, balanceLogType);
     MarketplaceBalanceLogManager.MoneySpent(this.Id, value);
 }
示例#2
0
        public void SubstractFromLoginAdsCredits(int value, string note, BalanceLogType balanceLogType = BalanceLogType.Other)
        {
            if (value < 0)
            {
                throw new MsgException("You cannot add negative value.");
            }

            LoginAdsCredits -= value;

            BalanceLog.Add(this, BalanceType.LoginAdsCredits, -value, note, balanceLogType);
        }
示例#3
0
        public void SubtractFromPointsBalance(Int32 value, String note, BalanceLogType balanceLogType = BalanceLogType.Other, bool setMinPoints = true)
        {
            if (value < 0)
            {
                value = -value;
            }

            if (value != 0)
            {
                PointsBalance -= value;
                BalanceLog.Add(this, BalanceType.PointsBalance, -value, note, balanceLogType);
                LevelManager.PointsChanged(this, setMinPoints);
            }
        }
示例#4
0
 public void AddToPointsBalance(Int32 value, String note, BalanceLogType balanceLogType = BalanceLogType.Other, bool triggerActions = true, bool checkLeadershipSystem = true)
 {
     if (value != 0)
     {
         PointsBalance += value;
         BalanceLog.Add(this, BalanceType.PointsBalance, value, note, balanceLogType);
         LevelManager.PointsChanged(this, true, triggerActions);
         if (checkLeadershipSystem)
         {
             var list = new List <RestrictionKind>();
             list.Add(RestrictionKind.Points);
             LeadershipSystem.CheckSystem(list, this);
         }
     }
 }
示例#5
0
        public void Downgrade(IMembership membership, bool setMinPoints = true, bool resolveReferrals = true)
        {
            setMembership(membership, AppSettings.ServerTime, null);

            if (resolveReferrals)
            {
                ResolveReferralLimits(membership);
            }

            if (AppSettings.Points.LevelMembershipPolicyEnabled && setMinPoints)
            {
                if (PointsBalance > membership.MinPointsToHaveThisLevel)
                {
                    int substracted = PointsBalance - membership.MinPointsToHaveThisLevel;
                    PointsBalance = membership.MinPointsToHaveThisLevel;
                    SaveBalances();

                    BalanceLog.Add(this, BalanceType.PointsBalance, -substracted, "Level downgrade", BalanceLogType.Other);
                }
            }
        }
示例#6
0
 private void SubtractFromCryptocurrencyBalance(CryptocurrencyType cryptocurrencyType, CryptocurrencyMoney value, string note, BalanceLogType logType = BalanceLogType.Other)
 {
     UserCryptocurrencyBalance.Remove(this.Id, value, cryptocurrencyType);
     //Works on ONE crypto balance at the moment
     BalanceLog.Add(this, CryptocurrencyTypeHelper.ConvertToBalanceType(cryptocurrencyType), value.ToDecimal() * -1, note, logType);
 }
示例#7
0
 public void SubtractFromCommissionBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     value              = value.Positify();
     CommissionBalance -= value;
     BalanceLog.Add(this, BalanceType.CommissionBalance, value.Negatify().ToDecimal(), note, balanceLogType);
 }
示例#8
0
 public void AddToMarketplaceBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     MarketplaceBalance += value;
     BalanceLog.Add(this, BalanceType.MarketplaceBalance, value.ToDecimal(), note, balanceLogType);
     MarketplaceBalanceLog.Add(this.Id, value);
 }
示例#9
0
 public void AddToInvestmentBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     InvestmentBalance += value;
     BalanceLog.Add(this, BalanceType.InvestmentBalance, value.ToDecimal(), note, balanceLogType);
 }
示例#10
0
 public void AddToCommissionBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     CommissionBalance += value;
     BalanceLog.Add(this, BalanceType.CommissionBalance, value.ToDecimal(), note, balanceLogType);
 }
示例#11
0
 public void AddToPurchaseBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other)
 {
     PurchaseBalance += value;
     BalanceLog.Add(this, BalanceType.PurchaseBalance, value.ToDecimal(), note, balanceLogType);
 }