Exemplo n.º 1
0
 public String GetClearStringBalance(BalanceType type)
 {
     if (BalanceTypeHelper.IsCryptoBalance(type))
     {
         return(UserCryptocurrencyBalance.Get(Member.CurrentId, CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(type)).ToClearString());
     }
     return(GetBasicBalance(type).ToClearString());
 }
Exemplo n.º 2
0
 public decimal GetDecimalBalance(BalanceType type)
 {
     if (BalanceTypeHelper.IsCryptoBalance(type))
     {
         return(UserCryptocurrencyBalance.Get(Member.CurrentId, CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(type)).ToDecimal());
     }
     else
     {
         return(GetBasicBalance(type).ToDecimal());
     }
 }
Exemplo n.º 3
0
        public static String RecognizeCurrencyAndReturnString(bool asStock, decimal value)
        {
            BalanceType targetType = asStock ? AppSettings.InternalExchange.InternalExchangeStockType : AppSettings.InternalExchange.InternalExchangePurchaseVia;

            if (BalanceTypeHelper.IsCryptoBalance(targetType))
            {
                return(new CryptocurrencyMoney(CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(targetType), value).ToString());
            }

            return(new Money(value).ToString());
        }
Exemplo n.º 4
0
        public static String GetBalanceCode(bool isStock)
        {
            BalanceType targetBalance = isStock == true ? AppSettings.InternalExchange.InternalExchangeStockType : AppSettings.InternalExchange.InternalExchangePurchaseVia;

            if (BalanceTypeHelper.IsCryptoBalance(targetBalance))
            {
                return(CryptocurrencyFactory.Get(CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(targetBalance)).Code);
            }

            return(AppSettings.Site.CurrencyCode);
        }
Exemplo n.º 5
0
        public static String GetBalanceSign(bool isStock)
        {
            BalanceType targetBalance = isStock == true ? AppSettings.InternalExchange.InternalExchangeStockType : AppSettings.InternalExchange.InternalExchangePurchaseVia;

            if (BalanceTypeHelper.IsCryptoBalance(targetBalance))
            {
                Cryptocurrency crypto = CryptocurrencyFactory.Get(CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(targetBalance));
                if (String.IsNullOrEmpty(crypto.CurrencyDisplaySignBefore))
                {
                    return(crypto.CurrencyDisplaySignAfter.Trim());
                }
                return(crypto.CurrencyDisplaySignBefore.Trim());
            }
            return(AppSettings.Site.CurrencySign.Trim());
        }
Exemplo n.º 6
0
        public String GetStringBalance(BalanceType type)
        {
            if (BalanceTypeHelper.IsCryptoBalance(type))
            {
                return(UserCryptocurrencyBalance.Get(Member.CurrentId, CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(type)).ToString().Trim());
            }
            else
            {
                if (type == BalanceType.PTCCredits || type == BalanceType.PointsBalance)
                {
                    return(GetBasicBalance(type).ToClearString().Trim());
                }

                return(GetBasicBalance(type).ToString().Trim());
            }
        }
Exemplo n.º 7
0
    public static String GetDisplayValue(BalanceType balanceType, decimal input)
    {
        Money ValueInMoney = new Money(input);

        if (balanceType == BalanceType.PointsBalance)
        {
            return(ValueInMoney.AsPoints().ToString());
        }

        else if (balanceType == BalanceType.PTCCredits)
        {
            return(ValueInMoney.ToClearString());
        }

        else if (BalanceTypeHelper.IsCryptoBalance(balanceType))
        {
            return((new CryptocurrencyMoney(CryptocurrencyTypeHelper.ConvertToCryptocurrencyType(balanceType), input)).ToString());
        }


        return(ValueInMoney.ToString());
    }