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); } }
protected void TryPurchaseTokens(BalanceType balanceType) { SuccMessagePanel.Visible = false; ErrorMessagePanel.Visible = false; try { int numberOfTokens = Convert.ToInt32(NumberOfTokensTextBox.Text); Member user = Member.Current; ICOManager.TryPurchaseTokens(user, ICOStage.GetCurrentStage(), numberOfTokens, balanceType); SuccMessagePanel.Visible = true; SuccMessage.Text = String.Format(U6012.SUCCTOKENSPURCHASE, numberOfTokens, TokenCryptocurrency.Code); } catch (MsgException ex) { ErrorMessagePanel.Visible = true; ErrorMessage.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex); throw ex; } }
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; } }