Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public SurveyAnswerResponse GetSurveyAnswer(SurveyAnswerRequest pRequest)
        {
            try
            {
                SurveyAnswerResponse result = new SurveyAnswerResponse(pRequest.RequestId);
                //Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao surveyInfoDao = new EF.EntitySurveyResponseDao();
                //Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(surveyInfoDao);

                Epi.Web.Interfaces.DataInterfaces.IDaoFactory        entityDaoFactory   = new EF.EntityDaoFactory();
                Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao;
                Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao     = entityDaoFactory.SurveyInfoDao;
                Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao);


                // Validate client tag, access token, and user credentials
                if (!ValidRequest(pRequest, result, Validate.All))
                {
                    return(result);
                }

                var    criteria = pRequest.Criteria as SurveyAnswerCriteria;
                string sort     = criteria.SortExpression;

                //if (request.LoadOptions.Contains("SurveyInfos"))
                //{
                //    IEnumerable<SurveyInfoDTO> SurveyInfos;
                //    if (!criteria.IncludeOrderStatistics)
                //    {
                //        SurveyInfos = Implementation.GetSurveyInfos(sort);
                //    }
                //    else
                //    {
                //        SurveyInfos = Implementation.GetSurveyInfosWithOrderStatistics(sort);
                //    }

                //    response.SurveyInfos = SurveyInfos.Select(c => Mapper.ToDataTransferObject(c)).ToList();
                //}

                //if (pRequest.LoadOptions.Contains("SurveyInfo"))
                //{
                List <SurveyResponseBO> List = Implementation.GetSurveyResponseById(pRequest.Criteria.SurveyAnswerIdList, pRequest.Criteria.UserPublishKey);
                result.SurveyResponseList = Mapper.ToDataTransferObject(List);
                //}

                return(result);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                throw new FaultException <CustomFaultException>(customFaultException);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the record for the current response (Step1: Saving Survey)
        /// </summary>
        /// <param name="ResponseId"></param>
        /// <returns></returns>
        public SurveyAnswerResponse GetSurveyAnswerResponse(string responseId, string FormId = "", int UserId = 0)
        {
            _surveyAnswerRequest.Criteria.SurveyAnswerIdList.Clear();
            _surveyAnswerRequest.Criteria.SurveyAnswerIdList.Add(responseId);
            _surveyAnswerRequest.Criteria.SurveyId = FormId;
            _surveyAnswerRequest.Criteria.UserId   = UserId;
            SurveyAnswerResponse surveyAnswerResponse = _iSurveyAnswerRepository.GetSurveyAnswer(_surveyAnswerRequest);

            return(surveyAnswerResponse);
        }
Exemplo n.º 3
0
        public void UpdateSurveyResponse(SurveyInfoModel surveyInfoModel, string responseId, MvcDynamicForms.Form form, Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, bool IsSubmited, bool IsSaved, int PageNumber)
        {
            // 1 Get the record for the current survey response
            // 2 update the current survey response and save the response

            //// 1 Get the record for the current survey response
            SurveyAnswerResponse surveyAnswerResponse = GetSurveyAnswerResponse(responseId);

            ///2 Update the current survey response and save it

            SurveyHelper.UpdateSurveyResponse(surveyInfoModel, form, _surveyAnswerRequest, _surveyResponseXML, _iSurveyAnswerRepository, surveyAnswerResponse, responseId, surveyAnswerDTO, IsSubmited, IsSaved, PageNumber);
        }
        /// <summary>
        /// Parses XML from the web survey
        /// </summary>
        /// <param name="result">The parsed results in dictionary format</param>
        private List <WebFieldData> ParseXML(SurveyAnswerResponse result)
        {
            List <WebFieldData> surveyResponses = new List <WebFieldData>();

            foreach (Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswer in result.SurveyResponseList)
            {
                WebFieldData wfData = new WebFieldData();

                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.LoadXml(surveyAnswer.XML);

                foreach (XmlElement docElement in doc.ChildNodes)
                {
                    if (docElement.Name.ToLowerInvariant().Equals("surveyresponse"))
                    {
                        foreach (XmlElement surveyElement in docElement.ChildNodes)
                        {
                            if (surveyElement.Name.ToLowerInvariant().Equals("page") && surveyElement.Attributes.Count > 0 && surveyElement.Attributes[0].Name.ToLowerInvariant().Equals("pageid"))
                            {
                                foreach (XmlElement pageElement in surveyElement.ChildNodes)
                                {
                                    if (pageElement.Name.ToLowerInvariant().Equals("responsedetail"))
                                    {
                                        string fieldName = string.Empty;
                                        if (pageElement.Attributes.Count > 0)
                                        {
                                            fieldName = pageElement.Attributes[0].Value;
                                        }
                                        object fieldValue = pageElement.InnerText;

                                        wfData            = new WebFieldData();
                                        wfData.RecordGUID = surveyAnswer.ResponseId;
                                        wfData.Page       = Convert.ToInt32(surveyElement.Attributes[0].Value);
                                        wfData.FieldName  = fieldName;
                                        wfData.FieldValue = fieldValue;
                                        wfData.Status     = surveyAnswer.Status;
                                        if (wfData.Status == 3)
                                        {
                                            surveyResponses.Add(wfData);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(surveyResponses);
        }
Exemplo n.º 5
0
        public SurveyAnswerResponse GetAncestorResponseIdsByChildId(SurveyAnswerRequest pRequest)
        {
            Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory();
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();

            Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao;
            Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao    = entityDaoFactory.SurveyInfoDao;
            Epi.Web.BLL.SurveyResponse Implementation       = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao);
            List <SurveyResponseBO>    SurveyResponseBOList = Implementation.GetAncestorResponseIdsByChildId(pRequest.Criteria.SurveyAnswerIdList[0]);

            SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList);

            return(SurveyAnswerResponse);
        }
Exemplo n.º 6
0
        public SurveyAnswerResponse GetSurveyAnswerHierarchy(SurveyAnswerRequest pRequest)
        {
            Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory();
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();

            Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao;
            Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao    = entityDaoFactory.SurveyInfoDao;
            Epi.Web.BLL.SurveyResponse Implementation       = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao);
            List <SurveyResponseBO>    SurveyResponseBOList = Implementation.GetResponsesHierarchyIdsByRootId(pRequest.SurveyAnswerList[0].ResponseId);

            SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList);

            return(SurveyAnswerResponse);
        }
        public ActionResult Delete(string ResponseId)
        {
            SurveyAnswerRequest SARequest = new SurveyAnswerRequest();

            SARequest.SurveyAnswerList.Add(new SurveyAnswerDTO()
            {
                ResponseId = ResponseId
            });
            string Id = Session["UserId"].ToString();

            SARequest.Criteria.UserId       = SurveyHelper.GetDecryptUserId(Id);
            SARequest.Criteria.IsSqlProject = (bool)Session["IsSqlProject"];
            SARequest.Criteria.SurveyId     = Session["RootFormId"].ToString();
            SurveyAnswerResponse SAResponse = _isurveyFacade.DeleteResponse(SARequest);

            return(Json(string.Empty));
        }
Exemplo n.º 8
0
        public ActionResult DeleteBranch(string ResponseId)//List<FormInfoModel> ModelList, string formid)
        {
            SurveyAnswerRequest surveyAnswerRequest = new SurveyAnswerRequest();

            surveyAnswerRequest.SurveyAnswerList.Add(new SurveyAnswerDTO()
            {
                ResponseId = ResponseId
            });
            surveyAnswerRequest.Criteria.UserId       = GetIntSessionValue(UserSession.Key.UserId);
            surveyAnswerRequest.Criteria.IsEditMode   = false;
            surveyAnswerRequest.Criteria.IsDeleteMode = false;
            surveyAnswerRequest.Criteria.IsSqlProject = GetBoolSessionValue(UserSession.Key.IsSqlProject);
            surveyAnswerRequest.Criteria.SurveyId     = GetStringSessionValue(UserSession.Key.RootFormId);
            SurveyAnswerResponse saResponse = _surveyFacade.DeleteResponse(surveyAnswerRequest);

            return(Json(string.Empty));
        }
        public void SetSurveyAnswerStatus(SurveyAnswerRequest pRequest)
        {
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();

            Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory        entityDaoFactory   = new EF.EntityDaoFactory();
            Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao;
            Epi.Web.BLL.SurveyResponse Implementation   = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao);
            List <SurveyResponseBO>    SurveyAnswerList = new List <SurveyResponseBO>();

            SurveyAnswerList = Implementation.GetResponsesHierarchyIdsByRootId(pRequest.Criteria.SurveyAnswerIdList[0].ToString());

            foreach (var response in SurveyAnswerList)
            {
                var obj = Mapper.ToBusinessObject(Mapper.ToDataTransferObject(response), pRequest.Criteria.UserId);
                obj.Status = pRequest.Criteria.StatusId;
                Implementation.UpdateRecordStatus(obj);
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public SurveyAnswerResponse GetFormResponseList(SurveyAnswerRequest surveyAnswerRequest)
        {
            try
            {
                SurveyAnswerResponse result = new SurveyAnswerResponse(surveyAnswerRequest.RequestId);

                SurveyResponseProvider surveyResponseImplementation = new SurveyResponseProvider(_surveyResponseDao);

                SurveyAnswerCriteria criteria = surveyAnswerRequest.Criteria;
                criteria.GridPageSize = AppSettings.GetIntValue(criteria.IsMobile ? AppSettings.Key.MobileResponsePageSize : AppSettings.Key.ResponsePageSize);

                ResponseGridQueryResultBO responseGridQueryResultBO = surveyResponseImplementation.GetFormResponseListByFormId(surveyAnswerRequest.ResponseContext, criteria);
                //Query The number of records
                result.NumberOfResponses        = responseGridQueryResultBO.NumberOfResponsesReturnedByQuery;
                result.NumberOfPages            = responseGridQueryResultBO.NumberOfPages;
                result.NumberOfResponsesPerPage = responseGridQueryResultBO.NumberOfResponsesPerPage;
                result.QuerySetToken            = responseGridQueryResultBO.QuerySetToken;

                var surveyResponseList = responseGridQueryResultBO.SurveyResponseBOList;
                result.SurveyResponseList = surveyResponseList.ToSurveyAnswerDTOList();

                surveyAnswerRequest.Criteria.FormResponseCount = result.NumberOfResponses;

                //Query The number of records
                //result.NumberOfPages = surveyResponseImplementation.GetNumberOfPages(surveyAnswerRequest.Criteria);

                //Get form info
                Epi.Cloud.BLL.FormInfo formInfoImplementation = new Epi.Cloud.BLL.FormInfo(_formInfoDao);
                var formInfoBO = formInfoImplementation.GetFormInfoByFormId(surveyAnswerRequest.Criteria.SurveyId, surveyAnswerRequest.Criteria.UserId);
                result.FormInfo = formInfoBO.ToFormInfoDTO();

                return(result);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                return(null);
            }
        }
        public ActionResult Delete(string responseId)
        {
            var rootFormId      = GetStringSessionValue(UserSession.Key.RootFormId);
            int userId          = GetIntSessionValue(UserSession.Key.UserId);
            int orgId           = GetIntSessionValue(UserSession.Key.CurrentOrgId);
            var responseContext = InitializeResponseContext(responseId: responseId) as ResponseContext;

            SurveyAnswerRequest surveyAnswerRequest = responseContext.ToSurveyAnswerRequest();

            surveyAnswerRequest.SurveyAnswerList.Add(responseContext.ToSurveyAnswerDTOLite());
            surveyAnswerRequest.Criteria.UserOrganizationId = orgId;
            surveyAnswerRequest.Criteria.UserId             = userId;
            surveyAnswerRequest.Criteria.IsSqlProject       = GetBoolSessionValue(UserSession.Key.IsSqlProject);
            surveyAnswerRequest.Criteria.SurveyId           = rootFormId;
            surveyAnswerRequest.Criteria.StatusChangeReason = RecordStatusChangeReason.DeleteResponse;
            surveyAnswerRequest.Action = RequestAction.Delete;
            SurveyAnswerResponse surveyAnswerResponse = _surveyFacade.DeleteResponse(surveyAnswerRequest);

            return(Json(string.Empty));
        }
Exemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public SurveyAnswerStateDTO GetSurveyAnswerState(SurveyAnswerRequest request)
        {
            try
            {
                SurveyAnswerResponse result = new SurveyAnswerResponse();

                SurveyResponseProvider surveyResponseImplementation = new SurveyResponseProvider(_surveyResponseDao);

                var responseContext = request.ResponseContext;
                int loggedInUserId  = request.UserId;
                SurveyResponseBO     surveyResponseBO     = surveyResponseImplementation.GetSurveyResponseStateById(responseContext);
                SurveyAnswerStateDTO surveyAnswerStateDTO = surveyResponseBO != null?surveyResponseBO.ToSurveyAnswerStateDTO(loggedInUserId) : null;

                return(surveyAnswerStateDTO);
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultException>(new CustomFaultException(ex));
            }
        }
Exemplo n.º 14
0
        private string GetChildRecordId(SurveyAnswerDTO surveyAnswerDTO)
        {
            SurveyAnswerRequest  SurveyAnswerRequest  = new SurveyAnswerRequest();
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();
            string ChildId = Guid.NewGuid().ToString();

            surveyAnswerDTO.ParentResponseId      = surveyAnswerDTO.ResponseId;
            surveyAnswerDTO.ResponseId            = ChildId;
            surveyAnswerDTO.Status                = RecordStatus.InProcess;
            surveyAnswerDTO.ReasonForStatusChange = RecordStatusChangeReason.CreateMulti;
            SurveyAnswerRequest.SurveyAnswerList.Add(surveyAnswerDTO);
            string result;

            //responseId = TempData[TempDataKeys.ResponseId].ToString();
            SurveyAnswerRequest.Criteria.UserId = GetIntSessionValue(UserSession.Key.UserId);
            SurveyAnswerRequest.RequestId       = ChildId;
            SurveyAnswerRequest.Action          = RequestAction.CreateMulti;
            SurveyAnswerResponse = _surveyFacade.SetChildRecord(SurveyAnswerRequest);
            result = SurveyAnswerResponse.SurveyResponseList[0].ResponseId.ToString();
            return(result);
        }
Exemplo n.º 15
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));
            }
        }
        /// <summary>
        /// Calling the proxy client to fetch a SurveyResponseResponse object
        /// </summary>
        /// <param name="surveyid"></param>
        /// <returns></returns>
        public SurveyAnswerResponse GetSurveyAnswer(SurveyAnswerRequest pRequest)
        {
            try
            {
                //SurveyResponseResponse result = Client.GetSurveyResponse(pRequest);
                //SurveyAnswerResponse result = _iDataService.GetSurveyAnswer(pRequest);

                SurveyAnswerResponse result = new SurveyAnswerResponse();
                if (!pRequest.Criteria.IsDownLoadFromApp)
                {
                    result = _iDataService.GetSurveyAnswer(pRequest);
                }
                else
                {
                    result = _iManagerService.GetSurveyAnswer(pRequest);
                }

                return(result);
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                throw cfe;
            }
            catch (FaultException fe)
            {
                throw fe;
            }
            catch (CommunicationException ce)
            {
                throw ce;
            }
            catch (TimeoutException te)
            {
                throw te;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private string GetChildRecordId(SurveyAnswerDTO surveyAnswerDTO)
        {
            SurveyAnswerRequest  SurveyAnswerRequest  = new SurveyAnswerRequest();
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();
            string ChildId = Guid.NewGuid().ToString();

            surveyAnswerDTO.ParentRecordId = surveyAnswerDTO.ResponseId;
            surveyAnswerDTO.ResponseId     = ChildId;
            surveyAnswerDTO.Status         = 1;
            SurveyAnswerRequest.SurveyAnswerList.Add(surveyAnswerDTO);
            string result;

            //responseId = TempData[Epi.Web.MVC.Constants.Constant.RESPONSE_ID].ToString();
            string Id = Session["UserId"].ToString();

            SurveyAnswerRequest.Criteria.UserId = SurveyHelper.GetDecryptUserId(Id);//_UserId;
            SurveyAnswerRequest.RequestId       = ChildId;
            SurveyAnswerRequest.Action          = "CreateMulti";
            SurveyAnswerResponse = _isurveyFacade.SetChildRecord(SurveyAnswerRequest);
            result = SurveyAnswerResponse.SurveyResponseList[0].ResponseId.ToString();
            return(result);
        }
        private List <FormsHierarchyDTO> GetFormsHierarchy(string responseId)
        {
            FormsHierarchyResponse FormsHierarchyResponse       = new FormsHierarchyResponse();
            FormsHierarchyRequest  FormsHierarchyRequest        = new FormsHierarchyRequest();
            SurveyAnswerRequest    ResponseIDsHierarchyRequest  = new SurveyAnswerRequest();
            SurveyAnswerResponse   ResponseIDsHierarchyResponse = new SurveyAnswerResponse();

            // FormsHierarchyRequest FormsHierarchyRequest = new FormsHierarchyRequest();
            if (Session["RootFormId"] != null && responseId != null)
            {
                FormsHierarchyRequest.SurveyInfo.SurveyId           = Session["RootFormId"].ToString();
                FormsHierarchyRequest.SurveyResponseInfo.ResponseId = responseId.ToString();
                FormsHierarchyResponse = _isurveyFacade.GetFormsHierarchy(FormsHierarchyRequest);

                SurveyAnswerDTO SurveyAnswerDTO = new SurveyAnswerDTO();
                SurveyAnswerDTO.ResponseId = responseId.ToString();
                ResponseIDsHierarchyRequest.SurveyAnswerList.Add(SurveyAnswerDTO);
                ResponseIDsHierarchyResponse          = _isurveyFacade.GetSurveyAnswerHierarchy(ResponseIDsHierarchyRequest);
                FormsHierarchyResponse.FormsHierarchy = CombineLists(FormsHierarchyResponse.FormsHierarchy, ResponseIDsHierarchyResponse.SurveyResponseList);
            }

            return(FormsHierarchyResponse.FormsHierarchy);
        }
Exemplo n.º 19
0
        public SurveyAnswerResponse GetResponsesByRelatedFormId(SurveyAnswerRequest pRequest)
        {
            Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory();
            SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse();

            Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao;
            Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao    = entityDaoFactory.SurveyInfoDao;
            Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao);

            //List<SurveyResponseBO> SurveyResponseBOList = Implementation.GetResponsesByRelatedFormId(pRequest.Criteria.SurveyAnswerIdList[0], pRequest.Criteria.SurveyId);

            List <SurveyResponseBO> SurveyResponseBOList = Implementation.GetResponsesByRelatedFormId(pRequest.Criteria.SurveyAnswerIdList[0], pRequest.Criteria);

            SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList);
            //Query The number of records

            //SurveyAnswerResponse.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria.SurveyId, pRequest.Criteria.IsMobile);
            //SurveyAnswerResponse.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria);

            //SurveyAnswerResponse.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria);
            //SurveyAnswerResponse.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria);

            return(SurveyAnswerResponse);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Parses XML from the web survey
        /// </summary>
        /// <param name="result">The parsed results in dictionary format</param>
        private Dictionary<string, Dictionary<string, WebFieldData>> ParseXML(SurveyAnswerResponse pSurveyAnswer)
        {
            Dictionary<string, Dictionary<string, WebFieldData>> result = new Dictionary<string, Dictionary<string, WebFieldData>>(StringComparer.OrdinalIgnoreCase);
            SetFilterProperties(DownLoadType);

            foreach (Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswer in pSurveyAnswer.SurveyResponseList)
            {
                if (SurveyStatus == 0)
                {
                    if ((surveyAnswer.IsDraftMode == IsDraftMode))
                    {
                        AddSurveyAnswerResult(result, surveyAnswer);
                    }
                }
                else
                {
                    if ((surveyAnswer.IsDraftMode == IsDraftMode) && (surveyAnswer.Status == SurveyStatus))
                    {
                        AddSurveyAnswerResult(result, surveyAnswer);
                    }
                }
            }

            return result;
        }
Exemplo n.º 21
0
        public SurveyAnswerResponse GetSurveyAnswerHierarchy(SurveyAnswerRequest pRequest)
        {
            SurveyAnswerResponse SurveyAnswerResponse = _iSurveyAnswerRepository.GetSurveyAnswerHierarchy(pRequest);

            return(SurveyAnswerResponse);
        }
Exemplo n.º 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public SurveyAnswerResponse GetFormResponseList(SurveyAnswerRequest pRequest)
        {
            try
            {
                SurveyAnswerResponse result = new SurveyAnswerResponse(pRequest.RequestId);


                Epi.Web.Interfaces.DataInterfaces.IDaoFactory        entityDaoFactory   = new EF.EntityDaoFactory();
                Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao;
                Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao     = entityDaoFactory.SurveyInfoDao;
                Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao);

                SurveyAnswerCriteria criteria = pRequest.Criteria;
                //result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetFormResponseListById(pRequest.Criteria.SurveyId, pRequest.Criteria.PageNumber, pRequest.Criteria.IsMobile));
                result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetFormResponseListById(criteria));//Pain point
                //Query The number of records

                //result.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria.SurveyId, pRequest.Criteria.IsMobile);
                //result.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria.SurveyId);

                result.NumberOfPages     = Implementation.GetNumberOfPages(pRequest.Criteria);
                result.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria);

                //Get form info
                //Interfaces.DataInterface.IFormInfoDao surveyInfoDao = new EF.EntityFormInfoDao();
                //Epi.Web.BLL.FormInfo ImplementationFormInfo = new Epi.Web.BLL.FormInfo(surveyInfoDao);
                //result.FormInfo = Mapper.ToFormInfoDTO(ImplementationFormInfo.GetFormInfoByFormId(pRequest.Criteria.SurveyId, false, pRequest.Criteria.UserId));


                SurveyInfoResponse response = new SurveyInfoResponse(pRequest.RequestId);


                Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao;
                Epi.Web.BLL.SurveyInfo surveyInfo = new Epi.Web.BLL.SurveyInfo(surveyInfoDao);

                if (!ValidRequest(pRequest, response, Validate.All))
                {
                    return(result);
                }


                List <string> SurveyIdList = new List <string>();

                SurveyIdList.Add(pRequest.Criteria.SurveyId.ToUpper());

                List <SurveyInfoBO> bo = surveyInfo.GetSurveyInfoById(SurveyIdList);

                result.SurveyInfo = Mapper.ToDataTransferObject(bo)[0];



                return(result);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                throw new FaultException <CustomFaultException>(customFaultException);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Set (add, update, delete) SurveyInfo value.
        /// </summary>
        /// <param name="request">SurveyResponse request message.</param>
        /// <returns>SurveyResponse response message.</returns>
        public SurveyAnswerResponse SetSurveyAnswer(SurveyAnswerRequest request)
        {
            try
            {
                Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = new EF.EntitySurveyResponseDao();
                Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao     ISurveyInfoDao    = new EF.EntitySurveyInfoDao();

                Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao);


                SurveyAnswerResponse response = new SurveyAnswerResponse(request.RequestId);

                // Validate client tag, access token, and user credentials
                if (!ValidRequest(request, response, Validate.All))
                {
                    return(response);
                }

                // Transform SurveyResponse data transfer object to SurveyResponse business object
                SurveyResponseBO SurveyResponse = Mapper.ToBusinessObject(request.SurveyAnswerList)[0];

                // Validate SurveyResponse business rules

                if (request.Action != "Delete")
                {
                    //if (!SurveyResponse.Validate())
                    //{
                    //    response.Acknowledge = AcknowledgeType.Failure;

                    //    foreach (string error in SurveyResponse.ValidationErrors)
                    //        response.Message += error + Environment.NewLine;

                    //    return response;
                    //}
                }

                // Run within the context of a database transaction. Currently commented out.
                // The Decorator Design Pattern.
                //using (TransactionDecorator transaction = new TransactionDecorator())
                {
                    if (request.Action.Equals("Create", StringComparison.OrdinalIgnoreCase))
                    {
                        Implementation.InsertSurveyResponse(SurveyResponse);
                        response.SurveyResponseList.Add(Mapper.ToDataTransferObject(SurveyResponse));
                    }
                    else if (request.Action.Equals("CreateChild", StringComparison.OrdinalIgnoreCase))
                    {
                        Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao SurveyInfoDao = new EF.EntitySurveyInfoDao();
                        Epi.Web.BLL.SurveyInfo Implementation1 = new Epi.Web.BLL.SurveyInfo(SurveyInfoDao);
                        SurveyInfoBO           SurveyInfoBO    = Implementation1.GetParentInfoByChildId(SurveyResponse.SurveyId);

                        Implementation.InsertChildSurveyResponse(SurveyResponse, SurveyInfoBO, request.SurveyAnswerList[0].RelateParentId);
                        response.SurveyResponseList.Add(Mapper.ToDataTransferObject(SurveyResponse));

                        List <SurveyResponseBO> List = new List <SurveyResponseBO>();
                        List.Add(SurveyResponse);
                        Implementation.InsertSurveyResponse(List, request.Criteria.UserId, true);
                    }
                    else if (request.Action.Equals("Update", StringComparison.OrdinalIgnoreCase))
                    {
                        Implementation.UpdateSurveyResponse(SurveyResponse);
                        response.SurveyResponseList.Add(Mapper.ToDataTransferObject(SurveyResponse));
                    }
                    else if (request.Action.Equals("Delete", StringComparison.OrdinalIgnoreCase))
                    {
                        var criteria = request.Criteria as SurveyAnswerCriteria;
                        var survey   = Implementation.GetSurveyResponseById(new List <string> {
                            SurveyResponse.SurveyId
                        }, SurveyResponse.UserPublishKey);

                        foreach (SurveyResponseBO surveyResponse in survey)
                        {
                            try
                            {
                                if (Implementation.DeleteSurveyResponse(surveyResponse))
                                {
                                    response.RowsAffected += 1;
                                }
                            }
                            catch
                            {
                                //response.RowsAffected = 0;
                            }
                        }
                    }
                }

                return(response);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                throw new FaultException <CustomFaultException>(customFaultException);
            }
        }
        public FormResponseInfoModel GetFormResponseInfoModel(string SurveyId, int PageNumber, string sort = "", string sortfield = "", int orgid = -1)
        {
            int UserId = SurveyHelper.GetDecryptUserId(Session["UserId"].ToString());
            FormResponseInfoModel FormResponseInfoModel = new FormResponseInfoModel();

            FormResponseInfoModel.SearchModel = new SearchBoxModel();
            SurveyResponseXML SurveyResponseXML = new SurveyResponseXML();

            if (!string.IsNullOrEmpty(SurveyId))
            {
                SurveyAnswerRequest FormResponseReq = new SurveyAnswerRequest();
                FormSettingRequest  FormSettingReq  = new Enter.Common.Message.FormSettingRequest();

                //Populating the request

                FormSettingReq.FormInfo.FormId = SurveyId;
                FormSettingReq.FormInfo.UserId = UserId;
                //Getting Column Name  List
                FormSettingReq.CurrentOrgId = orgid;
                FormSettingReq.FormInfoOnly = true;
                FormSettingResponse FormSettingResponse = _isurveyFacade.GetFormSettings(FormSettingReq);   //Pain Point
                Columns = FormSettingResponse.FormSetting.ColumnNameList.ToList();
                Columns.Sort(Compare);

                // Setting  Column Name  List
                FormResponseInfoModel.Columns = Columns;

                FormResponseInfoModel.FormInfoModel.IsShared    = FormSettingResponse.FormInfo.IsShared;
                FormResponseInfoModel.FormInfoModel.IsShareable = FormSettingResponse.FormInfo.IsShareable;
                // Set User Role
                //if (FormResponseInfoModel.FormInfoModel.IsShared)
                //{

                //    SetUserRole(UserId, orgid);
                //}
                //else
                //{
                //SetUserRole(UserId, FormSettingResponse.FormInfo.OrganizationId);
                //}
                SetUserRole(UserId, orgid);

                FormResponseReq.Criteria.SurveyId           = SurveyId.ToString();
                FormResponseReq.Criteria.PageNumber         = PageNumber;
                FormResponseReq.Criteria.UserId             = UserId;
                FormResponseReq.Criteria.IsSqlProject       = FormSettingResponse.FormInfo.IsSQLProject;
                FormResponseReq.Criteria.IsShareable        = FormSettingResponse.FormInfo.IsShareable;
                FormResponseReq.Criteria.UserOrganizationId = orgid;
                Session["IsSqlProject"] = FormSettingResponse.FormInfo.IsSQLProject;
                Session["IsOwner"]      = FormSettingResponse.FormInfo.IsOwner;
                //if (Session["SearchCriteria"] != null)
                //{
                //    FormResponseInfoModel.SearchModel = (SearchBoxModel)Session["SearchCriteria"];
                //}
                // Following code retain search starts
                if (Session["SearchCriteria"] != null &&
                    !string.IsNullOrEmpty(Session["SearchCriteria"].ToString()) &&
                    (Request.QueryString["col1"] == null || Request.QueryString["col1"] == "undefined"))
                {
                    FormResponseReq.Criteria.SearchCriteria = Session["SearchCriteria"].ToString();
                    FormResponseInfoModel.SearchModel       = (SearchBoxModel)Session["SearchModel"];
                }
                else
                {
                    FormResponseReq.Criteria.SearchCriteria = CreateSearchCriteria(Request.QueryString, FormResponseInfoModel.SearchModel, FormResponseInfoModel);
                    Session["SearchModel"]    = FormResponseInfoModel.SearchModel;
                    Session["SearchCriteria"] = FormResponseReq.Criteria.SearchCriteria;
                }
                // Following code retain search ends
                PopulateDropDownlists(FormResponseInfoModel, FormSettingResponse.FormSetting.FormControlNameList.ToList());

                if (sort.Length > 0)
                {
                    FormResponseReq.Criteria.SortOrder = sort;
                }
                if (sortfield.Length > 0)
                {
                    FormResponseReq.Criteria.Sortfield = sortfield;
                }


                SurveyAnswerResponse FormResponseList = _isurveyFacade.GetFormResponseList(FormResponseReq);//Pain Point


                //var ResponseTableList ; //= FormSettingResponse.FormSetting.DataRows;
                //Setting Resposes List
                List <ResponseModel> ResponseList = new List <ResponseModel>();
                foreach (var item in FormResponseList.SurveyResponseList)
                {
                    if (item.SqlData != null)
                    {
                        ResponseList.Add(ConvertRowToModel(item, Columns));
                    }
                    else
                    {
                        ResponseList.Add(SurveyResponseXML.ConvertXMLToModel(item, Columns));
                    }
                }


                //foreach (var item in FormResponseList.SurveyResponseList)
                //{
                //    ResponseList.Add(SurveyResponseXML.ConvertXMLToModel(item, Columns));
                //}

                FormResponseInfoModel.ResponsesList = ResponseList;
                //Setting Form Info
                FormResponseInfoModel.FormInfoModel = Mapper.ToFormInfoModel(FormResponseList.FormInfo);
                //Setting Additional Data

                FormResponseInfoModel.NumberOfPages     = FormResponseList.NumberOfPages;
                FormResponseInfoModel.PageSize          = ReadPageSize();
                FormResponseInfoModel.NumberOfResponses = FormResponseList.NumberOfResponses;
                FormResponseInfoModel.sortfield         = sortfield;
                FormResponseInfoModel.sortOrder         = sort;
                FormResponseInfoModel.CurrentPage       = PageNumber;
            }
            return(FormResponseInfoModel);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Parses XML from the web survey
        /// </summary>
        /// <param name="result">The parsed results in dictionary format</param>
        private int ParseXMLForProgressBar(SurveyAnswerResponse result)
        {
            int count = 0;

            foreach (Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswer in result.SurveyResponseList)
            {
                WebFieldData wfData = new WebFieldData();

                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.LoadXml(surveyAnswer.XML);

                foreach (XmlElement docElement in doc.ChildNodes)
                {
                    if (docElement.Name.ToLower().Equals("surveyresponse"))
                    {
                        foreach (XmlElement surveyElement in docElement.ChildNodes)
                        {
                            if (surveyElement.Name.ToLower().Equals("page") && surveyElement.Attributes.Count > 0 && surveyElement.Attributes[0].Name.ToLower().Equals("pagenumber"))
                            {
                                foreach (XmlElement pageElement in surveyElement.ChildNodes)
                                {
                                    if (pageElement.Name.ToLower().Equals("responsedetail"))
                                    {
                                        if (wfData.Status == 3)
                                        {
                                            count++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return count;
        }
Exemplo n.º 26
0
        public static void UpdateSurveyResponse(SurveyInfoModel surveyInfoModel, MvcDynamicForms.Form form, SurveyAnswerRequest surveyAnswerRequest,
                                                SurveyResponseXML surveyResponseXML,
                                                ISurveyAnswerRepository iSurveyAnswerRepository,
                                                SurveyAnswerResponse surveyAnswerResponse, string responseId, Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, bool IsSubmited, bool IsSaved, int PageNumber, int UserId = -1)
        {
            // 1 Get the record for the current survey response
            // 2 update the current survey response
            // 3 save the current survey response
            if (!IsSubmited)
            {
                // 2 a. update the current survey answer request
                surveyAnswerRequest.SurveyAnswerList = surveyAnswerResponse.SurveyResponseList;

                surveyResponseXML.Add(form);
                XDocument SavedXml = XDocument.Parse(surveyAnswerDTO.XML);
                bool      AddRoot  = false;
                if (SavedXml.Root.FirstAttribute.Value.ToString() == "0")
                {
                    AddRoot = true;
                }
                surveyAnswerRequest.SurveyAnswerList[0].XML = surveyResponseXML.CreateResponseXml(surveyInfoModel.SurveyId, AddRoot, form.CurrentPage, form.PageId).InnerXml;
                // 2 b. save the current survey response
                surveyAnswerRequest.Action = Epi.Web.MVC.Constants.Constant.UPDATE;  //"Update";
                //Append to Response Xml

                XDocument CurrentPageResponseXml = XDocument.Parse(surveyAnswerRequest.SurveyAnswerList[0].XML);
                if (SavedXml.Root.FirstAttribute.Value.ToString() != "0")
                {
                    surveyAnswerRequest.SurveyAnswerList[0].XML = MergeXml(SavedXml, CurrentPageResponseXml, form.CurrentPage).ToString();
                }
            }
            ////Update page number before saving response XML

            XDocument Xdoc = XDocument.Parse(surveyAnswerRequest.SurveyAnswerList[0].XML);

            if (PageNumber != 0)
            {
                Xdoc.Root.Attribute("LastPageVisited").Value = PageNumber.ToString();
            }
            ////Update Hidden Fields List before saving response XML
            if (form.HiddenFieldsList != null)
            {
                Xdoc.Root.Attribute("HiddenFieldsList").Value = "";
                Xdoc.Root.Attribute("HiddenFieldsList").Value = form.HiddenFieldsList.ToString();
            }
            if (form.HighlightedFieldsList != null)
            {
                Xdoc.Root.Attribute("HighlightedFieldsList").Value = "";
                Xdoc.Root.Attribute("HighlightedFieldsList").Value = form.HighlightedFieldsList.ToString();
            }
            if (form.DisabledFieldsList != null)
            {
                Xdoc.Root.Attribute("DisabledFieldsList").Value = "";
                Xdoc.Root.Attribute("DisabledFieldsList").Value = form.DisabledFieldsList.ToString();
            }
            if (form.RequiredFieldsList != null)
            {
                Xdoc.Root.Attribute("RequiredFieldsList").Value = "";
                Xdoc.Root.Attribute("RequiredFieldsList").Value = form.RequiredFieldsList.ToString();
            }
            if (surveyAnswerDTO.RecordBeforeFlag)
            {
                Xdoc.Root.Attribute("RecordBeforeFlag").Value = "True";
            }
            //  AssignList
            List <KeyValuePair <string, String> > FieldsList = new List <KeyValuePair <string, string> >();

            FieldsList = GetHiddenFieldsList(form);
            if (FieldsList != null)
            {
                IEnumerable <XElement> XElementList = Xdoc.XPathSelectElements("SurveyResponse/Page/ResponseDetail");
                for (var i = 0; i < FieldsList.Count; i++)
                {
                    foreach (XElement Element in XElementList)
                    {
                        if (Element.Attribute("QuestionName").Value.ToString().Equals(FieldsList[i].Key, StringComparison.OrdinalIgnoreCase))
                        {
                            if (FieldsList[i].Value != null)
                            {
                                Element.Value = FieldsList[i].Value;
                            }
                            break;
                        }
                    }
                }
            }



            ////Update survey response Status
            if (IsSubmited)
            {
                surveyAnswerRequest.SurveyAnswerList[0].Status        = 3;
                surveyAnswerRequest.SurveyAnswerList[0].DateCompleted = DateTime.Now;
                surveyAnswerRequest.SurveyAnswerList[0].Json          = surveyAnswerResponse.SurveyResponseList[0].Json;
                // Xdoc.Root.Attribute("LastPageVisited").Remove();
                // Xdoc.Root.Attribute("HiddenFieldsList").Remove();
                // Xdoc.Root.Attribute("HighlightedFieldsList").Remove();
                //Xdoc.Root.Attribute("DisabledFieldsList").Remove();
                //Xdoc.Root.Attribute("RequiredFieldsList").Remove();
                //   Xdoc.Root.Attribute("RecordBeforeFlag").Remove();
                //RemovePageNumAtt(Xdoc);
            }
            if (IsSaved)
            {
                surveyAnswerRequest.SurveyAnswerList[0].Status = 2;
            }
            surveyAnswerRequest.SurveyAnswerList[0].XML = Xdoc.ToString();
            /////Update Survey Mode ////////////////////
            surveyAnswerRequest.SurveyAnswerList[0].IsDraftMode = surveyAnswerDTO.IsDraftMode;
            iSurveyAnswerRepository.SaveSurveyAnswer(surveyAnswerRequest);
        }
Exemplo n.º 27
0
        public SurveyAnswerResponse GetFormResponseList(SurveyAnswerRequest surveyAnswerRequest)
        {
            SurveyAnswerResponse FormResponseList = _dataEntryService.GetFormResponseList(surveyAnswerRequest);

            return(FormResponseList);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Parses XML from the web survey
        /// </summary>
        /// <param name="result">The parsed results in dictionary format</param>
        private List<WebFieldData> ParseXML(SurveyAnswerResponse result)
        {
            List<WebFieldData> surveyResponses = new List<WebFieldData>();

            foreach (Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswer in result.SurveyResponseList)
            {
                WebFieldData wfData = new WebFieldData();

                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.LoadXml(surveyAnswer.XML);

                foreach (XmlElement docElement in doc.ChildNodes)
                {
                    if (docElement.Name.ToLower().Equals("surveyresponse"))
                    {
                        foreach (XmlElement surveyElement in docElement.ChildNodes)
                        {
                            if (surveyElement.Name.ToLower().Equals("page") && surveyElement.Attributes.Count > 0 && surveyElement.Attributes[0].Name.ToLower().Equals("pageid"))
                            {
                                foreach (XmlElement pageElement in surveyElement.ChildNodes)
                                {
                                    if (pageElement.Name.ToLower().Equals("responsedetail"))
                                    {
                                        string fieldName = string.Empty;
                                        if (pageElement.Attributes.Count > 0)
                                        {
                                            fieldName = pageElement.Attributes[0].Value;
                                        }
                                        object fieldValue = pageElement.InnerText;

                                        wfData = new WebFieldData();
                                        wfData.RecordGUID = surveyAnswer.ResponseId;
                                        wfData.Page = Convert.ToInt32(surveyElement.Attributes[0].Value);
                                        wfData.FieldName = fieldName;
                                        wfData.FieldValue = fieldValue;
                                        wfData.Status = surveyAnswer.Status;
                                        if (wfData.Status == 3)
                                        {
                                            surveyResponses.Add(wfData);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return surveyResponses;
        }
Exemplo n.º 29
0
        public SurveyAnswerResponse SetChildRecord(SurveyAnswerRequest surveyAnswerRequest)
        {
            SurveyAnswerResponse Response = new SurveyAnswerResponse();

            return(Response);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Get the record for the current response (Step1: Saving Survey)
        /// </summary>
        /// <param name="ResponseId"></param>
        /// <returns></returns>
        public SurveyAnswerDTO GetSurveyAnswerDTO(SurveyAnswerRequest surveyAnswerRequest)
        {
            SurveyAnswerResponse surveyAnswerResponse = _dataEntryService.GetSurveyAnswer(surveyAnswerRequest);

            return(surveyAnswerResponse.SurveyResponseList[0]);
        }
Exemplo n.º 31
0
        public SurveyAnswerResponse DeleteResponse(SurveyAnswerRequest sARequest)
        {
            SurveyAnswerResponse Response = new SurveyAnswerResponse();

            return(Response);
        }
Exemplo n.º 32
0
        public SurveyAnswerResponse SetChildRecord(SurveyAnswerRequest surveyAnswerRequest)
        {
            SurveyAnswerResponse SurveyAnswerResponse = _dataEntryService.SetSurveyAnswer(surveyAnswerRequest);

            return(SurveyAnswerResponse);
        }
Exemplo n.º 33
0
        public SurveyAnswerResponse GetResponsesByRelatedFormId(SurveyAnswerRequest formResponseReq)
        {
            SurveyAnswerResponse Response = new SurveyAnswerResponse();

            return(Response);
        }