/// <summary> /// sets a phone number if it's not null /// </summary> /// <param name="exchangeContact"> /// The exchange contact. /// </param> /// <param name="address"> /// The phone number type to be set. /// </param> /// <param name="value"> /// The value (the phone number). /// </param> private static void SetPhoneNumber(this Contact exchangeContact, PhoneNumberKey address, string value) { if (!string.IsNullOrEmpty(value)) { exchangeContact.PhoneNumbers[address] = value; } }
private static string GetPhoneNumber(Contact value, PhoneNumberKey key) { try { if (value.PhoneNumbers.TryGetValue(key, out var phoneNumber)) { return(phoneNumber); } } catch (ServiceObjectPropertyException) { } return(null); }
private static void SyncTelefono(PhoneNumberKey phoneNumberKey, IdentificacionTipo identificacionTipo, Contact contact, Persona persona, IObjectSpace objectSpace, Identificadores config) { if (identificacionTipo == null) { identificacionTipo = config.IdentificacionTipoTelOtro; } if (contact.PhoneNumbers.Contains(phoneNumberKey)) { var phone = contact.PhoneNumbers[phoneNumberKey]; SyncIdentificacion(persona, identificacionTipo, objectSpace, phone, phoneNumberKey.ToString( )); } }
/// <summary> /// Gets a phone number entry if it's defined - null if the number is not defined in this contact. /// </summary> /// <param name="contact"> /// The contact potentially containing the phone number. /// </param> /// <param name="phoneKey"> /// The phone number Key. /// </param> /// <returns> /// The phone number entry. /// </returns> private static string GetPhone(this Contact contact, PhoneNumberKey phoneKey) { return(contact.PhoneNumbers.Contains(phoneKey) ? contact.PhoneNumbers[phoneKey] : null); }
private void dieInfoAdressenAuslesen() { this.dataSet1.Adressen.Clear(); foreach (var adr in this.alleAdressen) { DAL.DataSet1.AdressenRow row = this.dataSet1.Adressen.NewAdressenRow(); try { string nachname = (adr.Surname == null) ? "" : adr.Surname; row.Nachname = nachname; string vorname = (adr.GivenName == null) ? "" : adr.GivenName; row.Vorname = vorname; if (adr.Categories.Count > 0) { string categories = ""; foreach (var item in adr.Categories) { categories += item + " "; } row.Categories = categories; } row.Name = (vorname.Count() > 0) ? vorname + " " + nachname : nachname; row.Firmenname = (adr.CompanyName == null) ? "" : adr.CompanyName; row.businessHomePage = (adr.BusinessHomePage == null) ? "" : adr.BusinessHomePage; row.FileAs = (adr.FileAs == null) ? "" : adr.FileAs; row.ID = adr.Id.UniqueId; row.JobTitle = (adr.JobTitle == null) ? "" : adr.JobTitle; if (adr.DisplayName != null) { adr.DisplayName = (adr.GivenName == null) ? "" : adr.GivenName + " "; adr.DisplayName += (adr.Surname == null) ? "" : adr.Surname; } row.Matchcode = row.Firmenname + ", " + "(" + row.Name + "), "; PhysicalAddressEntry entry; PhysicalAddressKey key = PhysicalAddressKey.Business; if (adr.PhysicalAddresses.TryGetValue(key, out entry)) { row.Strasse = (entry.Street == null) ? "" : entry.Street; row.Ort = (entry.City == null) ? "" : entry.City; row.PLZ = (entry.PostalCode == null) ? "" : entry.PostalCode; row.Land = (entry.CountryOrRegion == null) ? "" : entry.CountryOrRegion; row.PLZundORT = row.PLZ + " " + row.Ort; row.Matchcode += row.PLZundORT; } //PhysicalAddressEntry pEntry; //PhysicalAddressKey pKey = PhysicalAddressKey.Business; //if (adr.PostalAddressIndex.HasValue) //{ // row.Strasse = (entry.Street == null) ? "" : entry.Street; // row.Ort = (entry.City == null) ? "" : entry.City; // row.PLZ = (entry.PostalCode == null) ? "" : entry.PostalCode; // row.Land = (entry.CountryOrRegion == null) ? "" : entry.CountryOrRegion; // row.PLZundORT = row.PLZ + " " + row.Ort; // row.Matchcode += row.PLZundORT; //} EmailAddress eAdress1; EmailAddressKey eKey1 = EmailAddressKey.EmailAddress1; if (adr.EmailAddresses.TryGetValue(eKey1, out eAdress1)) { row.Email1Adresse = eAdress1.Address; } else { row.Email1Adresse = ""; } EmailAddress eAdress2; EmailAddressKey eKey2 = EmailAddressKey.EmailAddress2; if (adr.EmailAddresses.TryGetValue(eKey2, out eAdress2)) { row.Email2Adresse = eAdress2.Address; } else { row.Email2Adresse = ""; } string buissnessNr = ""; PhoneNumberKey pKey = PhoneNumberKey.BusinessPhone; if (adr.PhoneNumbers.TryGetValue(pKey, out buissnessNr)) { row.Telefon1 = buissnessNr; } else { row.Telefon1 = ""; } string mobileNR = ""; PhoneNumberKey mKey = PhoneNumberKey.MobilePhone; if (adr.PhoneNumbers.TryGetValue(mKey, out mobileNR)) { row.TelefonMobile = mobileNR; } else { row.Telefon1 = ""; } } catch (Exception ex) { Helper.LogHelper.WriteDebugLog(ex.ToString()); } this.dataSet1.Adressen.AddAdressenRow(row); } }