Beispiel #1
0
 public ClientRegistrationDTO(ClientDemographicDTO clientDemographic, ClientContactAddressDTO clientContactAddress, ClientProfileDTO clientProfile, ClientEnrollmentDTO clientEnrollment)
 {
     ClientDemographic    = clientDemographic;
     ClientContactAddress = clientContactAddress;
     ClientProfile        = clientProfile;
     ClientEnrollment     = clientEnrollment;
 }
Beispiel #2
0
        public static ClientEnrollmentDTO CreateFromClient(Client client)
        {
            var enrollmentDTO = new ClientEnrollmentDTO();

            if (null != client)
            {
                enrollmentDTO.PracticeId = client.PracticeId;


                //Client Identifiers

                if (client.Identifiers.Any())
                {
                    var clientIdentifier = client.Identifiers.First();
                    enrollmentDTO.IdentifierTypeId = clientIdentifier.IdentifierTypeId;
                    enrollmentDTO.Identifier       = clientIdentifier.Identifier;
                    enrollmentDTO.RegistrationDate = clientIdentifier.RegistrationDate;
                    enrollmentDTO.ClientId         = clientIdentifier.ClientId.ToString();
                    enrollmentDTO.Id = clientIdentifier.Id.ToString();
                }
                else
                {
                    enrollmentDTO.ClientId         = client.Id.ToString();
                    enrollmentDTO.RegistrationDate = DateTime.Today;
                }
            }
            return(enrollmentDTO);
        }
Beispiel #3
0
        public static ClientEnrollmentDTO CreateFromView(ClientEnrollmentViewModel clientEnrollmentViewModel)
        {
            var enrollmentDTO = new ClientEnrollmentDTO(clientEnrollmentViewModel.SelectedPractice.Id,
                                                        clientEnrollmentViewModel.SelectedIdentifierType.Id, clientEnrollmentViewModel.Identifier,
                                                        clientEnrollmentViewModel.RegistrationDate);

            enrollmentDTO.ClientId = clientEnrollmentViewModel.ClientId;
            enrollmentDTO.Id       = clientEnrollmentViewModel.Id;
            return(enrollmentDTO);
        }
Beispiel #4
0
        public static ClientRegistrationDTO Create(Client client)
        {
            var clientRegistrationDTO =
                new ClientRegistrationDTO
            {
                ClientDemographic    = ClientDemographicDTO.CreateFromClient(client),
                ClientContactAddress = ClientContactAddressDTO.CreateFromClient(client),
                ClientProfile        = ClientProfileDTO.CreateFromClient(client),
                ClientEnrollment     = ClientEnrollmentDTO.CreateFromClient(client)
            };

            return(clientRegistrationDTO);
        }
        public static ClientRegistrationDTO Create(Client client)
        {
            var clientRegistrationDto =
                new ClientRegistrationDTO
            {
                ClientDemographic    = ClientDemographicDTO.CreateFromClient(client, client.Downloaded),
                ClientContactAddress = ClientContactAddressDTO.CreateFromClient(client, client.Downloaded),
                ClientProfile        = ClientProfileDTO.CreateFromClient(client, client.Downloaded),
                ClientEnrollment     = ClientEnrollmentDTO.CreateFromClient(client, client.Downloaded)
            };

            clientRegistrationDto.Downloaded = client.Downloaded;

            return(clientRegistrationDto);
        }
Beispiel #6
0
        public ClientRegistrationDTO(ISettings settings, bool isClient = true)
        {
            string demographic    = null;
            string contactAddress = null;
            string profile        = null;
            string enrollment     = null;

            if (settings.Contains(nameof(ClientDemographicViewModel)))
            {
                demographic = settings.GetValue(nameof(ClientDemographicViewModel), "");
            }
            if (settings.Contains(nameof(ClientContactViewModel)))
            {
                contactAddress = settings.GetValue(nameof(ClientContactViewModel), "");
            }
            if (settings.Contains(nameof(ClientProfileViewModel)))
            {
                profile = settings.GetValue(nameof(ClientProfileViewModel), "");
            }
            if (isClient)
            {
                if (settings.Contains(nameof(ClientEnrollmentViewModel)))
                {
                    enrollment = settings.GetValue(nameof(ClientEnrollmentViewModel), "");
                }
            }

            if (!string.IsNullOrWhiteSpace(demographic))
            {
                ClientDemographic = JsonConvert.DeserializeObject <ClientDemographicDTO>(demographic);
            }
            if (!string.IsNullOrWhiteSpace(contactAddress))
            {
                ClientContactAddress = JsonConvert.DeserializeObject <ClientContactAddressDTO>(contactAddress);
            }
            if (!string.IsNullOrWhiteSpace(profile))
            {
                ClientProfile = JsonConvert.DeserializeObject <ClientProfileDTO>(profile);
            }

            if (isClient)
            {
                if (!string.IsNullOrWhiteSpace(enrollment))
                {
                    ClientEnrollment = JsonConvert.DeserializeObject <ClientEnrollmentDTO>(enrollment);
                }
            }
        }