/// <summary> /// Checks the next has feedback. /// </summary> /// <returns><c>true</c>, if next has feedback, <c>false</c> otherwise.</returns> private bool CheckNextHasFeedback() { var nextQuestion = QuestionJsonDeserializer.GetNextQuestion(_currQuestionindex); if (nextQuestion != null) { var nextQId = nextQuestion.QId; var GivenNextFeedback = FeedbackCart.RatingNVC[nextQId]; if (GivenNextFeedback != null) { _nextHasPreviousFeedback = true; return(true); } else { _nextHasPreviousFeedback = false; return(false); } } return(false); }
private static QuestionsModel HandleDependancyQuestions(string currQIndex) { try { QuestionsModel currQuestion = QuestionJsonDeserializer.GetQuestion(currQIndex); QuestionsModel nextQuestion = QuestionJsonDeserializer.GetNextQuestion(currQIndex); var dependancyQNo = nextQuestion.DependantQNo; if (string.IsNullOrEmpty(dependancyQNo)) { return(QuestionJsonDeserializer.GetNextQuestion(currQIndex)); } QuestionsModel dependantParent = QuestionJsonDeserializer.GetQuestion(dependancyQNo); var dependancyQid = dependantParent.QId; var dependancyCriteria = nextQuestion.DependantQValue; var dependancyQType = dependantParent.QType; var dependancyQuestionRating = string.Empty; if (dependancyQType == null) { dependancyQuestionRating = FeedbackCart.RatingNVC[dependancyQid]; } else if (dependancyQType == "O") { dependancyQuestionRating = FeedbackCart.OtherNVC[dependancyQid]; } if (string.IsNullOrEmpty(dependancyQuestionRating) || dependancyQuestionRating == (-1).ToString()) { var afterSkippedQuestion = QuestionJsonDeserializer.SkipDependantQuestion(currQIndex); if (afterSkippedQuestion.DependantQNo != null) { return(HandleDependancyQuestions(nextQuestion.QNo)); } else { return(afterSkippedQuestion); } } if (dependancyCriteria.Contains(dependancyQuestionRating) || dependancyQuestionRating.Contains(dependancyCriteria)) { return(QuestionJsonDeserializer.GetNextQuestion(currQIndex)); } else { var afterSkippedQuestion = QuestionJsonDeserializer.SkipDependantQuestion(currQIndex); if (afterSkippedQuestion.DependantQNo != null) { return(HandleDependancyQuestions(nextQuestion.QNo)); } else { return(afterSkippedQuestion); } } } catch (Exception) { return(QuestionJsonDeserializer.SkipDependantQuestion(currQIndex)); } }