/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartApplicationResponse response = new StartApplicationResponse();


            return response;
        }
Exemple #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartApplicationResponse response = new StartApplicationResponse();


            return(response);
        }
Exemple #3
0
        public async Task <IActionResult> StartApplication(PreviewViewModel previewViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(previewViewModel));
            }

            var applicationStartRequest = new StartApplicationRequest
            {
                UserReference   = UserReference,
                WorkflowType    = previewViewModel.ProjectType,
                ApplicationData = previewViewModel.ApplicationData
            };

            var qnaResponse = new StartApplicationResponse();

            try
            {
                qnaResponse = await _qnaApiClient.StartApplications(applicationStartRequest);
            }
            catch (HttpRequestException ex) {
                dynamic obj = JToken.Parse(ex.Message);
                if (obj.statusCode == "400")
                {
                    ModelState.AddModelError(nameof(previewViewModel.ApplicationData), (string)obj.message);
                    return(View(previewViewModel));
                }
            }

            if (_sessionService.Exists("viewPreviewData"))
            {
                _sessionService.Remove("viewPreviewData");
            }
            _sessionService.Set("viewPreviewData", JsonConvert.SerializeObject(previewViewModel));

            var allApplicationSequences = await _qnaApiClient.GetAllApplicationSequences(qnaResponse.ApplicationId);

            var sequenceNos = string.Join(',', allApplicationSequences.Select(x => x.SequenceNo));

            foreach (var _ in allApplicationSequences.Where(seq => seq.SequenceNo == previewViewModel.SequenceNo).Select(seq => new { }))
            {
                var sections = allApplicationSequences.Select(async sequence => await _qnaApiClient.GetSections(qnaResponse.ApplicationId, sequence.Id)).Select(t => t.Result).ToList();
                return(RedirectToAction("Sequence", new { Id = qnaResponse.ApplicationId, sequenceNo = previewViewModel.SequenceNo }));
            }

            ModelState.AddModelError(nameof(previewViewModel.SequenceNo), $"Sequence number not found. Valid sequences are: {sequenceNos}");
            return(View(previewViewModel));
        }
        public static StartApplicationResponse Unmarshall(UnmarshallerContext _ctx)
        {
            StartApplicationResponse startApplicationResponse = new StartApplicationResponse();

            startApplicationResponse.HttpResponse = _ctx.HttpResponse;
            startApplicationResponse.RequestId    = _ctx.StringValue("StartApplication.RequestId");
            startApplicationResponse.Code         = _ctx.StringValue("StartApplication.Code");
            startApplicationResponse.Success      = _ctx.BooleanValue("StartApplication.Success");
            startApplicationResponse.ErrorCode    = _ctx.StringValue("StartApplication.ErrorCode");
            startApplicationResponse.Message      = _ctx.StringValue("StartApplication.Message");
            startApplicationResponse.TraceId      = _ctx.StringValue("StartApplication.TraceId");

            StartApplicationResponse.StartApplication_Data data = new StartApplicationResponse.StartApplication_Data();
            data.ChangeOrderId            = _ctx.StringValue("StartApplication.Data.ChangeOrderId");
            startApplicationResponse.Data = data;

            return(startApplicationResponse);
        }
Exemple #5
0
 public void Handle(StartApplicationResponse message)
 {
     Data.ApplicationId     = message.ApplicationId;
     Data.StartAppCompleted = true;
     ProcessResponse(message);
 }