コード例 #1
0
        protected async Task OnSubmit()
        {
            var cmd      = new SurveyResponseSetSubmittedCmd(SurveyResponse.SurveyResponseId);
            var response = await SurveyResponseClient.CompleteResponse(cmd);

            UriHelper.NavigateTo($"/surveyresponseoverview/{SurveyResponse.SurveyResponseId}");
        }
コード例 #2
0
        protected async Task OnCancel()
        {
            var cmd      = new SurveyResponseSetCancelledCmd(SurveyResponse.SurveyResponseId);
            var response = await SurveyResponseClient.CancelResponse(cmd);

            UriHelper.NavigateTo($"/surveyresponseoverview/{SurveyResponse.SurveyResponseId}");
        }
コード例 #3
0
        async Task <bool> LoadForEditResponse(Guid responseId)
        {
            SurveyResponse = await SurveyResponseClient.GetResponse(responseId);

            CheckIsNotAlreadySubmitted();
            Load();
            return(true);
        }
コード例 #4
0
        async Task <bool> LoadQuestion(Guid responseId, Guid questionId)
        {
            SurveyResponse = await SurveyResponseClient.GetResponse(responseId);

            CheckIsNotAlreadySubmitted();
            Load();
            Response = SurveyResponse.ByQuestion(questionId);
            DoBindings();
            return(true);
        }
コード例 #5
0
        async Task <bool> LoadForAddResponse(Guid surveyId)
        {
            var cmd      = new SurveyResponseCreateCmd(surveyId);
            var response = await SurveyResponseClient.AddResponse(cmd);

            if (response.Result == CommandSubmitExecutionResult.OK)
            {
                SurveyResponse = response.EntityQry;
                Load();
            }
            Console.WriteLine($" Result - {response.Result}");
            return(true);
        }
コード例 #6
0
        protected override async Task OnParametersSetAsync()
        {
            if (Id != null)
            {
                _surveyId = Guid.Parse(Id);
                var survey = await SurveyClient.GetSurvey(_surveyId);

                SurveyName  = survey.Name;
                SurveyIntro = survey.Intro;
                var responses = await SurveyResponseClient.GetSurveyResponses(_surveyId);

                Responses = responses.ToList();
            }
        }
コード例 #7
0
        async Task <(bool, SurveyResponseDTO)> SaveRatingResponse()
        {
            //validation necessary - will always be in range of values?
            var cmd = new SurveyResponseRatingResponseCmd(SurveyResponse.SurveyResponseId,
                                                          Response.Question.QuestionId,
                                                          RatingAnswer);
            var response = await SurveyResponseClient.RatingResponse(cmd);

            if (response.Result == CommandSubmitExecutionResult.Fail)
            {
                ValidationMessage = response.Messages.FirstOrDefault();
                return(false, null);
            }
            return(true, response.EntityQry);
        }
コード例 #8
0
        async Task <(bool, SurveyResponseDTO)> SaveTextResponse()
        {
            if (string.IsNullOrWhiteSpace(TxtAnswer))
            {
                ValidationMessage = "Please answer text question";
                return(false, null);
            }
            var cmd      = new SurveyResponseTextResponseCmd(SurveyResponse.SurveyResponseId, Response.Question.QuestionId, TxtAnswer);
            var response = await SurveyResponseClient.TextResponse(cmd);

            if (response.Result == CommandSubmitExecutionResult.Fail)
            {
                ValidationMessage = response.Messages.FirstOrDefault();
                return(false, null);
            }
            return(true, response.EntityQry);
        }
コード例 #9
0
        async Task <(bool, SurveyResponseDTO)> SaveMultiChoiceResponse()
        {
            if (!MultiOptionAnswers.Any(n => n.Selected))
            {
                ValidationMessage = "Please select at least one response";
                return(false, null);
            }
            var cmd = new SurveyResponseMultiOptionResponseCmd(SurveyResponse.SurveyResponseId,
                                                               Response.Question.QuestionId,
                                                               MultiOptionAnswers.Where(n => n.Selected).Select(n => n.ChoiceId).ToArray());
            var response = await SurveyResponseClient.MultiOptionResponse(cmd);

            if (response.Result == CommandSubmitExecutionResult.Fail)
            {
                ValidationMessage = response.Messages.FirstOrDefault();
                return(false, null);
            }
            return(true, response.EntityQry);
        }
コード例 #10
0
        async Task <(bool, SurveyResponseDTO)> SaveSingleChoiceResponse()
        {
            if (SingleOptionAnswer == Guid.Empty)
            {
                ValidationMessage = "Please select a response";
                return(false, null);
            }
            var cmd = new SurveyResponseSingleOptionResponseCmd(SurveyResponse.SurveyResponseId,
                                                                Response.Question.QuestionId,
                                                                SingleOptionAnswer);
            var response = await SurveyResponseClient.SingleOptionResponse(cmd);

            if (response.Result == CommandSubmitExecutionResult.Fail)
            {
                ValidationMessage = response.Messages.FirstOrDefault();
                return(false, null);
            }
            return(true, response.EntityQry);
        }
コード例 #11
0
        protected override async Task OnParametersSetAsync()
        {
            var responseId = Guid.Parse(SurveyResponseId);

            SurveyResponse = await SurveyResponseClient.GetResponse(responseId);
        }