Exemplo n.º 1
0
        /// <summary>
        /// Audit response in detail
        /// </summary>
        /// <param name="surveyResponseID"></param>
        /// <param name="AuditID"></param>
        /// <returns></returns>
        public AuditDetailsDTO getAuditDetails(long surveyResponseID, int AuditID)
        {
            AuditDetailsDTO result = new AuditDetailsDTO();

            List <AuditQuestionDetailsDTO> auditQuestionDetails = new List <AuditQuestionDetailsDTO>();

            ObjectMapper.Map(RaceRepository.GetSurveyModulesList(surveyResponseID), auditQuestionDetails);
            result.auditDetails = auditQuestionDetails;

            List <ProductAuditSummaryDTO> productAuditSummary = new List <ProductAuditSummaryDTO>();

            ObjectMapper.Map(RaceRepository.GetProductAuditdata(AuditID), productAuditSummary);
            result.productAuditSummary = productAuditSummary;

            StoreGeoTagDTO geoTag = new StoreGeoTagDTO();

            ObjectMapper.Map(RaceRepository.GetStoreDetails(surveyResponseID), geoTag);
            result.tagDetails = geoTag;


            List <AuditLogDetailsDTO> auditlog = new List <AuditLogDetailsDTO>();

            ObjectMapper.Map(RaceRepository.getauditLogDetails(AuditID), auditlog);

            foreach (var item in auditlog)
            {
                var currentDate = DateTime.Today.AddDays(1); //being used to calculate days
                int days        = currentDate.Subtract(item.CreatedDate).Days;
                if (days > 0)
                {
                    item.Days = days.ToString() + " Day(s) ago";
                }
                else
                {
                    item.Days = " today";
                }
            }


            result.auditLogDetails = auditlog;
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Select list of modules in a survey Response
        /// </summary>
        /// <param name="surveyResponseID"></param>
        /// <returns></returns>
        public SurveyAuditDTO GetSurveyModulesList(long surveyResponseID)
        {
            SurveyAuditDTO result = new SurveyAuditDTO();

            ObjectMapper.Map(RaceRepository.GetSurveyModulesList(surveyResponseID), result);

            string fileDirectory = string.Empty;

            fileDirectory = AppUtil.GetUploadDirectory(AspectEnums.ImageFileTypes.Survey);


            foreach (var module in result.modules)
            {
                List <SurveyQuestionRepeatResponseDTO> surveyRepeatResponse = new List <SurveyQuestionRepeatResponseDTO>();
                foreach (var moduleresponse in module.surveyQuestionResponse)
                {
                    #region add singular question in list
                    surveyRepeatResponse.Add(new SurveyQuestionRepeatResponseDTO()
                    {
                        surveyQuestion = moduleresponse.surveyQuestion,
                        userResponse   = moduleresponse.surveyUserResponse.UserResponse,
                        ModuleID       = module.ModuleID,
                        ModuleCode     = module.ModuleCode
                    });
                    #endregion

                    #region add repeat question in list
                    if (moduleresponse.surveyUserResponse.SurveyRepeatResponses.Count > 0)
                    {
                        foreach (var item in moduleresponse.surveyUserResponse.SurveyRepeatResponses)
                        {
                            surveyRepeatResponse.Add(new SurveyQuestionRepeatResponseDTO()
                            {
                                surveyQuestion = moduleresponse.surveyQuestion + " --> " + moduleresponse.RepeaterText + " " + item.SurveyQuestionRepeaterID.ToString(),
                                userResponse   = item.UserResponse,
                                ModuleID       = module.ModuleID,
                                imagePath      = item.UserResponse.Contains(".jpeg") ?
                                                 fileDirectory + @"\" + item.UserResponse
                                    : "",
                                ModuleCode = module.ModuleCode
                            });
                        }
                    }
                    #endregion
                }
                module.surveyRepeatResponse = surveyRepeatResponse;
            }

            foreach (var item in result.auditLogDetails)
            {
                var currentDate = DateTime.Today.AddDays(1); //being used to calculate days
                int days        = currentDate.Subtract(item.CreatedDate).Days;
                if (days > 0)
                {
                    item.Days = days.ToString() + " Day(s) ago";
                }
                else
                {
                    item.Days = " today";
                }
            }

            return(result);
        }