Exemplo n.º 1
0
        //gets the betting data from the forms filled out by the user and error controls the inputs
        private void getBetData()
        {
            bettingData currentData = new bettingData();

            if (!anyTextBoxesEmpty())
            {
                currentData.setSportName(sportTxt.Text);
                currentData.setHomeTeam(homeTeamTxt.Text);
                currentData.setAwayTeam(awayTeamTxt.Text);
                currentData.setDate(dateTimePicker1.Value);

                currentData.setResult(resultCmb.SelectedItem.ToString());
                currentData.setBetType(betTypeCmb.SelectedItem.ToString());
                float holder1, holder2, holder3;
                if (float.TryParse(oddsTxt.Text, out holder1) &&
                    float.TryParse(moneyWonTxt.Text, out holder2) &&
                    float.TryParse(moneyBetTxt.Text, out holder3))
                {
                    currentData.setBetOdds(holder1);
                    currentData.setMoneyWon(holder2);
                    currentData.setMoneyBet(holder3);
                    clearTextBoxes();
                }
                else
                {
                    MessageBox.Show("Odds/Money Won/Money Bet need to be Numbers", "error", MessageBoxButtons.OK);
                }
                resultsData.Add(currentData);
            }
            else
            {
                MessageBox.Show("Labels can't be empty", "error", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 2
0
        private bool addBetDataToListview(bettingData currentBets)
        {
            string[]     dataStrings = new string[9];
            ListViewItem listedData;

            dataStrings[0] = currentBets.getSportName();
            dataStrings[1] = currentBets.getHomeTeam();
            dataStrings[2] = currentBets.getAwayTeam();
            dataStrings[3] = currentBets.getDateOfBet().ToString("MMMM dd, yyyy");
            dataStrings[4] = currentBets.getMoneyBet().ToString();
            dataStrings[5] = currentBets.getResult();
            dataStrings[6] = currentBets.getBetType();
            dataStrings[7] = currentBets.getBetOdds().ToString();
            dataStrings[8] = currentBets.getMoneyWon().ToString();

            listedData = new ListViewItem(dataStrings);
            resultsList.Items.Add(listedData);

            return(true);
        }