/// <summary> /// Validates and saves a page's values. Returns true if the page is valid. /// </summary> /// <param name="page">The page ID to check.</param> /// <param name="currentPage">Whether this is the current page. If true, the values in the controls will be checked, otherwise the session will be checked.</param> /// <param name="saveOnly">If save only is true, the validation will be ignored and values will be saved so that they can be returned to. This is for use with the "Back" button.</param> protected bool ValidateAndSave(int page, bool currentPage, bool saveOnly) { bool retVal = true; switch (page) { case 1: #region Page 1 break; #endregion Page 1 case 2: #region Page 2 if (QueryPropertyShortCode == GCCPropertyShortCode.GCC || (QueryPropertyShortCode == GCCPropertyShortCode.GAG && QueryGAGLocation == GLocation.None)) { if (currentPage) { SurveyTools.SaveValue(fbkProperty); } if (!saveOnly) { if (fbkProperty.SelectedIndex == 0) { fbkProperty.MessageManager.ErrorMessage = "Please select an answer."; retVal = false; } } } break; #endregion Page 2 case 3: // Department #region Page 3 if (currentPage) { SurveyTools.SaveValue(ddlDepartment); } if (!saveOnly) { if (ddlDepartment.SelectedIndex == 0) { ddlDepartment.MessageManager.ErrorMessage = "Please select your department."; retVal = false; } } break; #endregion Page 3 case 4: // Main survey #region Page 4 if (currentPage) { SurveyTools.SaveValue(Q1); SurveyTools.SaveValue(Q2); SurveyTools.SaveValue(Q3); SurveyTools.SaveValue(Q4); SurveyTools.SaveValue(Q5); SurveyTools.SaveValue(Q6); SurveyTools.SaveValue(Q7); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q1, true) | !SurveyTools.CheckForAnswer(Q2, true) | !SurveyTools.CheckForAnswer(Q3, true) | !SurveyTools.CheckForAnswer(Q4, true) | !SurveyTools.CheckForAnswer(Q5, true) | !SurveyTools.CheckForAnswer(Q6, true) | !SurveyTools.CheckForAnswer(Q7, true)) { retVal = false; } } break; #endregion Page 4 case 5: // Main survey #region Page 5 if (currentPage) { SurveyTools.SaveValue(Q8); SurveyTools.SaveValue(Q9); SurveyTools.SaveValue(Q10); SurveyTools.SaveValue(Q11); SurveyTools.SaveValue(Q12); SurveyTools.SaveValue(Q13); SurveyTools.SaveValue(Q14); SurveyTools.SaveValue(Q15); SurveyTools.SaveValue(Q16); SurveyTools.SaveValue(Q17); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q8, true) | !SurveyTools.CheckForAnswer(Q9, true) | !SurveyTools.CheckForAnswer(Q10, true) | !SurveyTools.CheckForAnswer(Q11, true) | !SurveyTools.CheckForAnswer(Q12, true) | !SurveyTools.CheckForAnswer(Q13, true) | !SurveyTools.CheckForAnswer(Q14, true) | !SurveyTools.CheckForAnswer(Q15, true) | !SurveyTools.CheckForAnswer(Q16, true) | !SurveyTools.CheckForAnswer(Q17, true)) { retVal = false; } } break; #endregion Page 5 case 6: // Main survey #region Page 6 if (currentPage) { SurveyTools.SaveValue(Q18); SurveyTools.SaveValue(Q19); SurveyTools.SaveValue(Q20); SurveyTools.SaveValue(Q21); SurveyTools.SaveValue(Q22); SurveyTools.SaveValue(Q23); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q18, true) | !SurveyTools.CheckForAnswer(Q19, true) | !SurveyTools.CheckForAnswer(Q20, true) | !SurveyTools.CheckForAnswer(Q21, true) | !SurveyTools.CheckForAnswer(Q22, true) | !SurveyTools.CheckForAnswer(Q23, true)) { retVal = false; } } break; #endregion Page 6 case 7: // Main survey #region Page 7 if (currentPage) { SurveyTools.SaveValue(Q24); SurveyTools.SaveValue(Q25); SurveyTools.SaveValue(Q26); SurveyTools.SaveValue(Q27); SurveyTools.SaveValue(Q28); SurveyTools.SaveValue(Q29A); SurveyTools.SaveValue(Q29B); SurveyTools.SaveValue(Q29C); SurveyTools.SaveValue(Q30); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q24, true) | !SurveyTools.CheckForAnswer(Q25, true) | !SurveyTools.CheckForAnswer(Q26, true) | !SurveyTools.CheckForAnswer(Q27, true) | !SurveyTools.CheckForAnswer(Q28, true) | !SurveyTools.CheckForAnswer(Q29A, true) | !SurveyTools.CheckForAnswer(Q29B, true) | !SurveyTools.CheckForAnswer(Q29C, true) | !SurveyTools.CheckForAnswer(Q30, true)) { retVal = false; } } break; #endregion Page 7 case 8: // Demographics #region Page 8 if (currentPage) { SurveyTools.SaveRadioButtons(radQ31_Hourly, radQ31_Salary); SurveyTools.SaveRadioButtons(radQ32_1, radQ32_2, radQ32_3, radQ32_4, radQ32_5); SurveyTools.SaveValue(Q33); SurveyTools.SaveValue(chkQ34_1); SurveyTools.SaveValue(chkQ34_2); SurveyTools.SaveValue(chkQ34_3); SurveyTools.SaveValue(chkQ34_4); SurveyTools.SaveValue(chkQ34_5); SurveyTools.SaveValue(chkQ34_6); SurveyTools.SaveValue(chkQ34_7); SurveyTools.SaveValue(chkQ34_8); SurveyTools.SaveValue(chkQ34_9); SurveyTools.SaveValue(chkQ34_10); SurveyTools.SaveValue(chkQ34_11); SurveyTools.SaveValue(chkQ34_12); } if (!saveOnly) { bool payTypeNotSelected = !SurveyTools.GetValue(radQ31_Hourly, currentPage, false) && !SurveyTools.GetValue(radQ31_Salary, currentPage, false); if (payTypeNotSelected) { radQ31_Hourly.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } bool tenureNotSelected = !SurveyTools.GetValue(radQ32_1, currentPage, false) && !SurveyTools.GetValue(radQ32_2, currentPage, false) && !SurveyTools.GetValue(radQ32_3, currentPage, false) && !SurveyTools.GetValue(radQ32_4, currentPage, false) && !SurveyTools.GetValue(radQ32_5, currentPage, false); if (tenureNotSelected) { radQ32_1.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } } break; #endregion Page 8 case 9: // First Final Confirmation #region Page 9 if (currentPage) { SurveyTools.SaveRadioButtons(radFFNoThanks, radFFContinue); } if (!saveOnly) { bool continueNotSelected = !SurveyTools.GetValue(radFFNoThanks, currentPage, false) && !SurveyTools.GetValue(radFFContinue, currentPage, false); if (continueNotSelected) { radFFNoThanks.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } } break; #endregion Page 9 case 10: // CSR #region Page 10 if (radFFContinue.Checked) { if (currentPage) { SurveyTools.SaveValue(CSR_Q1); SurveyTools.SaveValue(CSR_Q2); SurveyTools.SaveValue(CSR_Q3); SurveyTools.SaveValue(CSR_Q4); SurveyTools.SaveValue(CSR_Q5_1); SurveyTools.SaveValue(CSR_Q5_2); SurveyTools.SaveValue(CSR_Q5_3); SurveyTools.SaveValue(CSR_Q5_4); SurveyTools.SaveValue(CSR_Q6); SurveyTools.SaveValue(CSR_Q7); SurveyTools.SaveValue(CSR_Q8_1); SurveyTools.SaveValue(CSR_Q8_2); SurveyTools.SaveValue(CSR_Q8_3); SurveyTools.SaveValue(CSR_Q8_4); SurveyTools.SaveValue(CSR_Q8_5); SurveyTools.SaveValue(CSR_Q8_6); SurveyTools.SaveValue(CSR_Q8_7); SurveyTools.SaveValue(CSR_Q8_8); SurveyTools.SaveValue(CSR_Q8_9); SurveyTools.SaveValue(CSR_Q8_OtherExplanation); SurveyTools.SaveValue(CSR_Q9A); SurveyTools.SaveValue(CSR_Q9B); SurveyTools.SaveValue(CSR_Q9C); SurveyTools.SaveValue(CSR_Q9D); SurveyTools.SaveValue(CSR_Q9E); SurveyTools.SaveValue(CSR_Q9F); SurveyTools.SaveValue(CSR_Q9G); SurveyTools.SaveValue(CSR_Q9H); SurveyTools.SaveValue(CSR_Q10A); SurveyTools.SaveValue(CSR_Q10B); SurveyTools.SaveValue(CSR_Q10C); SurveyTools.SaveValue(CSR_Q10D); SurveyTools.SaveValue(CSR_Q10E); SurveyTools.SaveRadioButtons(radCSR_Q11_1, radCSR_Q11_2, radCSR_Q11_3, radCSR_Q11_4); SurveyTools.SaveValue(CSR_Q12); SurveyTools.SaveValue(CSR_Q13); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(CSR_Q1, true) | !SurveyTools.CheckForAnswer(CSR_Q2, true) | !SurveyTools.CheckForAnswer(CSR_Q3, true) | !SurveyTools.CheckForAnswer(CSR_Q4, true) | !SurveyTools.CheckForAnswer(CSR_Q6, true) | !SurveyTools.CheckForAnswer(CSR_Q7, true) | !SurveyTools.CheckForAnswer(CSR_Q9A, true) | !SurveyTools.CheckForAnswer(CSR_Q9B, true) | !SurveyTools.CheckForAnswer(CSR_Q9C, true) | !SurveyTools.CheckForAnswer(CSR_Q9D, true) | !SurveyTools.CheckForAnswer(CSR_Q9E, true) | !SurveyTools.CheckForAnswer(CSR_Q9F, true) | !SurveyTools.CheckForAnswer(CSR_Q9G, true) | !SurveyTools.CheckForAnswer(CSR_Q9H, true) | !SurveyTools.CheckForAnswer(CSR_Q10A, true) | !SurveyTools.CheckForAnswer(CSR_Q10B, true) | !SurveyTools.CheckForAnswer(CSR_Q10C, true) | !SurveyTools.CheckForAnswer(CSR_Q10D, true) | !SurveyTools.CheckForAnswer(CSR_Q10E, true) | (!(new GCCPropertyShortCode[] { GCCPropertyShortCode.GAG, GCCPropertyShortCode.FL, GCCPropertyShortCode.GD, GCCPropertyShortCode.CNB }).Contains(Master.PropertyShortCode) && !SurveyTools.CheckForAnswer(CSR_Q12, true)) ) { retVal = false; } bool informedNotSelected = !SurveyTools.GetValue(radCSR_Q11_1, currentPage, false) && !SurveyTools.GetValue(radCSR_Q11_2, currentPage, false) && !SurveyTools.GetValue(radCSR_Q11_3, currentPage, false) && !SurveyTools.GetValue(radCSR_Q11_4, currentPage, false); if (informedNotSelected) { radCSR_Q11_4.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } if (CSR_Q8_9.Checked && String.IsNullOrEmpty(CSR_Q8_OtherExplanation.Text)) { CSR_Q8_9.MessageManager.ErrorMessage = "Please explain why you chose \"Other\"."; retVal = false; } } } break; #endregion Page 10 } return(retVal); }
/// <summary> /// Validates and saves a page's values. Returns true if the page is valid. /// </summary> /// <param name="page">The page ID to check.</param> /// <param name="currentPage">Whether this is the current page. If true, the values in the controls will be checked, otherwise the session will be checked.</param> /// <param name="saveOnly">If save only is true, the validation will be ignored and values will be saved so that they can be returned to. This is for use with the "Back" button.</param> protected bool ValidateAndSave(int page, bool currentPage, bool saveOnly) { bool retVal = true; switch (page) { case 1: #region Page 1 if (!saveOnly) { bool accept = SurveyTools.GetValue(radAccept, currentPage, false); bool decline = SurveyTools.GetValue(radDecline, currentPage, false); if (!accept && !decline) { mmAcceptGroup.ErrorMessage = "Please select one of the following options."; return(false); } } if (currentPage) { SurveyTools.SaveRadioButtons(radAccept, radDecline); } break; #endregion Page 1 case 2: #region Page 2 if (!saveOnly) { if (SurveyType == GSEISurveyType.HP) { if (!SurveyTools.GetValue(radLocation_EC, currentPage, false) && !SurveyTools.GetValue(radLocation_HA, currentPage, false) && !SurveyTools.GetValue(radLocation_None, currentPage, false)) { radLocation_EC.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } } else if (SurveyType == GSEISurveyType.TM) { if (!SurveyTools.GetValue(radLocation_RR, currentPage, false) && !SurveyTools.GetValue(radLocation_HRCV, currentPage, false) && !SurveyTools.GetValue(radLocation_None2, currentPage, false)) { radLocation_RR.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } } else if (SurveyType == GSEISurveyType.GA) { if (!SurveyTools.GetValue(radLocation_Lakewood, currentPage, false) && !SurveyTools.GetValue(radLocation_Tukwila, currentPage, false) && !SurveyTools.GetValue(radLocation_Everett, currentPage, false) && !SurveyTools.GetValue(radLocation_DeMoines, currentPage, false) && !SurveyTools.GetValue(radLocation_None3, currentPage, false)) { radLocation_Lakewood.MessageManager.ErrorMessage = "Please select one of the following options."; retVal = false; } } } if (currentPage) { if (SurveyType == GSEISurveyType.HP) { SurveyTools.SaveRadioButtons(radLocation_EC, radLocation_HA, radLocation_None); } else if (SurveyType == GSEISurveyType.TM) { SurveyTools.SaveRadioButtons(radLocation_RR, radLocation_HRCV, radLocation_None2); } else if (SurveyType == GSEISurveyType.GA) { SurveyTools.SaveRadioButtons(radLocation_Lakewood, radLocation_Tukwila, radLocation_Everett, radLocation_DeMoines, radLocation_None3); } } break; #endregion Page 2 case 3: // Staff #region Page 3 if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q7A, true) | !SurveyTools.CheckForAnswer(Q7B, true) | !SurveyTools.CheckForAnswer(Q7C, true) | !SurveyTools.CheckForAnswer(Q7D, true) | !SurveyTools.CheckForAnswer(Q7E, true) | !SurveyTools.CheckForAnswer(Q7F, true) | !SurveyTools.CheckForAnswer(Q8, true) ) { retVal = false; } } if (currentPage) { SurveyTools.SaveValue(Q7A); SurveyTools.SaveValue(Q7B); SurveyTools.SaveValue(Q7C); SurveyTools.SaveValue(Q7D); SurveyTools.SaveValue(Q7E); SurveyTools.SaveValue(Q7F); SurveyTools.SaveValue(Q8); } break; #endregion Page 3 case 4: // Demographics #region Page 4 if (!saveOnly) { bool ageGroupNotSelected = !SurveyTools.GetValue(Q37_1, currentPage, false) && !SurveyTools.GetValue(Q37_2, currentPage, false) && !SurveyTools.GetValue(Q37_3, currentPage, false) && !SurveyTools.GetValue(Q37_4, currentPage, false) && !SurveyTools.GetValue(Q37_5, currentPage, false) && !SurveyTools.GetValue(Q37_6, currentPage, false); //if ( ageGroupNotSelected ) { // Q37Message.ErrorMessage = "Please answer the following question."; // retVal = false; //} bool genderNotSelected = !SurveyTools.GetValue(Q36Male, currentPage, false) && !SurveyTools.GetValue(Q36Female, currentPage, false); //if ( genderNotSelected ) { // Q36Message.ErrorMessage = "Please answer the following question."; // retVal = false; //} if (SurveyType != GSEISurveyType.GA) { bool noneSelected = !SurveyTools.GetValue(radQ1_Slots, currentPage, false) && !SurveyTools.GetValue(radQ1_Tables, currentPage, false) && !SurveyTools.GetValue(radQ1_Poker, currentPage, false) && !SurveyTools.GetValue(radQ1_Food, currentPage, false) && !SurveyTools.GetValue(radQ1_Entertainment, currentPage, false) && !SurveyTools.GetValue(radQ1_Hotel, currentPage, false) && !SurveyTools.GetValue(radQ1_LiveRacing, currentPage, false) && !SurveyTools.GetValue(radQ1_Racebook, currentPage, false) && !SurveyTools.GetValue(radQ1_Bingo, currentPage, false) && !SurveyTools.GetValue(radQ1_Lottery, currentPage, false) && !SurveyTools.GetValue(radQ1_None, currentPage, false); if (!saveOnly && noneSelected) { mmQ1.ErrorMessage = "Please select one of the following options."; return(false); } } } if (currentPage) { SurveyTools.SaveRadioButtons(Q37_1, Q37_2, Q37_3, Q37_4, Q37_5, Q37_6); SurveyTools.SaveRadioButtons(Q36Male, Q36Female); if (SurveyType != GSEISurveyType.GA) { SurveyTools.SaveRadioButtons(radQ1_Slots, radQ1_Tables, radQ1_Poker, radQ1_Food, radQ1_Entertainment, radQ1_Hotel, radQ1_LiveRacing, radQ1_Racebook, radQ1_Bingo, radQ1_Lottery, radQ1_None); SurveyTools.SaveValue(chkQ2_Slots); SurveyTools.SaveValue(chkQ2_Tables); SurveyTools.SaveValue(chkQ2_Poker); SurveyTools.SaveValue(chkQ2_Food); SurveyTools.SaveValue(chkQ2_Entertainment); SurveyTools.SaveValue(chkQ2_Hotel); SurveyTools.SaveValue(chkQ2_LiveRacing); SurveyTools.SaveValue(chkQ2_Racebook); SurveyTools.SaveValue(chkQ2_Bingo); SurveyTools.SaveValue(chkQ2_Lottery); } } break; #endregion Page 4 } return(retVal); }
/// <summary> /// Validates and saves a page's values. Returns true if the page is valid. /// </summary> /// <param name="page">The page ID to check.</param> /// <param name="currentPage">Whether this is the current page. If true, the values in the controls will be checked, otherwise the session will be checked.</param> /// <param name="saveOnly">If save only is true, the validation will be ignored and values will be saved so that they can be returned to. This is for use with the "Back" button.</param> protected bool ValidateAndSave(int page, bool currentPage, bool saveOnly) { bool retVal = true; switch (page) { case 1: #region Page 1 if (currentPage) { SurveyTools.SaveValue <string>(Q1); SurveyTools.SaveValue <string>(Q1); if (Session["CurrentUI"].ToString() == "fr-CA") { SurveyTools.SaveValue <int>(Q2_F); } else { SurveyTools.SaveValue <int>(Q2); } SurveyTools.SaveValue <string>(Q3); SurveyTools.SaveValue <string>(Q4); SurveyTools.SaveValue <string>(Q5Name); SurveyTools.SaveValue <string>(Q5Title); SurveyTools.SaveValue <string>(Q5Telephone); SurveyTools.SaveValue <string>(Q5Email); SurveyTools.SaveValue <string>(Q6Street); SurveyTools.SaveValue <string>(Q6City); SurveyTools.SaveValue <string>(Q6Province); SurveyTools.SaveValue <string>(Q6PostalCode); SurveyTools.SaveValue <string>(Q7); SurveyTools.SaveValue <string>(Q8); SurveyTools.SaveRadioButtons(Q9A, Q9B, Q9C); SurveyTools.SaveValue <string>(Q9C_Explanation); SurveyTools.SaveValue <string>(Q10); SurveyTools.SaveValue <bool>(Q11A_PastSupport); SurveyTools.SaveValue <bool>(Q11A_CurrentRequest); SurveyTools.SaveValue <bool>(Q11B_PastSupport); SurveyTools.SaveValue <bool>(Q11B_CurrentRequest); SurveyTools.SaveValue <bool>(Q11C_PastSupport); SurveyTools.SaveValue <bool>(Q11C_CurrentRequest); //SurveyTools.SaveValue<bool>( Q11D_PastSupport ); //SurveyTools.SaveValue<bool>( Q11D_CurrentRequest ); SurveyTools.SaveValue <bool>(Q11E_PastSupport); SurveyTools.SaveValue <bool>(Q11E_CurrentRequest); SurveyTools.SaveValue <bool>(Q11F_PastSupport); SurveyTools.SaveValue <bool>(Q11F_CurrentRequest); SurveyTools.SaveValue <bool>(Q11G_PastSupport); SurveyTools.SaveValue <bool>(Q11G_CurrentRequest); SurveyTools.SaveValue <bool>(Q11H_PastSupport); SurveyTools.SaveValue <bool>(Q11H_CurrentRequest); SurveyTools.SaveValue <bool>(Q11I_PastSupport); SurveyTools.SaveValue <bool>(Q11I_CurrentRequest); SurveyTools.SaveValue <bool>(Q11J_PastSupport); SurveyTools.SaveValue <bool>(Q11J_CurrentRequest); SurveyTools.SaveValue <bool>(Q11K_PastSupport); SurveyTools.SaveValue <bool>(Q11K_CurrentRequest); SurveyTools.SaveValue <bool>(Q11L_PastSupport); SurveyTools.SaveValue <bool>(Q11L_CurrentRequest); SurveyTools.SaveValue <bool>(Q11M_PastSupport); SurveyTools.SaveValue <bool>(Q11M_CurrentRequest); //2017-11-14 aDDING 3 NEW LOCATIONS SurveyTools.SaveValue <bool>(Q11N_PastSupport); SurveyTools.SaveValue <bool>(Q11N_CurrentRequest); SurveyTools.SaveValue <bool>(Q11O_PastSupport); SurveyTools.SaveValue <bool>(Q11O_CurrentRequest); SurveyTools.SaveValue <bool>(Q11P_PastSupport); SurveyTools.SaveValue <bool>(Q11P_CurrentRequest); SurveyTools.SaveValue <bool>(Q11Q_PastSupport); SurveyTools.SaveValue <bool>(Q11Q_CurrentRequest); SurveyTools.SaveValue <bool>(Q11R_PastSupport); SurveyTools.SaveValue <bool>(Q11R_CurrentRequest); SurveyTools.SaveValue <bool>(Q11S_PastSupport); SurveyTools.SaveValue <bool>(Q11S_CurrentRequest); SurveyTools.SaveValue <bool>(Q11T_PastSupport); SurveyTools.SaveValue <bool>(Q11T_CurrentRequest); SurveyTools.SaveValue <bool>(Q11U_PastSupport); SurveyTools.SaveValue <bool>(Q11U_CurrentRequest); SurveyTools.SaveValue <bool>(Q11V_PastSupport); SurveyTools.SaveValue <bool>(Q11V_CurrentRequest); SurveyTools.SaveValue <bool>(Q11W_PastSupport); SurveyTools.SaveValue <bool>(Q11W_CurrentRequest); SurveyTools.SaveValue <bool>(Q11X_PastSupport); SurveyTools.SaveValue <bool>(Q11X_CurrentRequest); SurveyTools.SaveValue <string>(Q12); SurveyTools.SaveValue <string>(Q13); SurveyTools.SaveValue <string>(Q14); } if (!saveOnly) { if (!SurveyTools.CheckForAnswer(Q1, true) | !SurveyTools.CheckForAnswer(Q2, true) | !SurveyTools.CheckForAnswer(Q5Name, true) | !SurveyTools.CheckForAnswer(Q5Title, true) | !SurveyTools.CheckForAnswer(Q5Telephone, true) | !SurveyTools.CheckForAnswer(Q5Email, true) | !SurveyTools.CheckForAnswer(Q6Street, true) | !SurveyTools.CheckForAnswer(Q6City, true) | !SurveyTools.CheckForAnswer(Q6Province, true) | !SurveyTools.CheckForAnswer(Q6PostalCode, true) | !SurveyTools.CheckForAnswer(Q7, true) | !SurveyTools.CheckForAnswer(Q10, true) | !SurveyTools.CheckForAnswer(Q13, true) | !SurveyTools.CheckForAnswer(Q14, true) ) { retVal = false; } bool noneSelected = !SurveyTools.GetValue(Q9A, currentPage, false) && !SurveyTools.GetValue(Q9B, currentPage, false) && !SurveyTools.GetValue(Q9C, currentPage, false); if (noneSelected) { mmQ9.ErrorMessage = "Please select one of the following values."; retVal = false; } string email = SurveyTools.GetValue(Q5Email, currentPage, String.Empty); if (!Validation.RegExCheck(email, ValidationType.Email)) { Q5Email.MessageManager.ErrorMessage = "Please enter a valid email address."; return(false); } string postcode = SurveyTools.GetValue(Q6PostalCode, currentPage, String.Empty); if (!Validation.RegExCheck(postcode, ValidationType.Postal)) { Q6PostalCode.MessageManager.ErrorMessage = "Please enter a valid postal code in the format 'A1A 1A1'."; return(false); } if (Session["CurrentUI"].ToString() == "fr-CA") { if ((Q2_F.SelectedValue_F == 1 && !SurveyTools.CheckForAnswer(Q3, true)) || (Q2_F.SelectedValue_F == 0 && !SurveyTools.CheckForAnswer(Q4, true))) { retVal = false; } } else { if ((Q2.SelectedValue == 1 && !SurveyTools.CheckForAnswer(Q3, true)) || (Q2.SelectedValue == 0 && !SurveyTools.CheckForAnswer(Q4, true))) { retVal = false; } } if (Q9C.Checked && !SurveyTools.CheckForAnswer(Q9C_Explanation, true)) { retVal = false; } } break; #endregion Page 1 case 2: // Final confirm #region Page 2 break; #endregion Page 2 } return(retVal); }
/// <summary> /// Validates and saves a page's values. Returns true if the page is valid. /// </summary> /// <param name="page">The page ID to check.</param> /// <param name="currentPage">Whether this is the current page. If true, the values in the controls will be checked, otherwise the session will be checked.</param> /// <param name="saveOnly">If save only is true, the validation will be ignored and values will be saved so that they can be returned to. This is for use with the "Back" button.</param> protected bool ValidateAndSave(int page, bool currentPage, bool saveOnly) { bool retVal = true; switch (page) { case 1: #region Page 1 string email = GetValue(txtEmail, currentPage, String.Empty); if (!Validation.RegExCheck(email, ValidationType.Email)) { mmTxtEmail.ErrorMessage = "Please enter a valid email address."; return(false); } else if (currentPage) { SaveValue <string>(txtEmail); } break; #endregion Page 1 case 2: #region Page 2 if (!saveOnly) { bool accept = GetValue(radAccept, currentPage, false); bool decline = GetValue(radDecline, currentPage, false); if (!accept && !decline) { mmAcceptGroup.ErrorMessage = "Please select one of the following options."; return(false); } } if (currentPage) { SurveyTools.SaveRadioButtons(radAccept, radDecline); } break; #endregion Page 2 case 3: #region Page 3 if (!saveOnly) { bool Q1notselected = !GetValue(Q1_1, currentPage, false) && !GetValue(Q1_2to4, currentPage, false) && !GetValue(Q1_5to9, currentPage, false) && !GetValue(Q1_10, currentPage, false); if (Q1notselected) { Q1Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q2notselected = !GetValue(Q2_Yes, currentPage, false) && !GetValue(Q2_No, currentPage, false); if (Q2notselected) { Q2Message.ErrorMessage = "Please select one of the following options."; } bool Q3notselected = !GetValue(Q3_No, currentPage, false) && !GetValue(Q3_Yes, currentPage, false); if (Q3notselected) { Q3Message.ErrorMessage = "Please select one of the following options."; } bool Q4notselected = !GetValue(Q4_Yes, currentPage, false) && !GetValue(Q4_No, currentPage, false); if (Q4notselected) { Q4Message.ErrorMessage = "Please select Yes or No."; retVal = false; } } if (currentPage) { SaveValue(Q1_1); SaveValue(Q1_2to4); SaveValue(Q1_5to9); SaveValue(Q1_10); SaveValue(Q2_No); SaveValue(Q2_Yes); SaveValue(Q3_No); SaveValue(Q3_Yes); SaveValue(Q4_Yes); SaveValue(Q4_No); SaveValue(Q4_EncoreNumber); } break; #endregion Page 3 case 4: #region Page 4 if (!saveOnly) { bool Q5notselected = !GetValue(Q5_Tarmac, currentPage, false) && !GetValue(Q5_BoxSeats, currentPage, false) && !GetValue(Q5_GroupPatio, currentPage, false) && !GetValue(Q5_MarqueeTent, currentPage, false) && !GetValue(Q5_SilksBuffet, currentPage, false) && !GetValue(Q5_DiamondClub, currentPage, false); if (Q5notselected) { Q5Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q6notselected = !GetValue(Q6_Excellent, currentPage, false) && !GetValue(Q6_VeryGood, currentPage, false) && !GetValue(Q6_Good, currentPage, false) && !GetValue(Q6_Fair, currentPage, false) && !GetValue(Q6_Poor, currentPage, false); if (Q6notselected) { Q6Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q7notselected = !GetValue(Q7_Excellent, currentPage, false) && !GetValue(Q7_VeryGood, currentPage, false) && !GetValue(Q7_Good, currentPage, false) && !GetValue(Q7_Fair, currentPage, false) && !GetValue(Q7_Poor, currentPage, false); if (Q7notselected) { Q7Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q8notselected = !GetValue(Q8_DefinitelyWould, currentPage, false) && !GetValue(Q8_ProbablyWould, currentPage, false) && !GetValue(Q8_MightMightNot, currentPage, false) && !GetValue(Q8_ProbablyWouldNot, currentPage, false) && !GetValue(Q8_DefinitelyWouldNot, currentPage, false); if (Q8notselected) { Q8Message.ErrorMessage = "Please select one of the following options."; retVal = false; } } if (currentPage) { SaveValue(Q5_Tarmac); SaveValue(Q5_BoxSeats); SaveValue(Q5_GroupPatio); SaveValue(Q5_MarqueeTent); SaveValue(Q5_SilksBuffet); SaveValue(Q5_DiamondClub); SaveValue(Q6_Excellent); SaveValue(Q6_VeryGood); SaveValue(Q6_Good); SaveValue(Q6_Fair); SaveValue(Q6_Poor); SaveValue(Q7_Excellent); SaveValue(Q7_VeryGood); SaveValue(Q7_Good); SaveValue(Q7_Fair); SaveValue(Q7_Poor); SaveValue(Q8_DefinitelyWould); SaveValue(Q8_ProbablyWould); SaveValue(Q8_MightMightNot); SaveValue(Q8_ProbablyWouldNot); SaveValue(Q8_DefinitelyWouldNot); } break; #endregion Page 4 case 5: #region Page 5 if (!saveOnly) { bool Q9notselected = !GetValue(Q9_Male, currentPage, false) && !GetValue(Q9_Female, currentPage, false); if (Q9notselected) { Q9Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q10notselected = !GetValue(Q10_19to24, currentPage, false) && !GetValue(Q10_25to34, currentPage, false) && !GetValue(Q10_35to44, currentPage, false) && !GetValue(Q10_45to54, currentPage, false) && !GetValue(Q10_55to64, currentPage, false) && !GetValue(Q10_65orOlder, currentPage, false); if (Q10notselected) { Q10Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q11notselected = !GetValue(Q11_35000, currentPage, false) && !GetValue(Q11_35000to59999, currentPage, false) && !GetValue(Q11_60000to89999, currentPage, false) && !GetValue(Q11_90000, currentPage, false) && !GetValue(Q11_NoSay, currentPage, false); if (Q11notselected) { Q10Message.ErrorMessage = "Please select one of the following options."; retVal = false; } bool Q12check = !String.IsNullOrEmpty(GetValue(Q12_PostalCode, currentPage, String.Empty)); if (!Q12check) { Q12_PostalCode.MessageManager.ErrorMessage = "Please enter the first 3 digits of your Postal Code."; retVal = false; } bool Q13FirstNameCheck = !String.IsNullOrEmpty(GetValue(Q13_FirstName, currentPage, String.Empty)); if (!Q13FirstNameCheck) { Q13_FirstName.MessageManager.ErrorMessage = "Please enter your First Name."; retVal = false; } bool Q13LastNameCheck = !String.IsNullOrEmpty(GetValue(Q13_LastName, currentPage, String.Empty)); if (!Q13LastNameCheck) { Q13_LastName.MessageManager.ErrorMessage = "Please enter your Last Name."; retVal = false; } bool Q13EmailCheck = !String.IsNullOrEmpty(GetValue(Q13_Email, currentPage, String.Empty)); if (!Q13EmailCheck) { Q13_Email.MessageManager.ErrorMessage = "Please enter your Email Address."; retVal = false; } } if (currentPage) { SaveValue(Q9_Male); SaveValue(Q9_Female); SaveValue(Q10_19to24); SaveValue(Q10_25to34); SaveValue(Q10_35to44); SaveValue(Q10_45to54); SaveValue(Q10_55to64); SaveValue(Q10_65orOlder); SaveValue(Q11_35000); SaveValue(Q11_35000to59999); SaveValue(Q11_60000to89999); SaveValue(Q11_90000); SaveValue(Q11_NoSay); SaveValue(Q12_PostalCode); SaveValue(Q13_FirstName); SaveValue(Q13_LastName); SaveValue(Q13_Email); } break; #endregion Page 5 } return(retVal); }
/// <summary> /// Validates and saves a page's values. Returns true if the page is valid. /// </summary> /// <param name="page">The page ID to check.</param> /// <param name="currentPage">Whether this is the current page. If true, the values in the controls will be checked, otherwise the session will be checked.</param> /// <param name="saveOnly">If save only is true, the validation will be ignored and values will be saved so that they can be returned to. This is for use with the "Back" button.</param> protected bool ValidateAndSave(int page, bool currentPage, bool saveOnly) { bool retVal = true; switch (page) { case 1: #region Page 1 if (currentPage) { SurveyTools.SaveValue <string>(fbkEmail); SurveyTools.SaveValue <string>(fbkProperty); SurveyTools.SaveValue <string>(fbkDirectQuestion); if (IsStaffSurvey) { SurveyTools.SaveValue <string>(ddlStaffContact); } } string email = SurveyTools.GetValue(fbkEmail, currentPage, String.Empty); // 20180406 - OLD wants to make this email address optional //if (!Validation.RegExCheck(email, ValidationType.Email) // && !(String.IsNullOrWhiteSpace(email) && IsStaffSurvey)) //{ //Allow blanks on staff survey // mmTrackingEmail.ErrorMessage = "Please enter a valid email address."; // retVal = false; //} if (Master.PropertyShortCode == GCCPropertyShortCode.GCC && fbkProperty.SelectedIndex == 0) { fbkProperty.MessageManager.ErrorMessage = "Please indicate which property you are providing feedback for or select \"No Specific Property\"."; retVal = false; } if (fbkProperty.GetValue() == "1" && fbkDirectQuestion.SelectedIndex == 0) { fbkDirectQuestion.MessageManager.ErrorMessage = "Please select which area of operations you are providing feedback for."; retVal = false; } if (IsStaffSurvey && ddlStaffContact.SelectedIndex == 0) { ddlStaffContact.MessageManager.ErrorMessage = "Please indicate how the guest was contacted."; retVal = false; } break; #endregion Page 1 case 2: // Initial question #region Page 2 if (currentPage) { SurveyTools.SaveValue <string>(fbkQ1); if (AlignedPropertyShortCode == GCCPropertyShortCode.GAG) { SurveyTools.SaveRadioButtons(radGAG_Everett, radGAG_Lakewood, radGAG_Tukwila, radGAG_DeMoines); } } if (!saveOnly) { bool q3Check = (AlignedPropertyShortCode != GCCPropertyShortCode.GAG) || SurveyTools.GetValue(radGAG_Everett, currentPage, false) || SurveyTools.GetValue(radGAG_Lakewood, currentPage, false) || SurveyTools.GetValue(radGAG_Tukwila, currentPage, false) || SurveyTools.GetValue(radGAG_DeMoines, currentPage, false); if (!q3Check) { mmGAG.ErrorMessage = "Please select one of the following options."; retVal = false; } if (fbkQ1.SelectedIndex == 0) { fbkQ1.MessageManager.ErrorMessage = "Please select an answer."; retVal = false; } } break; #endregion Page 2 case 3: // Basic Form #region Page 3 if (currentPage) { SurveyTools.SaveValue <string>(fbkQ2); SurveyTools.SaveValue <string>(fbkQ3); SurveyTools.SaveValue <string>(fbkQ4); SurveyTools.SaveValue <string>(fbkQ5); } if (!saveOnly) { if (fbkQ2.SelectedIndex == 0) { fbkQ2.MessageManager.ErrorMessage = "Please select an answer."; retVal = false; } if (!SurveyTools.CheckForAnswer(fbkQ3, true)) { retVal = false; } if (!SurveyTools.CheckForAnswer(fbkQ4, false)) { retVal = false; } if (fbkQ5.SelectedIndex == 0) { fbkQ5.MessageManager.ErrorMessage = "Please select an answer."; retVal = false; } } break; #endregion Page 3 case 4: // Contact Info #region Page 4 if (!saveOnly && !fbkQ5.GetValue().Equals("I do not want to be contacted")) { //Check for phone or email validation depending on Q5 email = SurveyTools.GetValue(txtEmailContact, currentPage, String.Empty); if (fbkQ5.GetValue().Equals("By e-mail") && (String.IsNullOrEmpty(email) || !Validation.RegExCheck(email, ValidationType.Email))) { txtEmailContact.MessageManager.ErrorMessage = "Please enter a valid email address."; retVal = false; } if (fbkQ5.GetValue().Equals("By telephone") && !SurveyTools.CheckForAnswer(txtTelephoneNumber, true)) { retVal = false; } if (!SurveyTools.CheckForAnswer(txtName, true)) { retVal = false; } } if (currentPage) { SurveyTools.SaveValue <string>(txtName); SurveyTools.SaveValue <string>(txtTelephoneNumber); SurveyTools.SaveValue <string>(txtEmailContact); } break; #endregion Page 4 case 5: // Confirmation #region Page 5 break; #endregion Page 5 } return(retVal); }