Пример #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);
        }