/// <summary> /// Surveys the did finish with result. /// </summary> /// <param name="survey">The survey.</param> /// <param name="result">The result.</param> public void SurveyDidFinishWithResult(UPSurvey survey, object result) { this.SurveyLoaded(); UPMQuestionnairePage page = (UPMQuestionnairePage)this.Page; page.QuestionnaireNotExists = false; }
/// <summary> /// Surveys the did fail with error. /// </summary> /// <param name="survey">The survey.</param> /// <param name="error">The error.</param> public void SurveyDidFailWithError(UPSurvey survey, Exception error) { UPMQuestionnairePage page = (UPMQuestionnairePage)this.Page; page.Status = null; page.QuestionnaireNotExists = true; this.InformAboutDidChangeTopLevelElement(this.Page, this.Page, null, null); }
/// <summary> /// Updateds the element for page. /// </summary> /// <param name="page">The page.</param> /// <returns></returns> public override UPMElement UpdatedElementForPage(Page page) { UPMQuestionnairePage newPage = (UPMQuestionnairePage)this.InstantiatePage(); newPage.Invalid = true; this.TopLevelElement = newPage; this.ApplyLoadingStatusOnPage((Page)this.TopLevelElement); if (this.Survey != null) { this.Survey.Load(); } else { this.FillPage(this.Page); } return(newPage); }
private void ProcessGroup(UPMQuestionnairePage page, int index, UPQuestionnaireQuestionGroup currentGroup) { if (page == null) { throw new ArgumentNullException(nameof(page)); } if (currentGroup == null) { throw new ArgumentNullException(nameof(currentGroup)); } bool firstQuestion = true; var questionnaireGroup = new UPMQuestionnaireGroup(StringIdentifier.IdentifierWithStringId($"group_{currentGroup.Label}")) { LabelText = currentGroup.Label }; page.AddGroup(questionnaireGroup); var questions = this.Survey.VisibleQuestionsForGroup(currentGroup); foreach (var currentQuestion in questions) { if (currentQuestion.Hide) { continue; } UPMEditField editField = null; IQuestionnaireEditFieldContext editFieldContext = null; UPQuestionnaireCatalogEditField catalogEditField = null; if (firstQuestion) { if (string.IsNullOrEmpty(questionnaireGroup.LabelText)) { questionnaireGroup.LabelText = currentQuestion.Label; } firstQuestion = false; } var fieldIdentifier = StringIdentifier.IdentifierWithStringId($"{currentQuestion.RecordIdentification}_{index}"); var surveyAnswer = this.Survey.SurveyAnswerForQuestion(currentQuestion); var answerIds = surveyAnswer.AnswerIds; bool multiSelect = currentQuestion.Multiple; var explicitKeyOrder = new List <string>(); CreateFields( currentQuestion, out editField, out editFieldContext, out catalogEditField, fieldIdentifier, multiSelect, explicitKeyOrder); if (editField != null) { ProcessEditField( questionnaireGroup, currentQuestion, editField, editFieldContext, catalogEditField, surveyAnswer.Answer, answerIds, multiSelect); } } }