Beispiel #1
0
        static string AddFamilyToFluro(Elvanto.People.Person person)
        {
            Fluro.Realm realm = new Fluro.Realm
            {
                _id = FluroRidgehavenRealm
            };
            Fluro.Family.RootObject newfamily = new Fluro.Family.RootObject
            {
                items        = new List <string>(),
                phoneNumbers = new List <string>(),
                emails       = new List <string>(),
                address      = new Address(),
                _type        = "family",
                realms       = new List <Realm>()
            };
            newfamily.realms.Add(realm);



            if (newfamily.title == null)
            {
                newfamily.title = person.lastname;
            }

            newfamily.emails.Add(person.email);
            if (newfamily.address.addressLine1 == null)
            {
                newfamily.address.addressLine1 = person.home_address;
                newfamily.address.addressLine2 = person.home_address2;
                newfamily.address.suburb       = person.home_city;
                newfamily.address.state        = person.home_state;
                if (person.home_postcode != "")
                {
                    newfamily.address.postalCode = Convert.ToInt32(person.home_postcode);
                }
                newfamily.address.country = "Australia";
            }

            newfamily.phoneNumbers.Add(person.mobile);
            newfamily.phoneNumbers.Add(person.phone);

            if (person.archived > 0)
            {
                newfamily.status = "archived";
            }
            else
            {
                newfamily.status = "active";
            }


            return(Util.UploadToFluroReturnId(FluroFamilyURI, "POST", JsonConvert.SerializeObject(newfamily)));
        }
Beispiel #2
0
        static void AddContactToFluro(Elvanto.People.Person person, string familyId)
        {
            Fluro.Family.Contact contact = new Fluro.Family.Contact
            {
                data   = new Fluro.Family.ContactData(),
                realms = new List <string> {
                    FluroRidgehavenRealm
                },
                phoneNumbers = new List <string>(),
                emails       = new List <string>(),
                tags         = new List <string>()
            };

            contact._type = "contact";

            contact.data.channel  = "TimothyLuke Elvanto2Fluro";
            contact.data.importId = person.id;
            contact.title         = person.firstname.ToLower() + " " + person.lastname.ToLower();
            contact.lastName      = person.lastname.ToLower();
            contact.firstName     = person.firstname.ToLower();
            if (person.gender != "")
            {
                contact.gender = person.gender;
            }
            else
            {
                // it has to be either male or female.  Search in Fluro for data.manualintervention to see who needs to be updated
                contact.tags.Add(FluroContentErrorTag);
                contact.gender = "unknown";
            }
            contact.dob   = person.birthday;
            contact._type = "contact";
            if (familyId != "")
            {
                contact.family = familyId;
            }
            if (person.archived > 0)
            {
                contact.status = "archived";
            }
            else
            {
                contact.status = "active";
            }
            if (person.deceased > 0)
            {
                contact.status = "deceased";
            }
            if (person.volunteer > 0)
            {
                contact.data.volunteer = true;
            }

            if (person.category_id == ElvantoNewMemberCategory)
            {
                contact.tags.Add(FluroNewPeople);
            }
            if (person.category_id == ElvantoMemberCategory)
            {
                contact.tags.Add(FluroChurchMember);
            }


            if (person.votingMember != null)
            {
                if (person.votingMember.name == "Yes")
                {
                    contact.tags.Add(FluroVotingMember);
                }
            }
            contact.maritalStatus = person.marital_status;
            contact.householdRole = person.family_relationship;
            contact.data.photoURL = person.picture;
            contact.phoneNumbers.Add(person.mobile);
            contact.phoneNumbers.Add(person.phone);
            if (person.email == "" && person.phone == "" && person.mobile == "")
            {
                // needs to be something - Search in Fluro for data.manualintervention to see who needs to be updated
                contact.emails.Add("*****@*****.**");
                contact.tags.Add(FluroContentErrorTag);
            }
            else
            {
                contact.emails.Add(person.email);
            }

            contact.data.preferredname = person.preferred_name;
            Util.UploadToFluroReturnJson(FluroContactURI, "POST", JsonConvert.SerializeObject(contact));
        }