示例#1
0
        private UserData MapRegistrationToUserDTO(UserRegistration registration)
        {
            // loop through all address information in the input, and build the corresponding relations for User object
            List <AddressRelation> addressRelations = new List <AddressRelation>();

            if (registration.Phone != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.PHONE;
                address.Uuid = registration.Phone.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Email != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.EMAIL;
                address.Uuid = registration.Email.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Location != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.LOCATION;
                address.Uuid = registration.Location.Uuid;
                addressRelations.Add(address);
            }

            UserData user = new UserData();

            user.Addresses  = addressRelations;
            user.PersonUuid = registration.Person.Uuid;
            user.ShortKey   = registration.ShortKey;
            user.Timestamp  = registration.Timestamp;
            user.UserId     = registration.UserId;
            user.Uuid       = registration.Uuid;

            return(user);
        }
示例#2
0
        private OrgUnitData MapRegistrationToOrgUnitDTO(OrgUnitRegistration registration)
        {
            // loop through all address information in the input, and build the corresponding relations for OrgUnit object
            List <AddressRelation> addressRelations = new List <AddressRelation>();

            if (registration.Phone != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.PHONE;
                address.Uuid = registration.Phone.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Email != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.EMAIL;
                address.Uuid = registration.Email.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Location != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.LOCATION;
                address.Uuid = registration.Location.Uuid;
                addressRelations.Add(address);
            }

            if (registration.LOSShortName != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.LOSSHORTNAME;
                address.Uuid = registration.LOSShortName.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Ean != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.EAN;
                address.Uuid = registration.Ean.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Post != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.POST;
                address.Uuid = registration.Post.Uuid;
                addressRelations.Add(address);
            }

            if (registration.ContactOpenHours != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.CONTACT_ADDRESS_OPEN_HOURS;
                address.Uuid = registration.ContactOpenHours.Uuid;
                addressRelations.Add(address);
            }

            if (registration.EmailRemarks != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.EMAIL_REMARKS;
                address.Uuid = registration.EmailRemarks.Uuid;
                addressRelations.Add(address);
            }

            if (registration.PostReturn != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.POST_RETURN;
                address.Uuid = registration.PostReturn.Uuid;
                addressRelations.Add(address);
            }

            if (registration.Contact != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.CONTACT_ADDRESS;
                address.Uuid = registration.Contact.Uuid;
                addressRelations.Add(address);
            }

            if (registration.PhoneOpenHours != null)
            {
                AddressRelation address = new AddressRelation();
                address.Type = AddressRelationType.PHONE_OPEN_HOURS;
                address.Uuid = registration.PhoneOpenHours.Uuid;
                addressRelations.Add(address);
            }

            OrgUnitData organisationEnhed = new OrgUnitData();

            organisationEnhed.ShortKey          = registration.ShortKey;
            organisationEnhed.Name              = registration.Name;
            organisationEnhed.Addresses         = addressRelations;
            organisationEnhed.Timestamp         = registration.Timestamp;
            organisationEnhed.Uuid              = registration.Uuid;
            organisationEnhed.ParentOrgUnitUuid = registration.ParentOrgUnitUuid;

            return(organisationEnhed);
        }