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); }
public static void Add(Member User, BalanceType account, decimal difference, string Note, BalanceLogType balanceLogType) { if (difference != 0) { BalanceLog Entry = new BalanceLog(); Entry.DateOccured = AppSettings.ServerTime; Entry.UserId = User.Id; Entry.Type = account; Entry.Amount = difference; Entry.Note = Note; switch (account) { case BalanceType.MainBalance: Entry.AccountState = User.MainBalance; break; case BalanceType.PurchaseBalance: Entry.AccountState = User.PurchaseBalance; break; case BalanceType.TrafficBalance: Entry.AccountState = User.TrafficBalance; break; case BalanceType.CashBalance: Entry.AccountState = User.CashBalance; break; case BalanceType.CommissionBalance: Entry.AccountState = User.CommissionBalance; break; case BalanceType.InvestmentBalance: Entry.AccountState = User.InvestmentBalance; break; case BalanceType.BTC: Entry.AccountState = User.GetCryptocurrencyBalance(CryptocurrencyType.BTC); break; case BalanceType.XRP: Entry.AccountState = User.GetCryptocurrencyBalance(CryptocurrencyType.XRP); break; case BalanceType.ETH: Entry.AccountState = User.GetCryptocurrencyBalance(CryptocurrencyType.ETH); break; case BalanceType.Token: Entry.AccountState = User.GetCryptocurrencyBalance(CryptocurrencyType.ERC20Token); break; case BalanceType.FreezedToken: Entry.AccountState = User.GetCryptocurrencyBalance(CryptocurrencyType.ERCFreezed); break; } Entry.BalanceLogType = balanceLogType; Entry.Save(); } }
public void SubstractFromPTCCredits(decimal value, string note) { if (value < 0) { throw new MsgException("You cannot add negative value."); } PTCCredits -= value; BalanceLog.AddPtcCreditLog(this, -value, note); }
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); }
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); } }
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); } } }
public static void AddPtcCreditLog(Member user, Decimal difference, string note) { if (difference != 0) //Not logging 0 { BalanceLog Entry = new BalanceLog(); Entry.DateOccured = AppSettings.ServerTime; Entry.UserId = user.Id; Entry.Type = BalanceType.PTCCredits; Entry.Amount = difference; Entry.AccountState = new Money(user.PTCCredits); Entry.Note = note; Entry.BalanceLogType = BalanceLogType.Other; Entry.Save(); } }
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); } } }
public static void Add(Member User, BalanceType account, Int32 difference, string Note, BalanceLogType balanceLogType) { if (difference != 0) //Not logging 0 { BalanceLog Entry = new BalanceLog(); Entry.DateOccured = AppSettings.ServerTime; Entry.UserId = User.Id; Entry.Type = account; Entry.Amount = difference; switch (account) { case BalanceType.PointsBalance: Entry.AccountState = new Money(User.PointsBalance); break; case BalanceType.LoginAdsCredits: Entry.AccountState = new Money(User.LoginAdsCredits); break; } Entry.Note = Note; Entry.BalanceLogType = balanceLogType; Entry.Save(); } }
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); }
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); }
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); }
public void AddToInvestmentBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other) { InvestmentBalance += value; BalanceLog.Add(this, BalanceType.InvestmentBalance, value.ToDecimal(), note, balanceLogType); }
public void AddToCommissionBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other) { CommissionBalance += value; BalanceLog.Add(this, BalanceType.CommissionBalance, value.ToDecimal(), note, balanceLogType); }
public void AddToPurchaseBalance(Money value, String note, BalanceLogType balanceLogType = BalanceLogType.Other) { PurchaseBalance += value; BalanceLog.Add(this, BalanceType.PurchaseBalance, value.ToDecimal(), note, balanceLogType); }