/// <summary> /// Sets a <see cref="PhysicalAddressEntry"/> inside a <see cref="Contact"/> by getting the data from a <see cref="AddressDetail"/> /// </summary> /// <param name="exchangeContact"> /// The exchange contact that should get the <see cref="PhysicalAddressEntry"/> created with this data. /// </param> /// <param name="address"> /// The <see cref="PhysicalAddressKey"/> describing the kind of address to set. /// </param> /// <param name="value"> /// The <see cref="AddressDetail"/> to be parsed and set into the <see cref="PhysicalAddressEntry"/>. /// </param> private static void SetAddress(this Contact exchangeContact, PhysicalAddressKey address, AddressDetail value) { if (value == null) { return; } var exchangeAddress = new PhysicalAddressEntry { City = value.CityName, CountryOrRegion = value.CountryName, PostalCode = value.PostalCode, State = value.StateName, Street = value.StreetName }; exchangeContact.PhysicalAddresses[address] = exchangeAddress; }
private static void SyncDireccion(PhysicalAddressKey physicalAddressKey, DireccionTipo direccionTipo, Contact contact, Persona persona, IObjectSpace objectSpace, List <ParPersonaDireccionDireccion> paresDirecciones) { if (contact.PhysicalAddresses.Contains(physicalAddressKey) && direccionTipo != null) { Direccion direccion; var homeAddr = contact.PhysicalAddresses[physicalAddressKey]; var personaDir = persona.Direcciones.FirstOrDefault(r => r.DireccionTipo.Oid == direccionTipo.Oid); if (personaDir == null) { personaDir = objectSpace.CreateObject <PersonaDireccion>( ); personaDir.DireccionTipo = objectSpace.GetObjectByKey <DireccionTipo>(direccionTipo.Oid); persona.Direcciones.Add(personaDir); direccion = objectSpace.CreateObject <Direccion>( ); paresDirecciones.Add(new ParPersonaDireccionDireccion { Direccion = direccion, PersonaDireccion = personaDir }); } else { direccion = personaDir.Direccion; } direccion.Calle = homeAddr.Street; direccion.CiudadOtra = homeAddr.City; direccion.ProvinciaOtra = homeAddr.State; direccion.PaisOtro = homeAddr.CountryOrRegion; direccion.CodigoPostal = homeAddr.PostalCode; direccion.Save( ); } }
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; string vorname = (adr.GivenName == null) ? "" : adr.GivenName; 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; } 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 = ""; } StringList _categories = (adr.Categories == null) ? new StringList() : adr.Categories; } catch (Exception ex) { Helper.LogHelper.WriteDebugLog(ex.ToString()); } this.dataSet1.Adressen.AddAdressenRow(row); } }
/// <summary> /// Gets an address entry if it's defined - null if the address is not defined in this contact. /// </summary> /// <param name="contact"> /// The contact potentially containing the address. /// </param> /// <param name="addressKey"> /// The address Key. /// </param> /// <returns> /// The address entry. /// </returns> private static PhysicalAddressEntry GetAddress(this Contact contact, PhysicalAddressKey addressKey) { return(contact.PhysicalAddresses.Contains(addressKey) ? contact.PhysicalAddresses[addressKey] : 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); } }