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);
        }
    }
Ejemplo n.º 2
0
    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;
        }
    }
Ejemplo n.º 3
0
    protected UserControl GetStageHTML(ICOStage stage)
    {
        UserControl objControl    = (UserControl)Page.LoadControl("~/Controls/ICO/ICOStage.ascx");
        var         parsedControl = objControl as ICustomObjectControl;

        parsedControl.ObjectID = stage.Id;
        parsedControl.DataBind();

        return(objControl);
    }
Ejemplo n.º 4
0
    protected void PurchasesGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var stageId = Convert.ToInt32(e.Row.Cells[1].Text);
            var stage   = new ICOStage(stageId);
            e.Row.Cells[1].Text = stage.Name;

            var tokens = Convert.ToInt32(e.Row.Cells[3].Text);
            e.Row.Cells[3].Text = string.Format("{0} {1}", tokens, TokenCryptocurrency.Code);
        }
    }
Ejemplo n.º 5
0
    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;
        }
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.ICOStagesEnabled);

        if (!IsPostBack)
        {
            List <ICOStage> AllStagesList = new List <ICOStage>();

            AllStagesList = ICOStage.GetAllNoDeleted();

            if (AllStagesList.Count == 0)
            {
                NoStageLiteral.Text        = L1.NODATA;
                NoStagePlaceHolder.Visible = true;
            }
            else
            {
                for (int i = 0; i < AllStagesList.Count; i++)
                {
                    AllStagesLiteral.Controls.Add(GetStageHTML(AllStagesList[i]));
                }
            }
        }
    }
Ejemplo n.º 7
0
    public void InitControls()
    {
        currentStage = new ICOStage(ObjectID);

        int     TotalPurchasedTokens = currentStage.GetAvailableTokens();
        int     AvailableTokens      = currentStage.TotalAvailableTokens - TotalPurchasedTokens;
        Decimal PercentOfTokens      = ((Decimal)TotalPurchasedTokens / (Decimal)currentStage.TotalAvailableTokens) * 100;

        ICOStageName.Text         = currentStage.Name;
        ICOStagePriceLiteral.Text = currentStage.TokenPrice.ToString();
        ICOStageAvailableTokensPercentLiteral.Text = string.Format("<input type='text' class='knob' value='{0}' data-width='125' data-height='125' data-thickness='0.25' data-fgColor='#65a858'>", Math.Round(PercentOfTokens, 0).ToString());
        ICOStageAvailableTokensLiteral.Text        = (currentStage.TotalAvailableTokens - AvailableTokens).ToString();

        TokenImage.ImageUrl = AppSettings.Ethereum.ERC20TokenImageUrl;

        StageStart = currentStage.StartDate;
        StageEnd   = currentStage.EndDate;

        if (StageEnd < AppSettings.ServerTime)
        {
            ICOStageEventLiteral.Text = L1.FINISHED;
            ICOStageItem.Attributes.Add("class", "ICOStage finished");
        }
        else if (StageStart > AppSettings.ServerTime)
        {
            ICOStageTimestamp.Attributes.Add("data-timestamp", StageStart.ToString());
            ICOStageEventLiteral.Text = String.Format("{0} <span class='countdown-placeholder'></span>", U6012.STARTSIN);
            ICOStageItem.Attributes.Add("class", "ICOStage finished ICOtimer");
        }
        else
        {
            ICOStageTimestamp.Attributes.Add("data-timestamp", StageEnd.ToString());
            ICOStageEventLiteral.Text = String.Format("{0} <span class='countdown-placeholder'></span>", U6012.ENDSIN);
            ICOStageItem.Attributes.Add("class", "ICOStage ICOtimer");
        }
    }