Esempio n. 1
0
        public Contracts.GenericListResult <Contracts.FamilyMember> GetPersonFamilyMembers(int id)
        {
            Contracts.GenericListResult <Contracts.FamilyMember> list = new Contracts.GenericListResult <Contracts.FamilyMember>();
            Contracts.FamilyMemberMapper mapper = new Contracts.FamilyMemberMapper();

            var person = new Arena.Core.Person(id);

            list.Items = new List <Contracts.FamilyMember>();
            list.Max   = list.Total = person.Family().FamilyMembers.Count;
            list.Start = 0;
            foreach (FamilyMember member in person.Family().FamilyMembers)
            {
                list.Items.Add(mapper.FromArena(member));
            }

            return(list);
        }
Esempio n. 2
0
        public Email GetPersonPrimaryEmail(int id)
        {
            var retEmail = new Email();
            var person   = new Arena.Core.Person(id);

            if (person.Emails.Active.Count > 0)
            {
                // Get the person's first active email
                PersonEmail email = person.Emails.Active[0];
                foreach (PersonEmail eml in person.Emails.Active)
                {
                    // Now just make sure we have the one with the lowest order
                    if (eml.Order < email.Order)
                    {
                        email = eml;
                    }
                }
                retEmail.Address = email.Email.ToString();
            }
            return(retEmail);
        }
Esempio n. 3
0
        public Arena.Services.Contracts.Person GetPerson(int id, string fields)
        {
            List <string> strs;

            Arena.Core.Person arenaPersonFromID = new Arena.Core.Person(id);
            if (arenaPersonFromID == null)
            {
                throw new ResourceNotFoundException("Invalid person id");
            }
            if (!string.IsNullOrEmpty(fields))
            {
                char[] chrArray = new char[] { ',' };
                strs = new List <string>(fields.Split(chrArray));
            }
            else
            {
                strs = null;
            }
            Contracts.PersonMapper personMapper = new Contracts.PersonMapper(strs);

            return(personMapper.FromArena(arenaPersonFromID));
        }