예제 #1
0
        public static OrganisationConfiguration BuildOrganisationConfiguration()
        {
            var orgConfiguration = new OrganisationConfiguration
            {
                OrganisationContacts = new ContactConfiguration()
            };

            orgConfiguration.Names.Add(new LocalizedConfigurationEntry
            {
                Name        = "Company name",
                DisplayName = "Company Display name",
            });
            orgConfiguration.Urls.Add(new LocalizedUrlEntry {
                Url = new Uri("https://company.co.uk/")
            });

            var contact = new Kernel.Federation.MetaData.Configuration.Organisation.ContactPerson
            {
                ContactType = Kernel.Federation.MetaData.Configuration.Organisation.ContactType.Technical,
                ForeName    = "John",
                SurName     = "Doe",
            };

            contact.Emails.Add("*****@*****.**");
            contact.PhoneNumbers.Add("020123456");

            orgConfiguration.OrganisationContacts.PersonContact.Add(contact);
            return(orgConfiguration);
        }
예제 #2
0
        public static OrganisationConfiguration BuikdOrganisationConfiguration()
        {
            var orgConfiguration = new OrganisationConfiguration
            {
                OrganisationContacts = new ContactConfiguration()
            };

            orgConfiguration.Names.Add(new LocalizedConfigurationEntry
            {
                Name        = "Apira LTD",
                DisplayName = "Flowz",
            });
            orgConfiguration.Urls.Add(new LocalizedUrlEntry {
                Url = new Uri("https://apira.co.uk/")
            });

            var contact = new Kernel.Federation.MetaData.Configuration.Organisation.ContactPerson
            {
                ContactType = Kernel.Federation.MetaData.Configuration.Organisation.ContactType.Technical,
                ForeName    = "John",
                SurName     = "Murphy",
            };

            contact.Emails.Add("*****@*****.**");
            contact.PhoneNumbers.Add("020xxx");

            orgConfiguration.OrganisationContacts.PersonContact.Add(contact);
            return(orgConfiguration);
        }
        private static OrganisationConfiguration BuidOrganisationConfiguration(OrganisationSettings organisationSettings)
        {
            var orgConfiguration = new OrganisationConfiguration
            {
                OrganisationContacts = new ContactConfiguration()
            };

            if (organisationSettings != null)
            {
                organisationSettings.Names.Aggregate(orgConfiguration.Names, (t, next) =>
                {
                    t.Add(new LocalizedConfigurationEntry
                    {
                        Name        = next.Name,
                        DisplayName = String.IsNullOrEmpty(next.DisplayName) ? next.Name : next.DisplayName,
                        Language    = new CultureInfo(next.Language)
                    });
                    return(t);
                });

                organisationSettings.Urls.Aggregate(orgConfiguration.Urls, (t, next) =>
                {
                    t.Add(new LocalizedUrlEntry {
                        Url = new Uri(next.Name), Language = new CultureInfo(next.Language)
                    });
                    return(t);
                });
                organisationSettings.Contacts.Aggregate(orgConfiguration.OrganisationContacts.PersonContact, (t, next) =>
                {
                    var contact = new Kernel.Federation.MetaData.Configuration.Organisation.ContactPerson
                    {
                        ContactType = next.ContactType,
                        ForeName    = next.Forename.Name,
                        SurName     = next.Surname.Name,
                    };
                    next.Emails.Aggregate(contact.Emails, (t1, next1) =>
                    {
                        contact.Emails.Add(next1.Name);
                        return(t1);
                    });

                    next.Phones.Aggregate(contact.PhoneNumbers, (t2, next2) =>
                    {
                        contact.PhoneNumbers.Add(next2.Number);
                        return(t2);
                    });

                    t.Add(contact);
                    return(t);
                });
            }
            return(orgConfiguration);
        }