Esempio n. 1
0
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest FormsHierarchyRequest)
        {
            FormsHierarchyResponse  FormsHierarchyResponse = new FormsHierarchyResponse();
            List <SurveyResponseBO> AllResponsesIDsList    = new List <SurveyResponseBO>();

            //1- Get All form  ID's
            Epi.Web.Interfaces.DataInterfaces.IDaoFactory    entityDaoFactory = new EF.EntityDaoFactory();
            Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao    = entityDaoFactory.SurveyInfoDao;
            Epi.Web.BLL.SurveyInfo Implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao);

            List <FormsHierarchyBO> RelatedFormIDsList = Implementation.GetFormsHierarchyIdsByRootId(FormsHierarchyRequest.SurveyInfo.SurveyId);

            FormsHierarchyResponse.FormsHierarchy = Mapper.ToFormHierarchyDTO(RelatedFormIDsList);

            //2- Get all Responses ID's

            //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao;
            //Epi.Web.BLL.SurveyResponse Implementation1 = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao);
            //if (!string.IsNullOrEmpty(FormsHierarchyRequest.SurveyResponseInfo.ResponseId))
            //{
            //    AllResponsesIDsList = Implementation1.GetResponsesHierarchyIdsByRootId(FormsHierarchyRequest.SurveyResponseInfo.ResponseId);

            //}
            //else
            //{
            //    AllResponsesIDsList = null;
            //}
            ////3 Combining the lists.

            //FormsHierarchyResponse.FormsHierarchy = Mapper.ToFormHierarchyDTO(CombineLists(RelatedFormIDsList, AllResponsesIDsList));

            return(FormsHierarchyResponse);
        }
Esempio n. 2
0
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest pRequest)
        {
            string SurveyId = pRequest.SurveyInfo.FormId;
            var    CacheObj = HttpRuntime.Cache.Get(SurveyId);
            FormsHierarchyResponse result = new FormsHierarchyResponse();


            if (CacheIsOn.ToUpper() == "TRUE")
            {
                if (CacheObj == null)
                {
                    result = (FormsHierarchyResponse)_iDataService.GetFormsHierarchy(pRequest);

                    if (IsCacheSlidingExpiration.ToUpper() == "TRUE")
                    {
                        HttpRuntime.Cache.Insert(SurveyId, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(CacheDuration));
                    }
                    else
                    {
                        HttpRuntime.Cache.Insert(SurveyId, result, null, DateTime.Now.AddMinutes(CacheDuration), Cache.NoSlidingExpiration);
                    }
                    return(result);
                }
                else
                {
                    return((FormsHierarchyResponse)CacheObj);
                }
            }
            else
            {
                result = (FormsHierarchyResponse)_iDataService.GetFormsHierarchy(pRequest);
                return(result);
            }
        }
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest pRequest)
        {
            try{
                string SurveyId = pRequest.SurveyInfo.FormId + "_Hierarchy";
                var    CacheObj = HttpRuntime.Cache.Get(SurveyId);
                FormsHierarchyResponse result = new FormsHierarchyResponse();


                if (CacheIsOn.ToUpper() == "TRUE")
                {
                    if (CacheObj == null)
                    {
                        result = (FormsHierarchyResponse)_iDataService.GetFormsHierarchy(pRequest);

                        if (IsCacheSlidingExpiration.ToUpper() == "TRUE")
                        {
                            HttpRuntime.Cache.Insert(SurveyId, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(CacheDuration));
                        }
                        else
                        {
                            HttpRuntime.Cache.Insert(SurveyId, result, null, DateTime.Now.AddMinutes(CacheDuration), Cache.NoSlidingExpiration);
                        }
                        return(result);
                    }
                    else
                    {
                        return((FormsHierarchyResponse)CacheObj);
                    }
                }
                else
                {
                    result = (FormsHierarchyResponse)_iDataService.GetFormsHierarchy(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 List <FormsHierarchyDTO> GetFormsHierarchy(string formId)
        {
            FormsHierarchyResponse formsHierarchyResponse = new FormsHierarchyResponse();
            FormsHierarchyRequest  formsHierarchyRequest  = new FormsHierarchyRequest();

            formsHierarchyRequest.SurveyInfo.FormId = formId;
            formsHierarchyResponse = _surveyFacade.GetFormsHierarchy(formsHierarchyRequest);

            return(formsHierarchyResponse.FormsHierarchy);
        }
        private List <FormsHierarchyDTO> GetFormsHierarchy(string formid)
        {
            FormsHierarchyResponse FormsHierarchyResponse = new FormsHierarchyResponse();
            FormsHierarchyRequest  FormsHierarchyRequest  = new FormsHierarchyRequest();

            FormsHierarchyRequest.SurveyInfo.FormId = formid;
            // FormsHierarchyRequest.SurveyResponseInfo.ResponseId = Session["RootResponseId"].ToString();
            FormsHierarchyResponse = _isurveyFacade.GetFormsHierarchy(FormsHierarchyRequest);

            return(FormsHierarchyResponse.FormsHierarchy);
        }
Esempio n. 6
0
        private List <FormsHierarchyDTO> GetFormsHierarchy()
        {
            FormsHierarchyResponse formsHierarchyResponse = new FormsHierarchyResponse();
            FormsHierarchyRequest  formsHierarchyRequest  = new FormsHierarchyRequest();
            string rootFormId     = GetStringSessionValue(UserSession.Key.RootFormId, defaultValue: null);
            string rootResponseId = GetStringSessionValue(UserSession.Key.RootResponseId, defaultValue: null);

            if (rootFormId != null && rootResponseId != null)
            {
                formsHierarchyRequest.SurveyInfo.FormId             = rootFormId;
                formsHierarchyRequest.SurveyResponseInfo.ResponseId = rootResponseId;
                formsHierarchyResponse = _surveyFacade.GetFormsHierarchy(formsHierarchyRequest);
            }
            return(formsHierarchyResponse.FormsHierarchy);
        }
Esempio n. 7
0
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest formsHierarchyRequest)
        {
            try
            {
                var rootFormId           = formsHierarchyRequest.SurveyInfo.FormId;
                var metadatAccessor      = new MetadataAccessor();
                var viewId               = metadatAccessor.GetFormDigest(rootFormId).ViewId;
                var formIdHierarchy      = metadatAccessor.GetFormIdHierarchyByRootFormId(rootFormId);
                var formDigests          = metadatAccessor.FormDigests.Where(fd => formIdHierarchy.Contains(fd.FormId)).ToArray();
                var formInfoDTO          = formsHierarchyRequest.SurveyInfo;
                var surveyInfoBO         = formInfoDTO.ToSurveyInfoBO(viewId);
                var formsHierarchyBOList = formDigests.ToFormsHierarchyBOList(surveyInfoBO);

                FormsHierarchyResponse formsHierarchyResponse = new FormsHierarchyResponse();

                List <SurveyResponseBO> allResponsesIDsList = new List <SurveyResponseBO>();

                //1- Get All form  ID's
                List <FormsHierarchyBO> relatedFormIDsList = _surveyInfoService.GetFormsHierarchyIdsByRootFormId(rootFormId);

                //2- Get all Responses ID's
                Epi.Cloud.DataEntryServices.SurveyResponseProvider surveyResponseProvider = new SurveyResponseProvider(_surveyResponseDao);
                if (!string.IsNullOrEmpty(formsHierarchyRequest.SurveyResponseInfo.ResponseId))
                {
                    IResponseContext responseContext = formsHierarchyRequest.SurveyResponseInfo.ResponseContext.ResolveMetadataDependencies();
                    allResponsesIDsList = surveyResponseProvider.GetResponsesHierarchyIdsByRootId(responseContext);
                }
                else
                {
                    allResponsesIDsList = null;
                }

                //3 Combining the lists.
                List <FormsHierarchyBO> combinedList = CombineLists(relatedFormIDsList, allResponsesIDsList);
                formsHierarchyResponse.FormsHierarchy = combinedList.ToFormsHierarchyDTOList();

                return(formsHierarchyResponse);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        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);
        }
Esempio n. 9
0
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest formsHierarchyRequest)
        {
            FormsHierarchyResponse FormsHierarchyResponse = _dataEntryService.GetFormsHierarchy(formsHierarchyRequest);

            return(FormsHierarchyResponse);
        }
Esempio n. 10
0
        public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest FormsHierarchyRequest)
        {
            FormsHierarchyResponse FormsHierarchyResponse = _iSurveyInfoRepository.GetFormsHierarchy(FormsHierarchyRequest);

            return(FormsHierarchyResponse);
        }