// this adds all the name functions of the pipedrive contact private static PipedriveContact GetPipeName(PipedriveContact tempPipedriveContact, OfficeContact officeContact) { // get the name stuff copied over if (!String.IsNullOrEmpty(officeContact.DisplayName)) { tempPipedriveContact.first_name = officeContact.GivenName; } if (!String.IsNullOrEmpty(officeContact.GivenName)) { tempPipedriveContact.name = officeContact.DisplayName; } if (!String.IsNullOrEmpty(officeContact.Surname)) { tempPipedriveContact.last_name = officeContact.Surname; } return(tempPipedriveContact); }
private static PipedriveContact GetPipeCompanyInfo(PipedriveContact tempPipedriveContact, OfficeContact officeContact) { // get all the info from the company stuff copied over if (!String.IsNullOrEmpty(officeContact.JobTitle)) { tempPipedriveContact.job_title = officeContact.JobTitle; } if (!String.IsNullOrEmpty(officeContact.Profession)) { tempPipedriveContact.job_title = officeContact.Profession; } if (!String.IsNullOrEmpty(officeContact.CompanyName)) { tempPipedriveContact.org_name = officeContact.CompanyName; } return(tempPipedriveContact); }
// translate all the phone stuff private static PipedriveContact GetPipePhoneInfo(PipedriveContact tempPipedriveContact, OfficeContact officeContact) { tempPipedriveContact.phone = new List <PipePhone>(); // first copy over mobile phones if (!String.IsNullOrEmpty(officeContact.MobilePhone1)) { // custom mobile field tempPipedriveContact.mobile = officeContact.MobilePhone1; // create new instance of phone object tempPipedriveContact.phone.Add(new PipePhone() { label = "mobile", primary = false, value = officeContact.MobilePhone1 }); } // Copy over home phone info foreach (String phoneNumber in officeContact.HomePhones) { if (!String.IsNullOrEmpty(phoneNumber)) { tempPipedriveContact.phone.Add(new PipePhone() { label = "home", primary = false, value = phoneNumber }); } } // copy over buisiness phone info foreach (String phoneNumber in officeContact.BusinessPhones) { if (!String.IsNullOrEmpty(phoneNumber)) { tempPipedriveContact.phone.Add(new PipePhone() { label = "work", primary = false, value = phoneNumber }); } } return(tempPipedriveContact); }
private static PipedriveContact GetPipeEmailInfo(PipedriveContact tempPipedriveContact, OfficeContact officeContact) { // check if these emails are null if (officeContact.EmailAddresses == null || officeContact.EmailAddresses.Count == 0) { return(tempPipedriveContact); } tempPipedriveContact.email = new List <PipeEmail>(); // add all emails to the pipedrive contact foreach (OfficeEmail email in officeContact.EmailAddresses) { if (email != null) { if (!String.IsNullOrEmpty(email.Address)) { tempPipedriveContact.email.Add(new PipeEmail() { label = "work", primary = false, value = email.Address }); } } } return(tempPipedriveContact); }
private static PipedriveContact GetPipeAddressInfo(PipedriveContact tempPipedriveContact, OfficeContact officeContact) { // copy over all the info tempPipedriveContact.contact_address_1 = officeContact.HomeAddress.Street; tempPipedriveContact.contact_city = officeContact.HomeAddress.City; tempPipedriveContact.contact_state = officeContact.HomeAddress.State; tempPipedriveContact.contact_zip = officeContact.HomeAddress.PostalCode; return(tempPipedriveContact); }
private static JObject CreateResponse(OfficeContact contact) { //brute force insert alot of contact fields var createResponse = new JObject(); if (!String.IsNullOrEmpty(contact.Birthday)) { createResponse["Birthday"] = contact.Birthday; } if (!String.IsNullOrEmpty(contact.FileAs)) { createResponse["FileAs"] = contact.FileAs; } if (!String.IsNullOrEmpty(contact.DisplayName)) { createResponse["DisplayName"] = contact.DisplayName; } if (!String.IsNullOrEmpty(contact.GivenName)) { createResponse["GivenName"] = contact.GivenName; } if (!String.IsNullOrEmpty(contact.Initials)) { createResponse["Initials"] = contact.Initials; } if (!String.IsNullOrEmpty(contact.MiddleName)) { createResponse["MiddleName"] = contact.MiddleName; } if (!String.IsNullOrEmpty(contact.NickName)) { createResponse["NickName"] = contact.NickName; } if (!String.IsNullOrEmpty(contact.Surname)) { createResponse["Surname"] = contact.Surname; } if (!String.IsNullOrEmpty(contact.Title)) { createResponse["Title"] = contact.Title; } if (!String.IsNullOrEmpty(contact.Generation)) { createResponse["Generation"] = contact.Generation; } if (!String.IsNullOrEmpty(contact.JobTitle)) { createResponse["JobTitle"] = contact.JobTitle; } if (!String.IsNullOrEmpty(contact.CompanyName)) { createResponse["CompanyName"] = contact.CompanyName; } if (!String.IsNullOrEmpty(contact.Department)) { createResponse["Department"] = contact.Department; } if (!String.IsNullOrEmpty(contact.OfficeLocation)) { createResponse["OfficeLocation"] = contact.OfficeLocation; } if (!String.IsNullOrEmpty(contact.Profession)) { createResponse["Profession"] = contact.Profession; } if (!String.IsNullOrEmpty(contact.BusinessHomePage)) { createResponse["BusinessHomePage"] = contact.BusinessHomePage; } if (!String.IsNullOrEmpty(contact.AssistantName)) { createResponse["AssistantName"] = contact.AssistantName; } if (!String.IsNullOrEmpty(contact.Manager)) { createResponse["Manager"] = contact.Manager; } if (!String.IsNullOrEmpty(contact.MobilePhone1)) { createResponse["MobilePhone1"] = contact.MobilePhone1; } if (!String.IsNullOrEmpty(contact.YomiSurname)) { createResponse["YomiSurname"] = contact.YomiSurname; } if (!String.IsNullOrEmpty(contact.YomiGivenName)) { createResponse["YomiGivenName"] = contact.YomiGivenName; } if (!String.IsNullOrEmpty(contact.YomiCompanyName)) { createResponse["YomiCompanyName"] = contact.YomiCompanyName; } // insert the list of strings if (contact.HomePhones != null && contact.HomePhones.Count != 0) { createResponse = CheckList(contact.HomePhones, createResponse, "HomePhones"); } if (contact.BusinessPhones != null && contact.BusinessPhones.Count != 0) { createResponse = CheckList(contact.BusinessPhones, createResponse, "BusinessPhones"); } if (contact.ImAddresses != null && contact.ImAddresses.Count != 0) { createResponse = CheckList(contact.ImAddresses, createResponse, "ImAddresses"); } // insert email addresses if (contact.EmailAddresses != null && contact.EmailAddresses.Count != 0) { createResponse = CreateEmails(contact.EmailAddresses, createResponse); } // insert address if (contact.HomeAddress != null) { createResponse = CreateAddress(contact.HomeAddress, createResponse, "HomeAddress"); } if (contact.BusinessAddress != null) { createResponse = CreateAddress(contact.BusinessAddress, createResponse, "BusinessAddress"); } if (contact.OtherAddress != null) { createResponse = CreateAddress(contact.OtherAddress, createResponse, "OtherAddress"); } return(createResponse); }