/// <summary> /// Get item from record. /// </summary> private void RecordToItem(TPC.ContactsRecord record, RecordItem item) { item.DisplayName = record.Get <string>(Contact.DisplayName); item.Index = record.Get <int>(Contact.Id); if (record.GetChildRecordCount(Contact.Name) > 0) { var name = record.GetChildRecord(Contact.Name, 0); item.First = name.Get <string>(Name.First); item.Last = name.Get <string>(Name.Last); } if (record.GetChildRecordCount(Contact.Number) > 0) { var number = record.GetChildRecord(Contact.Number, 0); item.Number = number.Get <string>(Number.NumberData); } if (record.GetChildRecordCount(Contact.Email) > 0) { var email = record.GetChildRecord(Contact.Email, 0); item.Email = email.Get <string>(Email.Address); } if (record.GetChildRecordCount(Contact.URL) > 0) { var url = record.GetChildRecord(Contact.URL, 0); item.Url = url.Get <string>(URL.URLData); } if (record.GetChildRecordCount(Contact.Company) > 0) { var company = record.GetChildRecord(Contact.Company, 0); item.Company = company.Get <string>(Company.Label); } if (record.GetChildRecordCount(Contact.Event) > 0) { var ievent = record.GetChildRecord(Contact.Event, 0); item.Event = ievent.Get <int>(Event.Date); } if (record.GetChildRecordCount(Contact.Note) > 0) { var note = record.GetChildRecord(Contact.Note, 0); item.Note = note.Get <string>(Note.Contents); } }
/// <summary> /// Clean child record. /// </summary> private void CleanChildRecord(TPC.ContactsRecord record) { if (record.GetChildRecordCount(Contact.Name) > 0) { var name = record.GetChildRecord(Contact.Name, 0); record.RemoveChildRecord(Contact.Name, name); } if (record.GetChildRecordCount(Contact.Number) > 0) { var number = record.GetChildRecord(Contact.Number, 0); record.RemoveChildRecord(Contact.Number, number); } if (record.GetChildRecordCount(Contact.Email) > 0) { var email = record.GetChildRecord(Contact.Email, 0); record.RemoveChildRecord(Contact.Email, email); } if (record.GetChildRecordCount(Contact.URL) > 0) { var url = record.GetChildRecord(Contact.URL, 0); record.RemoveChildRecord(Contact.URL, url); } if (record.GetChildRecordCount(Contact.Company) > 0) { var company = record.GetChildRecord(Contact.Company, 0); record.RemoveChildRecord(Contact.Company, company); } if (record.GetChildRecordCount(Contact.Event) > 0) { var ievent = record.GetChildRecord(Contact.Event, 0); record.RemoveChildRecord(Contact.Event, ievent); } if (record.GetChildRecordCount(Contact.Note) > 0) { var note = record.GetChildRecord(Contact.Note, 0); record.RemoveChildRecord(Contact.Note, note); } }