Пример #1
0
    public void btnBet_Click(object sender, EventArgs e)
    {
        ErrorMessagePanel.Visible = false;
        ErrorMessage.Text         = "";

        try
        {
            AppSettings.Reload();
            var TheButton = (Button)sender;

            Money   maxProfit = Money.MultiplyPercent(siteInvestment, AppSettings.DiceGame.MaxBitCoinProfitPercent);
            Money   minBet    = AppSettings.DiceGame.MinBitCoinBet;
            decimal maxChance = AppSettings.DiceGame.MaxChance;

            decimal formChance    = Convert.ToDecimal(chanceTextBox.Text);
            Money   formBetAmount = Money.Parse(betAmountTextBox.Text);
            int     houseEdge     = AppSettings.DiceGame.HouseEdgePercent;
            Money   formProfit    = Money.Parse(profitTextBox.Text);
            bool    low           = Convert.ToBoolean(TheButton.CommandArgument);

            DiceGameManager.TryToBet(maxProfit, minBet, formChance, formBetAmount, houseEdge, formProfit, low);

            MyBetsGridView.DataBind();
            siteInvestment          = SiteInvestmentManager.GetCurrentBankroll();
            sitesBankrollLabel.Text = siteInvestment.ToClearString();
            maxProfitLabel.Text     = Money.MultiplyPercent(siteInvestment, AppSettings.DiceGame.MaxBitCoinProfitPercent).ToClearString();
            adBalanceLabel.Text     = Member.Current.PurchaseBalance.ToClearString();
        }
        catch (MsgException ex)
        {
            ErrorMessagePanel.Visible = true;
            ErrorMessage.Text         = ex.Message;
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            throw ex;
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyDiceGameEnabled);
        user = Member.Current;

        if (!IsPostBack)
        {
            GetStatsData();
            btnBetLow.Text    = U4200.LO;
            btnBetHigh.Text   = U4200.HI;
            btnInvest.Text    = U4200.INVEST;
            btnInvestAll.Text = U4200.INVESTALL;
            btnDivest.Text    = U4200.DIVEST;
            btnDivestAll.Text = U4200.DIVESTALL;

            LangAdder.Add(MyBetsButton, U4200.MYBETS);
            LangAdder.Add(AllBetsButton, U4200.ALLBETS);
            LangAdder.Add(RandomizeButton, U4200.RANDOMIZE);
            LangAdder.Add(InvestButton, U4200.INVEST);
            LangAdder.Add(StatsButton, L1.STATISTICS);
            MyBetsGridView.EmptyDataText      = L1.NODATA;
            AllBetsGridView.EmptyDataText     = L1.NODATA;
            InvestmentsGridView.EmptyDataText = L1.NODATA;
            investTextBox.Attributes.Add("title", U4200.MAXDIGITSINFO);
            divestTextBox.Attributes.Add("title", U4200.MAXDIGITSINFO);
            kellyInvestTextBox.Attributes.Add("title", U4200.KELLYINFO + "<br />" + U4200.MAXKELLYINFO + ": " + AppSettings.DiceGame.MaxKellyLevelInt);
            kellyDivestTextBox.Attributes.Add("title", U4200.DIVESTKELLYINFO);
        }
        siteInvestment          = SiteInvestmentManager.GetCurrentBankroll();
        sitesBankrollLabel.Text = siteInvestment.ToClearString();
        maxProfitLabel.Text     = Money.MultiplyPercent(siteInvestment, AppSettings.DiceGame.MaxBitCoinProfitPercent).ToClearString();
        maxChanceLabel.Text     = AppSettings.DiceGame.MaxChance.ToString() + "%";
        adBalanceLabel.Text     = Member.Current.PurchaseBalance.ToClearString();

        ScriptManager.RegisterStartupScript(GamePanel, GetType(), "isBettingEnabled", "isBettingEnabled();", true);
        ScriptManager.RegisterStartupScript(MultiViewUpdatePanel, GetType(), "isBettingEnabled", "isBettingEnabled();", true);
        ScriptManager.RegisterStartupScript(MultiViewUpdatePanel, GetType(), "setConfirmations", "setConfirmations();", true);
    }
Пример #3
0
    public void btnInvest_Click(object sender, EventArgs e)
    {
        ErrorMessagePanel.Visible = false;
        try
        {
            var   TheButton      = (Button)sender;
            int   buttonArgument = Int32.Parse(TheButton.CommandArgument);
            Money adBalance      = Member.Current.PurchaseBalance;
            int   kelly;

            if (buttonArgument == 0)
            {
                Money amountToInvest = Money.Parse(investTextBox.Text);
                if (string.IsNullOrWhiteSpace(kellyInvestTextBox.Text))
                {
                    throw new MsgException(U4200.KELLYERROR + ": " + AppSettings.DiceGame.MaxKellyLevelInt);
                }
                kelly = Convert.ToInt32(kellyInvestTextBox.Text);
                SiteInvestmentManager.TryInvest(amountToInvest, kelly, user);
            }
            else if (buttonArgument == 1)
            {
                Money amountToInvest = adBalance;
                if (string.IsNullOrWhiteSpace(kellyInvestTextBox.Text))
                {
                    throw new MsgException(U4200.KELLYERROR + ": " + AppSettings.DiceGame.MaxKellyLevelInt);
                }
                kelly = Convert.ToInt32(kellyInvestTextBox.Text);
                SiteInvestmentManager.TryInvest(amountToInvest, kelly, user);
            }
            else if (buttonArgument == 2)

            {
                if (string.IsNullOrWhiteSpace(kellyDivestTextBox.Text))
                {
                    throw new MsgException(U4200.KELLYERROR + ": " + AppSettings.DiceGame.MaxKellyLevelInt);
                }
                Money amountToDivest = Money.Parse(divestTextBox.Text);
                kelly = Convert.ToInt32(kellyDivestTextBox.Text);

                SiteInvestmentManager.TryDivest(amountToDivest, kelly, user);
            }
            else if (buttonArgument == 3)
            {
                SiteInvestmentManager.TryDivestAll(user);
            }

            InvestmentsGridView.DataBind();
            siteInvestment          = SiteInvestmentManager.GetCurrentBankroll();
            sitesBankrollLabel.Text = siteInvestment.ToClearString();
            maxProfitLabel.Text     = Money.MultiplyPercent(siteInvestment, AppSettings.DiceGame.MaxBitCoinProfitPercent).ToClearString();
            adBalanceLabel.Text     = Member.Current.PurchaseBalance.ToClearString();
        }
        catch (MsgException ex)
        {
            ErrorMessagePanel.Visible = true;
            ErrorMessage.Text         = ex.Message;
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            throw ex;
        }
    }