예제 #1
0
        public SurveyAnswerResponse UpdateResponseStatus(SurveyAnswerRequest surveyAnswerRequest)
        {
            SurveyAnswerResponse surveyAnswerResponse = new SurveyAnswerResponse();

            try
            {
                SurveyResponseProvider surveyResponseImplementation = new SurveyResponseProvider(_surveyResponseDao);

                var responseContext = surveyAnswerRequest.ResponseContext;
                List <SurveyResponseBO> surveyResponseBOList = surveyResponseImplementation.GetSurveyResponseById(responseContext, surveyAnswerRequest.Criteria);
                foreach (var surveyResponseBO in surveyResponseBOList)
                {
                    try
                    {
                        if (surveyAnswerRequest.IsChildResponse)
                        {
                            surveyResponseBO.ActiveChildResponseDetail = surveyResponseBO.ResponseDetail.FindFormResponseDetail(surveyAnswerRequest.ResponseId);
                        }
                        surveyResponseBO.IsNewRecord           = surveyAnswerRequest.IsNewRecord;
                        surveyResponseBO.UserOrgId             = surveyAnswerRequest.Criteria.UserOrganizationId;
                        surveyResponseBO.CurrentOrgId          = surveyAnswerRequest.Criteria.UserOrganizationId;
                        surveyResponseBO.UserId                = surveyAnswerRequest.Criteria.UserId;
                        surveyResponseBO.UserName              = surveyAnswerRequest.Criteria.UserName;
                        surveyResponseBO.LastSaveLogonName     = surveyAnswerRequest.Criteria.UserName;
                        surveyResponseBO.LastSaveTime          = DateTime.UtcNow;
                        surveyResponseBO.RecStatus             = surveyAnswerRequest.Criteria.StatusId;
                        surveyResponseBO.ReasonForStatusChange = surveyAnswerRequest.Criteria.StatusChangeReason;
                    }
                    finally
                    {
                        surveyResponseBO.ActiveChildResponseDetail = null;
                    }
                }

                List <SurveyResponseBO> resultList = surveyResponseImplementation.UpdateSurveyResponse(surveyResponseBOList, surveyAnswerRequest.Criteria.StatusId, surveyAnswerRequest.Criteria.StatusChangeReason);
                surveyAnswerResponse.SurveyResponseList = resultList.Select(bo => bo.ToSurveyAnswerDTO()).ToList();
                surveyAnswerResponse.NumberOfResponses  = surveyAnswerResponse.SurveyResponseList.Count();
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultException>(new CustomFaultException(ex));
            }
            return(surveyAnswerResponse);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public SurveyAnswerResponse GetSurveyAnswer(SurveyAnswerRequest request)
        {
            try
            {
                SurveyAnswerResponse result = new SurveyAnswerResponse(request.RequestId);
                Epi.Cloud.DataEntryServices.SurveyResponseProvider surveyResponseProvider = new SurveyResponseProvider(_surveyResponseDao);

                var responseContext = request.ResponseContext;
                var criteria        = request.Criteria as SurveyAnswerCriteria;
                List <SurveyResponseBO> surveyResponseList = surveyResponseProvider.GetSurveyResponseById(responseContext, request.Criteria);
                result.SurveyResponseList = surveyResponseList.ToSurveyAnswerDTOList();
                SurveyInfoBO surveyInfoBO = _surveyInfoService.GetSurveyInfoByFormId(request.FormId ?? request.RootFormId);
                result.FormInfo = surveyInfoBO.ToFormInfoDTO();

                return(result);
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultException>(new CustomFaultException(ex));
            }
        }