Last active
August 27, 2017 20:44
-
-
Save bolenton/c63e3efa95c9a23c103bc51b367e8301 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
ApiClient test = new ApiClient("churchApiKey", "username", "password"); | |
var person = test.People.Individuals.Get(2, true); | |
var Person = new Individual() | |
{ | |
FirstName = person.FirstName, | |
LastName = person.LastName, | |
Addresses = person.Addresses, | |
BirthDay = person.Birthday ?? DateTime.Today, | |
Email = person.Email, | |
Phone = person.Phones.First().Value, | |
FullName = person.FullName | |
}; | |
Person.GetIndividualInfo(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Individual | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public string FullName { get; set; } | |
public string Email { get; set; } | |
public List<Address> Addresses { get; set; } | |
public DateTime BirthDay { get; set; } | |
public string Phone { get; set; } | |
public static int CalculateAge(DateTime birthDay) | |
{ | |
int years = DateTime.Now.Year - birthDay.Year; | |
if ((birthDay.Month > DateTime.Now.Month) || (birthDay.Month == DateTime.Now.Month && birthDay.Day > DateTime.Now.Day)) | |
years--; | |
return years; | |
} | |
public void GetIndividualInfo() | |
{ | |
var city = Addresses.First().City; | |
var state = Addresses.First().State; | |
var line1 = Addresses.First().Line1; | |
var line2 = Addresses.First().Line2; | |
var address = Addresses.First().StreetAddress; | |
var zip = Addresses.First().Zip; | |
Console.WriteLine( $"Name: {FullName} \n Email: {Email} \n Age: {CalculateAge(BirthDay)} \n Phone: {Phone}"); | |
Console.WriteLine($"Address: {line1} \n City: {city} \n State: {state} \n Zip: {zip}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment