public Contact(SimpleContact incoming, string defaultRole)
 {
     if (incoming != null)
     {
         Name = incoming.Name;
         Organization = incoming.Organization;
         Email = incoming.Email;
         Role = incoming.Role;
     }
     else
     {
         Role = defaultRole;
     }
 }
Пример #2
0
 private CI_ResponsibleParty_Type CreateResponsiblePartyFromSimpleContact(SimpleContact contact)
 {
     CI_ResponsibleParty_Type responsibleParty = new CI_ResponsibleParty_Type();
     PopuplateResponsiblePartyFromSimpleContact(responsibleParty, contact);
     return responsibleParty;
 }
Пример #3
0
        private CI_ResponsibleParty_Type PopuplateResponsiblePartyFromSimpleContact(CI_ResponsibleParty_Type responsibleParty, SimpleContact contact)
        {
            responsibleParty.individualName = new CharacterString_PropertyType { CharacterString = contact.Name };

            if (!string.IsNullOrWhiteSpace(contact.OrganizationEnglish))
            {
                responsibleParty.organisationName = CreateFreeTextElement(contact.Organization, contact.OrganizationEnglish);
            }
            else
            {
                responsibleParty.organisationName = new CharacterString_PropertyType { CharacterString = contact.Organization };
            }

            if (responsibleParty.contactInfo == null)
            {
                responsibleParty.contactInfo = new CI_Contact_PropertyType
                {
                    CI_Contact = new CI_Contact_Type
                    {
                        address = new CI_Address_PropertyType
                        {
                            CI_Address = new CI_Address_Type()
                        }
                    }
                };
            }
            if (responsibleParty.contactInfo.CI_Contact == null)
            {
                responsibleParty.contactInfo.CI_Contact = new CI_Contact_Type
                {
                    address = new CI_Address_PropertyType
                    {
                        CI_Address = new CI_Address_Type()
                    }
                };
            }
            if (responsibleParty.contactInfo.CI_Contact.address == null)
            {
                responsibleParty.contactInfo.CI_Contact.address = new CI_Address_PropertyType
                {
                    CI_Address = new CI_Address_Type()
                };
            }
            if (responsibleParty.contactInfo.CI_Contact.address.CI_Address == null)
            {
                responsibleParty.contactInfo.CI_Contact.address.CI_Address = new CI_Address_Type();
            }

            responsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress = new CharacterString_PropertyType[] {
                    new CharacterString_PropertyType { CharacterString = contact.Email }
                };

            responsibleParty.role = new CI_RoleCode_PropertyType
            {
                CI_RoleCode = new CodeListValue_Type
                {
                    codeList = "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#CI_RoleCode",
                    codeListValue = contact.Role
                }
            };
            return responsibleParty;
        }
Пример #4
0
        private void CreateOrUpdateContactWithRole(string roleCodeValue, SimpleContact contact)
        {
            CI_ResponsibleParty_Type responsibleParty = GetContactInformationResponsiblePartyWithRole(roleCodeValue);
            if (responsibleParty == null)
            {
                responsibleParty = new CI_ResponsibleParty_Type();

                var newPointOfContactArray = new CI_ResponsibleParty_PropertyType[] {
                        new CI_ResponsibleParty_PropertyType {
                            CI_ResponsibleParty = responsibleParty
                        }
                    };

                var identification = GetIdentificationNotNull();
                if (identification.pointOfContact == null)
                {
                    identification.pointOfContact = newPointOfContactArray;
                }
                else
                {
                    identification.pointOfContact = identification.pointOfContact.Concat(newPointOfContactArray).ToArray();
                }
            }

            PopuplateResponsiblePartyFromSimpleContact(responsibleParty, contact);
        }