private void btnSecurityChks_Click(object sender, RoutedEventArgs e) { SecurityChecksPrompt checksWin = new SecurityChecksPrompt(); // pass cook checksWin.passedCook = passedCook; // display stored files if any checksWin.lblFilePVG.Content = checksWin.passedCook.pvg.scan; checksWin.lblFileFoodCert.Content = checksWin.passedCook.foodHygiene.scan; checksWin.ShowDialog(); // update the status text if it has changed in the next window lblPVGStat.Content = checksWin.pvgStatusStr; lblCertStat.Content = checksWin.foodCertStatusStr; }
private void btnCookNext_Click(object sender, RoutedEventArgs e) { // check if all required fields are filled if (string.IsNullOrEmpty(txtbxFirstName.Text) || string.IsNullOrEmpty(txtbxLastName.Text) || string.IsNullOrEmpty(txtbxEmail.Text) || string.IsNullOrEmpty(txtbxAddressLn1.Text) || string.IsNullOrEmpty(txtbxCity.Text) || string.IsNullOrEmpty(txtbxPostCode.Text) || string.IsNullOrEmpty(pswrdbx1.Password.ToString()) || string.IsNullOrEmpty(foodSelection) || string.IsNullOrEmpty(travelSelection)) { MessageBox.Show("Please fill in all the required fields that are marked with an asterisk (*)"); } else { // check if passwords match if (pswrdbx1.Password.ToString() == pswrdbx2.Password.ToString()) { // when the cook's next button is pressed this takes the completed // form details and adds them to a cook object. The object is then added // to the list of cooks. newCook.firstName = txtbxFirstName.Text; newCook.lastName = txtbxLastName.Text; newCook.email = txtbxEmail.Text; newAddress.firstLine = txtbxAddressLn1.Text; newAddress.secondLine = txtbxAddressLn2.Text; newAddress.postCode = txtbxPostCode.Text; newAddress.city = txtbxCity.Text; newCook.address = newAddress; if (foodSelection == "Please Fill") { foodSelection = txtbxOther.Text; } newCook.cookPreferences = foodSelection; newCook.travelMethod = travelSelection; newCook.password = pswrdbx1.Password.ToString(); // initialise food certificate and pvg to avoid bugs newPVG.scan = ""; newPVG.status = ""; newFoodCert.scan = ""; newCook.pvg = newPVG; newCook.foodHygiene = newFoodCert; SecurityChecksPrompt checksWin = new SecurityChecksPrompt(); // pass newCook to the new window checksWin.passedCook = newCook; // pass the current cook and eater list checksWin.cooksList = cooksList; checksWin.eatersList = eatersList; // open the next window checksWin.ShowDialog(); } else { // display pop-up if passwords don't match MessageBox.Show("Passwords don't match. Please make sure you enter the same password on both firelds"); } } }