Exemplo n.º 1
0
 public ClientRegistrationDTO(ClientDemographicDTO clientDemographic, ClientContactAddressDTO clientContactAddress, ClientProfileDTO clientProfile, ClientEnrollmentDTO clientEnrollment)
 {
     ClientDemographic    = clientDemographic;
     ClientContactAddress = clientContactAddress;
     ClientProfile        = clientProfile;
     ClientEnrollment     = clientEnrollment;
 }
Exemplo n.º 2
0
        public static ClientContactAddressDTO CreateFromView(ClientContactViewModel clientContactViewModel)
        {
            var addressDTO = new ClientContactAddressDTO(clientContactViewModel.Telephone, clientContactViewModel.Landmark);

            addressDTO.PersonId    = clientContactViewModel.PersonId;
            addressDTO.ContactId   = clientContactViewModel.ContactId;
            addressDTO.AddressId   = clientContactViewModel.AddressId;
            addressDTO.CountyId    = clientContactViewModel.SelectedCounty?.Id;
            addressDTO.SubCountyId = clientContactViewModel.SelectedSubCounty?.Id;
            addressDTO.WardId      = clientContactViewModel.SelectedWard?.Id;
            return(addressDTO);
        }
Exemplo n.º 3
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);
        }
        public static ClientContactAddressDTO CreateFromClient(Client client, bool clientDownloaded)
        {
            var addressDTO = new ClientContactAddressDTO();


            if (null != client)
            {
                if (null != client.Person)
                {
                    //Person Contacts

                    if (client.Person.Contacts.Any())
                    {
                        var contact = client.Person.Contacts.First();
                        addressDTO.Phone     = contact.Phone;
                        addressDTO.ContactId = contact.Id.ToString();
                    }

                    //Person Addresses


                    if (client.Person.Addresses.Any())
                    {
                        var address = client.Person.Addresses.First();
                        addressDTO.Landmark    = address.Landmark;
                        addressDTO.AddressId   = address.Id.ToString();
                        addressDTO.CountyId    = address.CountyId;
                        addressDTO.SubCountyId = address.SubCountyId;
                        addressDTO.WardId      = address.WardId;
                    }

                    addressDTO.PersonId   = client.PersonId.ToString();
                    addressDTO.Downloaded = clientDownloaded;
                }
            }

            return(addressDTO);
        }