Esempio n. 1
0
        private void BtnBet_Click(object sender, RoutedEventArgs e)
        {
            if (txtelement.Text == String.Empty ^
                txtSumBet.Text == string.Empty)
            {
                MessageBox.Show("Заполните все поля");
            }
            else
            {
                NumberFormatInfo nfi = new NumberFormatInfo()
                {
                    NumberDecimalSeparator = "."
                };
                Bet bet = new Bet();
                bet.DateBet   = DateTime.Now;
                bet.SumBet    = Convert.ToDecimal(txtSumBet.Text);
                bet.CoefBet   = Convert.ToDecimal(txtelement.Text);
                bet.SumWinBet = Convert.ToDecimal(txtSumWinBet.Text);
                bet.UserId    = Main.userId;
                bet.EventId   = Convert.ToInt32(txtEventId.Text);
                bet.Team      = txtTeam.Text;


                Service1 service = new Service1();

                if (service.AcceptBet(bet) == 1)
                {
                    Close();
                    decimal UserBalance = Convert.ToDecimal(txtBalance.Text);
                    decimal SumBet      = Convert.ToDecimal(txtSumBet.Text);
                    var     confirm     = new ConfirmBet(UserBalance, SumBet);
                    confirm.ShowDialog();
                }
            }
        }