예제 #1
0
        private void AppBarButton_Click_4(object sender, RoutedEventArgs e)
        {
            try
            {
                Lotto insert = new Lotto();

                bool txtBox = display.checkTextboxes(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text);
                bool final = display.checkForCharacters(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.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.checkInteger(txtOne.Text, txtTwo.Text, txtThree.Text, txtFour.Text, txtFive.Text, txtSix.Text);
                    if (blnValid == true && final == true)
                    {
                        insert.setUserSavedNumbers(Convert.ToInt32(txtOne.Text), Convert.ToInt32(txtTwo.Text), Convert.ToInt32(txtThree.Text), Convert.ToInt32(txtFour.Text), Convert.ToInt32(txtFive.Text), Convert.ToInt32(txtSix.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 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);
     }
 }