public CheckListFormEditModel ViewTemplate(long templateId)
        {
            var template                = _checkListTemplateRepository.GetById(templateId);
            var templateGroup           = _checkListGroupRepository.GetAllGroups();
            var checklistGroupQuestions = _checkListTemplateRepository.GetAllGroupQuestionsForTemplateId(templateId);
            var checkListQuestion       = _checkListQuestionRepository.GetAllQuestionsForTemplateId(template.Id);

            var answerList = new List <CheckListAnswer>();

            return(new CheckListFormEditModel
            {
                Name = new Name(""),
                CheckListQuestion = _checkListQuestionAnswerEditModelFactory.CheckListQuestionAnswerEditModel(checkListQuestion, answerList, templateGroup, checklistGroupQuestions),
                Gender = Gender.Unspecified,
            });
        }
        public CheckListFormEditModel GetCustomerCheckListEdtiModel(Customer customer, CorporateAccount account, EventCustomer eventCustomer)
        {
            var preApporvedTestNames = _eventCustomerPreApprovedTestRepository.GetPreApprovedTestNameByEventCustomerId(eventCustomer.Id);
            var result = _eventCustomerResultRepository.GetById(eventCustomer.Id);

            var template = _checkListTemplateRepository.GetTemplateByEventId(eventCustomer.EventId);

            if (template == null && account.CheckListTemplateId.HasValue)
            {
                template = _checkListTemplateRepository.GetById(account.CheckListTemplateId.Value);
            }
            else if (template == null)
            {
                template = _checkListTemplateRepository.GetDefaultTemplate();
            }

            var templateGroup           = _checkListGroupRepository.GetAllGroups();
            var checkListQuestion       = _checkListQuestionRepository.GetAllQuestionsForTemplateId(template.Id);
            var checklistGroupQuestions = _checkListTemplateRepository.GetAllGroupQuestionsForTemplateId(template.Id);

            var version    = _checkListAnswerRepository.GetLatestVersion(eventCustomer.Id);
            var answerList = new List <CheckListAnswer>();

            if (version > 0)
            {
                answerList = _checkListAnswerRepository.GetAllAnswerByEventCustomerId(eventCustomer.Id, version).ToList();
            }

            return(new CheckListFormEditModel
            {
                CustomerId = customer.CustomerId,
                PreApporvedTestNames = preApporvedTestNames,
                EventId = eventCustomer.EventId,
                Name = customer.Name,
                DoB = customer.DateOfBirth,
                //HealthPlanName = (template.HealthPlanId.HasValue && account != null) ? account.Name : string.Empty,
                EventCustomerId = eventCustomer.Id,
                CheckListQuestion = _checkListQuestionAnswerEditModelFactory.CheckListQuestionAnswerEditModel(checkListQuestion, answerList, templateGroup, checklistGroupQuestions),
                IsEditable = result == null || result.ResultState < (long)TestResultStateNumber.PreAudit,
                Gender = customer.Gender
            });
        }