private void AppBarButton_Click_3(object sender, RoutedEventArgs e)
 {
     try
     {
         Lotto insert = new Lotto();
         bool txtBox = display.checkTextboxesPowerball(txtP1.Text, txtP2.Text, txtP3.Text, txtP4.Text, txtP5.Text);
         bool final = display.checkForCharactersPowerball(txtP1.Text, txtP2.Text, txtP3.Text, txtP4.Text, txtP5.Text);
         if (txtBox == true)
         {
             display.msgBox("textbox must not be left empty!!");
         }
         else if (final == false)
         {
             display.msgBox("You must enter number/s and not character/s.");
         }
         else
         {
             bool blnValid = display.checkIntegerPowerball(txtP1.Text, txtP2.Text, txtP3.Text, txtP4.Text, txtP5.Text);
             if (blnValid == true && final == true)
             {
                 insert.savePowerballGeneratedNumbers(Convert.ToInt32(txtP1.Text), Convert.ToInt32(txtP2.Text), Convert.ToInt32(txtP3.Text), Convert.ToInt32(txtP4.Text), Convert.ToInt32(txtP5.Text));
                 display.msgBox("Successfully added to the database.");
             }
             else if (blnValid == false)
             {
                 display.msgBox("number must be within the 1-49 range.");
             }
         }
     }
     catch (Exception ex)
     {
         display.msgBox(ex.Message);
     }
 }
        private void appbarSaveResults_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Lotto insert = new Lotto();
                int storeValue = 0;
                bool txtBox = message.checkTextboxes(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtBonus.Text);
                bool final = message.checkForCharacters(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtBonus.Text);
                if (txtBox == true)
                {
                    message.msgBox("textbox must not be left empty!!");
                }
                else if (final == false)
                {
                    message.msgBox("You must enter number/s and not character/s.");
                }
                else
                {
                    bool blnValid = message.checkInteger(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtBonus.Text);
                    if (blnValid == true && final == true)
                    {
                        storeValue = 1;
                    }
                    else if (blnValid == false)
                    {
                        message.msgBox("number must be within the 1-49 range.");
                    }
                }

                if (storeValue == 1)
                {
                    string line = dpDate.Date.ToString().Substring(0, 11);//date from datepicker
                    winnings.storePowerBall(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtBonus.Text);
                    /////////////FROM HERE STORE NUMBERS INTO THE DATABASE///////////
                    storeValues.setStorePowerBallResults(winnings.getPowerBallNumbers(0), winnings.getPowerBallNumbers(1), winnings.getPowerBallNumbers(2), winnings.getPowerBallNumbers(3), winnings.getPowerBallNumbers(4), winnings.getPowerBallNumbers(5), line);
                    message.msgBox("all is good. refresh the page");
                    ////////////FROM HERE STORE NUMBERS INTO THE DATABASE////////////
                }
            }
            catch (Exception ex)
            {
                message.msgBox(ex.Message);
            }
        }
Ejemplo n.º 3
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         txtblockFirstNameError.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
         txtBlockSurnameError.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
         if (textBoxFirstName.Text == "" && textBoxLastName.Text == "")
         {                   
             txtblockFirstNameError.Visibility = Windows.UI.Xaml.Visibility.Visible;
             txtBlockSurnameError.Visibility = Windows.UI.Xaml.Visibility.Visible;
         }
         else if (textBoxLastName.Text == "")
         {
             txtBlockSurnameError.Visibility = Windows.UI.Xaml.Visibility.Visible;
         }  
         else if (textBoxFirstName.Text == "")
         {
             txtblockFirstNameError.Visibility = Windows.UI.Xaml.Visibility.Visible;
         }
         else
         {
             //User addDetails = new User()
             //{
             //    name = textBoxFirstName.Text,
             //    Surname = textBoxLastName.Text
             //};
             //SQLiteAsyncConnection conn = new SQLiteAsyncConnection("newProject.db");
             //await conn.InsertAsync(addDetails);
             Lotto insert = new Lotto();
             insert.InsertUserDetails(textBoxFirstName.Text, textBoxLastName.Text);
             message.msgBox("Successfully added into the database.");
         }
     }
     catch (Exception ex)
     {
         message.msgBox(ex.Message);
     }
 }
        private void appbarSaveResults_Click(object sender, RoutedEventArgs e)
        {
            DisplayMessage display = new DisplayMessage();
            try
            {
                Lotto insert = new Lotto();
                int storeValue = 0;
                bool txtBox = display.checkNullTextboxes(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text, txtBonus.Text);
                bool final = display.checkForChar(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text, txtBonus.Text);
                if (txtBox == true)
                {
                    display.msgBox("textbox must not be left empty!!");
                }
                else if (final == false)
                {
                    display.msgBox("You must enter number/s and not character/s.");
                }
                else
                {
                    bool blnValid = display.checkIntegerLottoResults(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text, txtBonus.Text);
                    if (blnValid == true && final == true)
                    {
                        storeValue = 1;
                    }
                    else if (blnValid == false)
                    {
                        display.msgBox("number must be within the 1-49 range.");
                    }
                }

                if (storeValue == 1)
                {
                    int check = 0;
                    string line = dpDate.Date.ToString().Substring(0, 11).Trim();//date from datepicker
                    string but = ((ComboBoxItem)cmbType.SelectedItem).Content.ToString();
                    if (but == "Lotto")
                    {
                        winnings.store(but, txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text, txtBonus.Text);
                        check = 1;
                    }
                    else if (but == "LottoPlus")
                    {
                        winnings.storeLottoPlus(but, txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text, txtBonus.Text);
                        check = 2;
                    }
                    /////////////FROM HERE STORE NUMBERS INTO THE DATABASE///////////
                    if (check == 1)
                    {
                        storeValues.setStoreLottoLiveResults(winnings.getNumbers(0), winnings.getNumbers(1), winnings.getNumbers(2), winnings.getNumbers(3), winnings.getNumbers(4), winnings.getNumbers(5), winnings.getNumbers(6), line);
                        display.msgBox("all is good. refresh the page");
                    }
                    else if (check == 2)
                    {
                        storeValues.setStoreLottoPlusResults(winnings.getLottoPlus(0), winnings.getLottoPlus(1), winnings.getLottoPlus(2), winnings.getLottoPlus(3), winnings.getLottoPlus(4), winnings.getLottoPlus(5), winnings.getLottoPlus(6), line);
                        display.msgBox("all is good. refresh the page");
                    }                  
                    ////////////FROM HERE STORE NUMBERS INTO THE DATABASE////////////
                }
            }
            catch (Exception ex)
            {
                display.msgBox(ex.Message);
            }
        }
Ejemplo n.º 5
0
 public ObservableCollection<Lotto> getIdValues()
 {
     maximum = new ObservableCollection<Lotto>();
     using (var db = new SQLite.SQLiteConnection(app.dbPath))
     {
         var query = db.Query<LottoLiveResults>("select id from LottoLiveResults");
         foreach (var collect in query)
         {
             var _collect = new Lotto()
             {
                 IdNumber = collect.Id
             };
             maximum.Add(_collect);
         }
     }
     return maximum;
 }
Ejemplo n.º 6
0
 public ObservableCollection<Lotto> getKeyValues()
 {
     highest = new ObservableCollection<Lotto>();
     using (var db = new SQLite.SQLiteConnection(app.dbPath))
     {
         var query = db.Query<PowerBallResults>("select id from PowerBallResults");
         foreach (var _call in query)
         {
             var call = new Lotto()
             {
                 IdNumber = _call.Id
             };
             highest.Add(call);
         }
     }
     return highest;
 }
 private void AppBarButton_Click_5(object sender, RoutedEventArgs e)
 {
     try
     {
         Lotto lottery = new Lotto();
         int aa, bb, cc, dd, ee, ff;
         aa = numbers[0];
         bb = numbers[1];
         cc = numbers[2];
         dd = numbers[3];
         ee = numbers[4];
         ff = numbers[5];
         lottery.setUserSavedNumbers(aa, bb, cc, dd, ee, ff);
         msg.msgBox("Successfully Saved. You will can view your numbers on the results page and compare with the latest Lotto and Lotto Plus results");
     }
     catch (Exception ex)
     {
         msg.msgBox("Error Message: " + ex.Message);
     }
 }
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Lotto lottery = new Lotto();
         int aa, bb, cc, dd, ee;
         aa = numbers[0];
         bb = numbers[1];
         cc = numbers[2];
         dd = numbers[3];
         ee = numbers[4];
         lottery.savePowerballGeneratedNumbers(aa, bb, cc, dd, ee);
         //msg.msgBox("Successfully Saved. You will can view your numbers on the results page and compare with the latest Lotto and Lotto Plus results");
     }
     catch (Exception ex)
     {
         msg.msgBox("Error Message: " + ex.Message);
     }
 }