Пример #1
0
        public List <CampEmergencyContactDTO> GetCamperEmergencyContactInfo(int eventId, int contactId, string token)
        {
            var formId            = _configurationWrapper.GetConfigIntValue("SummerCampFormID");
            var response          = _formSubmissionRepository.GetFormResponse(formId, contactId, eventId);
            var emergencyContacts = new List <CampEmergencyContactDTO>();

            emergencyContacts.Add(new CampEmergencyContactDTO
            {
                Email                   = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.EmergencyContactEmail"))?.Response,
                FirstName               = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.EmergencyContactFirstName"))?.Response,
                LastName                = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.EmergencyContactLastName"))?.Response,
                MobileNumber            = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.EmergencyContactMobilePhone"))?.Response,
                PrimaryEmergencyContact = true,
                Relationship            = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.EmergencyContactRelationship"))?.Response
            });

            emergencyContacts.Add(new CampEmergencyContactDTO
            {
                Email                   = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.AdditionalEmergencyContactEmail"))?.Response,
                FirstName               = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.AdditionalEmergencyContactFirstName"))?.Response,
                LastName                = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.AdditionalEmergencyContactLastName"))?.Response,
                MobileNumber            = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.AdditionalEmergencyContactMobilePhone"))?.Response,
                PrimaryEmergencyContact = false,
                Relationship            = response.FormAnswers.FirstOrDefault(a => a.FieldId == _configurationWrapper.GetConfigIntValue("SummerCampForm.AdditionalEmergencyContactRelationship"))?.Response
            });

            return(emergencyContacts);
        }
Пример #2
0
        public void ShouldGetFormResponseWhenPassedEventId()
        {
            const int formId     = 333;
            const int contactId  = 889899;
            const int eventId    = 9098;
            const int responseId = 8876;

            var searchString  = $"Form_ID={formId} AND Contact_ID={contactId} AND Event_ID={eventId}";
            var answersSearch = $"Form_Response_ID={responseId}";

            _ministryPlatformRestRepository.Setup(m => m.UsingAuthenticationToken(apiToken)).Returns(_ministryPlatformRestRepository.Object);
            _ministryPlatformRestRepository.Setup(m => m.Search <MpFormResponse>(searchString, null as string, null as string, false)).Returns(new List <MpFormResponse> {
                new MpFormResponse {
                    FormResponseId = responseId
                }
            });
            _ministryPlatformRestRepository.Setup(m => m.Search <MpFormAnswer>(answersSearch, null as string, null as string, false)).Returns(new List <MpFormAnswer>());

            _fixture.GetFormResponse(formId, contactId, eventId);
            _ministryPlatformRestRepository.VerifyAll();
        }