コード例 #1
0
ファイル: FluConsentService.cs プロジェクト: sahvishal/matrix
        public FluConsentTemplateEditModel GetTemplateById(long templateId)
        {
            var questions = _fluConsentQuestionRepository.GetAllQuestions();

            var template = _fluConsentTemplateRepository.GetById(templateId);

            var selectedQuestionIds = _fluConsentQuestionRepository.GetQuestionIdsByTemplateId(templateId);

            var questionList = new List <FluConsentQuestionEditModel>();

            foreach (var question in questions)
            {
                var questionModel = new FluConsentQuestionEditModel
                {
                    QuestionId = question.Id,
                    ParentId   = question.ParentId,
                    Index      = question.Index,
                    Question   = question.Question,
                    IsSelected = selectedQuestionIds.Contains(question.Id)
                };

                questionList.Add(questionModel);
            }

            return(new FluConsentTemplateEditModel
            {
                Id = templateId,
                Name = template.Name,
                IsPublished = template.IsPublished,
                IsActive = template.IsActive,
                Questions = questionList.ToArray()
            });
        }
コード例 #2
0
        public ActionResult Create()
        {
            var model = new FluConsentTemplateEditModel();

            var questions = _fluConsentQuestionRepository.GetAllQuestions();

            model.Questions = questions.Select(x => new FluConsentQuestionEditModel
            {
                QuestionId = x.Id,
                ParentId   = x.ParentId,
                Index      = x.Index,
                Question   = x.Question
            }).ToArray();

            return(View(model));
        }
コード例 #3
0
        public FluVaccinationConsentViewModel GetFluVaccinationConsentViewModel(long eventId, long customerId)
        {
            var eventData = _eventRepository.GetById(eventId);
            var host      = _hostRepository.GetHostForEvent(eventId);
            var customer  = _customerRepository.GetCustomer(customerId);

            var eventCustomer = _eventCustomerRepository.Get(eventId, customerId);
            var answers       = _fluConsentAnswerRepository.GetByEventCustomerId(eventCustomer.Id);
            var questions     = _fluConsentQuestionRepository.GetAllQuestions();

            var signature = _fluConsentSignatureRepository.GetByEventCustomerId(eventCustomer.Id);

            var signatureFileIds = signature != null ? new[] { signature.SignatureFileId } : null;

            if (signature != null && signature.ClinicalProviderSignatureFileId.HasValue)
            {
                signatureFileIds = new[] { signature.SignatureFileId, signature.ClinicalProviderSignatureFileId.Value };
            }

            var signatureFiles = !signatureFileIds.IsNullOrEmpty() ? _fileRepository.GetByIds(signatureFileIds) : null;

            return(GetFluVaccinationConsentViewModel(eventData, customer, host, questions, answers, signature, signatureFiles));
        }