예제 #1
0
        public SourceTablesResponse GetSourceTables(SourceTablesRequest pRequest)
        {
            try
            {
                string SurveyId                 = pRequest.SurveyId + "_SourceTables";
                var    CacheObj                 = HttpRuntime.Cache.Get(SurveyId);
                SourceTablesResponse result     = new SourceTablesResponse();
                string CacheIsOn                = ConfigurationManager.AppSettings["CACHE_IS_ON"];;
                string IsCacheSlidingExpiration = ConfigurationManager.AppSettings["CACHE_SLIDING_EXPIRATION"].ToString();
                int    CacheDuration            = 0;
                int.TryParse(ConfigurationManager.AppSettings["CACHE_DURATION"].ToString(), out CacheDuration);

                if (CacheIsOn.ToUpper() == "TRUE")
                {
                    if (CacheObj == null)
                    {
                        result = (SourceTablesResponse)_iDataService.GetSourceTables(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((SourceTablesResponse)CacheObj);
                    }
                }
                else
                {
                    result = (SourceTablesResponse)_iDataService.GetSourceTables(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;
            }
        }
예제 #2
0
        public SourceTablesResponse GetSourceTables(SourceTablesRequest pRequest)
        {
            try
            {
                string SurveyId             = pRequest.SurveyId + "_SourceTables";
                var    CacheObj             = HttpRuntime.Cache.Get(SurveyId);
                SourceTablesResponse result = new SourceTablesResponse();


                if (CacheIsOn.ToUpper() == "TRUE")
                {
                    if (CacheObj == null)
                    {
                        result = (SourceTablesResponse)_iDataService.GetSourceTables(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((SourceTablesResponse)CacheObj);
                    }
                }
                else
                {
                    result = (SourceTablesResponse)_iDataService.GetSourceTables(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;
            }
        }
예제 #3
0
        public SourceTablesResponse GetSourceTables(string surveyId)
        {
            SourceTablesResponse Response = new SourceTablesResponse();
            SourceTablesRequest  Request  = new SourceTablesRequest();

            Request.SurveyId = surveyId;
            Response         = _iSurveyInfoRepository.GetSourceTables(Request);//Pain Point
            return(Response);
        }
예제 #4
0
        public SourceTablesResponse GetSourceTables(SourceTablesRequest Request)
        {
            SourceTablesResponse DropDownsResponse = new SourceTablesResponse();

            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);

            DropDownsResponse.List = Mapper.ToSourceTableDTO(Implementation.GetSourceTables(Request.SurveyId));
            return(DropDownsResponse);
        }
예제 #5
0
        /// <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.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, bool isMobileDevice = false, string callerThereby = "", bool IsAndroid = false, bool GetSourceTables = true)
        {
            SourceTablesResponse Response = new SourceTablesResponse();
            SourceTablesRequest  Request  = new SourceTablesRequest();

            if (GetSourceTables)
            {
                Request.SurveyId = surveyId;
                Response         = _iSurveyInfoRepository.GetSourceTables(Request);//Pain Point
            }
            Epi.Web.Common.DTO.SurveyInfoDTO surveyInfoDTO = SurveyHelper.GetSurveyInfoDTO(_surveyInfoRequest, _iSurveyInfoRepository, surveyId);
            MvcDynamicForms.Form             form          = null;
            form = Epi.Web.MVC.Utility.FormProvider.GetForm(surveyInfoDTO, pageNumber, surveyAnswerDTO, isMobileDevice, IsAndroid, Response.List);

            return(form);
        }
예제 #6
0
        public List <SourceTableDTO> GetSourceTables(string SurveyId)
        {
            //List<SourceTableBO> list = new List<SourceTableBO>();
            SourceTablesResponse   SourceTables           = new SourceTablesResponse();
            SurveyControlsResponse SurveyControlsResponse = new SurveyControlsResponse();

            try
            {
                Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = new EntitySurveyInfoDao();
                SurveyInfo Implementation = new BLL.SurveyInfo(ISurveyInfoDao);
                SourceTables.List = Common.ObjectMapping.Mapper.ToSourceTableDTO(Implementation.GetSourceTables(SurveyId));
            }
            catch (Exception ex)
            {
                SurveyControlsResponse.Message = "Error";
                throw ex;
            }
            return(SourceTables.List);
        }
예제 #7
0
        internal static List <PrintModel> SetCommentLegalValues(List <PrintModel> QuestionAnswerList, SurveyControlsResponse List, SurveyInfoModel surveyInfoModel, SourceTablesResponse SourceTables)
        {
            try
            {
                XDocument xdoc = XDocument.Parse(surveyInfoModel.XML);
                var       Node = xdoc.Element("SourceTable");
                if (Node == null)
                {
                    xdoc = Epi.Web.Common.Xml.SurveyXml.AddSourceTableToXml(xdoc, SourceTables.List);
                }
                var CommentLegals = List.SurveyControlList.Where(x => x.ControlType == "CommentLegal");
                if (CommentLegals.Count() > 0)
                {
                    foreach (var item in CommentLegals)
                    {
                        List <string> CommentLegalValues = GetCommentLegalValues(xdoc, item.ControlId);
                        PrintModel    AnswerValue        = QuestionAnswerList.Where(x => x.ControlName == item.ControlId).Single();
                        QuestionAnswerList = SetValues(CommentLegalValues, AnswerValue, QuestionAnswerList);
                    }
                }
            }
            catch (Exception ex) {
                throw ex;
            }

            return(QuestionAnswerList);
        }
예제 #8
0
        public MvcDynamicForms.Form GetSurveyFormData(
            string surveyId,
            int pageNumber,
            Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswerDTO,
            bool IsMobileDevice,
            List <SurveyAnswerDTO> _SurveyAnswerDTOList = null,
            List <Epi.Web.Common.DTO.FormsHierarchyDTO> FormsHierarchyDTOList = null, bool IsAndroid = false, bool GetSourceTables = true)
        {
            List <SurveyInfoDTO> List = new List <SurveyInfoDTO>();


            //Get the SurveyInfoDTO
            Epi.Web.Common.DTO.SurveyInfoDTO surveyInfoDTO;
            if (FormsHierarchyDTOList == null || FormsHierarchyDTOList.Count() == 0)
            {
                surveyInfoDTO = SurveyHelper.GetSurveyInfoDTO(_surveyInfoRequest, _iSurveyInfoRepository, surveyId);//Pain Point 5s
                if (_SurveyAnswerDTOList != null)
                {
                    foreach (var item in _SurveyAnswerDTOList)
                    {
                        Epi.Web.Common.Message.SurveyInfoRequest request = new SurveyInfoRequest();
                        request.Criteria.SurveyIdList.Add(item.SurveyId);
                        Epi.Web.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 Common.Message.SourceTablesRequest();

            if (GetSourceTables)
            {
                //if (IsMobileDevice)
                //{
                if (FormsHierarchyDTOList != null && FormsHierarchyDTOList.Count() > 0)
                {
                    Request.SurveyId = FormsHierarchyDTOList[0].FormId.ToString();
                }
                else
                {
                    if (string.IsNullOrEmpty(surveyAnswerDTO.ParentRecordId))
                    {
                        Request.SurveyId = surveyId;
                    }
                    else
                    {
                        Request.SurveyId = surveyAnswerDTO.ParentRecordId;
                    }
                }
                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, IsMobileDevice, IsAndroid, Response.List);
            //}
            return(form);
        }