コード例 #1
0
    public void InitControls()
    {
        currentStage = ICOStage.GetCurrentStage();
        var TokenCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.ERC20Token);

        if (currentStage == null)
        {
            StagePlaceHolder.Visible = false;
            NoStageLiteral.Text      = U6012.NOSTAGEINFO;

            var nextStage = ICOStage.GetNextStage();

            if (nextStage == null)
            {
                NextStageLiteral.Visible = false;
            }
            else
            {
                NextStageLiteral.Text = string.Format(U6012.NEXTSTAGEINFO, "<b>" + nextStage.StartDate + "</b>");
            }
        }
        else
        {
            decimal ProgressBarValue = ((decimal)currentStage.GetAvailableTokens() / (decimal)currentStage.TotalAvailableTokens) * 100;
            int     availableTokens  = currentStage.GetAvailableTokens();

            NoStagePlaceHolder.Visible = false;
            ProgressBarLiteral.Text    = string.Format("<div class='progress-bar' style='width: {0}%'>{1}: <b>{2}</b> {3} ({0}%)</div>", ProgressBarValue.ToString("#.#"),
                                                       U6012.TOKENSLEFT, availableTokens, TokenCryptocurrency.Code);
            NameTextBox.Text = string.Format(U6012.ISLIVE, currentStage.Name);
        }
    }
コード例 #2
0
ファイル: buy.aspx.cs プロジェクト: dovanduy/titan
    protected void SetupLanguagesAndTexts()
    {
        var currentStage = ICOStage.GetCurrentStage();
        var priceStage   = currentStage;

        BuyFromBTCWalletButton.Visible = BtcCryptocurrency.WalletEnabled;

        if (currentStage == null)
        {
            priceStage = ICOStage.GetNextStage();
            BuyFromPurchaseBalanceButton.Visible = BuyFromBTCWalletButton.Visible = false;
        }

        Money tokenPrice = Money.Zero;

        if (priceStage == null) //No next stage coming
        {
            tokenPrice = AppSettings.Ethereum.ERC20TokenRate;
        }
        else
        {
            tokenPrice = priceStage.TokenPrice;
        }

        BTCValueLabel.Visible = BtcCryptocurrency.WalletEnabled;
        BTCValueLiteral.Text  = String.Format("1 {0} = <b id='BTCPrice'>{1}</b> BTC", TokenCryptocurrency.Code,
                                              (tokenPrice.ToDecimal() / CryptocurrencyFactory.Get(CryptocurrencyType.BTC).GetValue().ToDecimal()).TruncateDecimals(8));

        USDValueLiteral.Text = String.Format("1 {0} = <b>{1}</b><span id='tokenPrice' style='display:none'>{2}</span>", TokenCryptocurrency.Code,
                                             tokenPrice.ToString(), tokenPrice.ToDecimal());

        MaxVolumeLiteral.Text = String.Format(U6012.MAXPER14MIN, "<b>" + AppSettings.ICO.ICOPurchaseLimitPerUserPer15mins + "</b>",
                                              TokenCryptocurrency.Code);

        LangAdder.Add(BuyFromPurchaseBalanceButton, U6012.PAYVIAPURCHASEBALANCE);
        LangAdder.Add(BuyFromBTCWalletButton, String.Format(U6012.PAYVIAWALLET, "BTC"));
        LangAdder.Add(RequiredFieldValidator4, L1.ER_ALLFIELDSREQUIRED);
        NumberOfTokensTextBox.Attributes["placeholder"] = String.Format("{0}", L1.AMOUNT);

        if (TitanFeatures.IsTrafficThunder)
        {
            BuyFromPurchaseBalanceButton.Visible = false;
        }
    }