/// <summary> /// Calling the proxy client to fetch a SurveyInfoResponse object /// </summary> /// <param name="surveyid"></param> /// <returns></returns> public SurveyInfoResponse GetSurveyInfo(SurveyInfoRequest pRequest) { try { //SurveyInfoResponse result = Client.GetSurveyInfo(pRequest); //SurveyInfoResponse result = _iDataService.GetSurveyInfo(pRequest); SurveyInfoResponse result = null; string SurveyId = pRequest.Criteria.SurveyIdList[0].ToString(); var CacheObj = HttpRuntime.Cache.Get(SurveyId); int CacheDuration = 0; int.TryParse(ConfigurationManager.AppSettings["CACHE_DURATION"].ToString(), out CacheDuration); string CacheIsOn = ConfigurationManager.AppSettings["CACHE_IS_ON"];//false; string IsCacheSlidingExpiration = ConfigurationManager.AppSettings["CACHE_SLIDING_EXPIRATION"].ToString(); if (CacheIsOn.ToUpper() == "TRUE") { if (CacheObj == null) { result = (SurveyInfoResponse)_iDataService.GetSurveyInfo(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((SurveyInfoResponse)CacheObj); } } else { result = (SurveyInfoResponse)_iDataService.GetSurveyInfo(pRequest); return(result); } // 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; } }
public SurveyInfoResponse GetFormChildInfo(SurveyInfoRequest SurveyInfoRequest) { return(_iDataService.GetFormChildInfo(SurveyInfoRequest)); }
public SurveyInfoResponse GetChildFormInfo(SurveyInfoRequest SurveyInfoRequest) { SurveyInfoResponse SurveyInfoResponse = _iSurveyInfoRepository.GetFormChildInfo(SurveyInfoRequest); return(SurveyInfoResponse); }
/// <summary> /// get the survey form data /// </summary> /// <param name="surveyId"></param> /// <param name="responseId"></param> /// <param name="pageNumber"></param> /// <param name="surveyAnswerDTO"></param> /// <returns></returns> public MvcDynamicForms.Form GetSurveyFormData( string surveyId, int pageNumber, Epi.Web.Enter.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, bool IsMobileDevice, List <SurveyAnswerDTO> _SurveyAnswerDTOList = null, List <Epi.Web.Enter.Common.DTO.FormsHierarchyDTO> FormsHierarchyDTOList = null, bool IsAndroid = false, bool GetSourceTables = true) { List <SurveyInfoDTO> List = new List <SurveyInfoDTO>(); //Get the SurveyInfoDTO Epi.Web.Enter.Common.DTO.SurveyInfoDTO surveyInfoDTO; if (FormsHierarchyDTOList == null) { surveyInfoDTO = SurveyHelper.GetSurveyInfoDTO(_surveyInfoRequest, _iSurveyInfoRepository, surveyId);//Pain Point 5s if (_SurveyAnswerDTOList != null) { foreach (var item in _SurveyAnswerDTOList) { Epi.Web.Enter.Common.Message.SurveyInfoRequest request = new SurveyInfoRequest(); request.Criteria.SurveyIdList.Add(item.SurveyId); Epi.Web.Enter.Common.DTO.SurveyInfoDTO _SurveyInfoDTO = SurveyHelper.GetSurveyInfoDTO(request, _iSurveyInfoRepository, item.SurveyId); List.Add(_SurveyInfoDTO); } } } else { // var SurveyInfoDTO = FormsHierarchyDTOList.First(x => x.FormId == surveyAnswerDTO.SurveyId); var SurveyInfoDTO = FormsHierarchyDTOList.First(x => x.FormId == surveyId); surveyInfoDTO = SurveyInfoDTO.SurveyInfo; _SurveyAnswerDTOList = new List <SurveyAnswerDTO>(); _SurveyAnswerDTOList.Add(surveyAnswerDTO); var DTOList = FormsHierarchyDTOList.Where(x => x.ResponseIds.Count() > 0); foreach (var item in DTOList) { //if (item.ResponseIds.Count() > 0) //{ var DTO = item.ResponseIds.FirstOrDefault(z => z.ResponseId == surveyAnswerDTO.RelateParentId); if (DTO != null && !_SurveyAnswerDTOList.Contains(DTO)) { _SurveyAnswerDTOList.Add(DTO); } //} } foreach (var item in _SurveyAnswerDTOList) { var _SurveyInfoDTO = FormsHierarchyDTOList.FirstOrDefault(x => x.FormId == item.SurveyId); List.Add(_SurveyInfoDTO.SurveyInfo); } } MvcDynamicForms.Form form = null; SourceTablesResponse Response = new SourceTablesResponse(); SourceTablesRequest Request = new Enter.Common.Message.SourceTablesRequest(); if (GetSourceTables) { if (IsMobileDevice) { if (FormsHierarchyDTOList != null && FormsHierarchyDTOList.Count() > 0) { Request.SurveyId = FormsHierarchyDTOList[0].FormId.ToString(); } else { Request.SurveyId = surveyId; } Response = _iSurveyInfoRepository.GetSourceTables(Request);//Pain Point } else { Request.SurveyId = FormsHierarchyDTOList[0].FormId.ToString(); Response = _iSurveyInfoRepository.GetSourceTables(Request);//Pain Point } } if (IsMobileDevice) { Epi.Web.MVC.Utility.MobileFormProvider.SurveyInfoList = List; Epi.Web.MVC.Utility.MobileFormProvider.SurveyAnswerList = _SurveyAnswerDTOList; form = Epi.Web.MVC.Utility.MobileFormProvider.GetForm(surveyInfoDTO, pageNumber, surveyAnswerDTO, IsAndroid, Response.List); } else { Epi.Web.MVC.Utility.FormProvider.SurveyInfoList = List; Epi.Web.MVC.Utility.FormProvider.SurveyAnswerList = _SurveyAnswerDTOList; form = Epi.Web.MVC.Utility.FormProvider.GetForm(surveyInfoDTO, pageNumber, surveyAnswerDTO, IsAndroid, Response.List); } return(form); }
public SurveyInfoResponse PublishExcelSurvey(SurveyInfoRequest Request) { SurveyInfoResponse SurveyInfoResponse = _iSurveyInfoRepository.PublishExcelSurvey(Request); return(SurveyInfoResponse); }