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 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); } }