public Contact GetContact(int contactID) { //Get issue types Contact contact = null; try { ContactDS contacts = GetContacts(); ContactDS.ContactTableRow c = (ContactDS.ContactTableRow)contacts.ContactTable.Select("ID=" + contactID)[0]; contact = new Contact(c); } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading contact.", ex); } return(contact); }
public Contact(ContactDS.ContactTableRow contact) { //Constructor try { if (contact != null) { if (!contact.IsIDNull()) { this._id = contact.ID; } if (!contact.IsFirstNameNull()) { this._firstname = contact.FirstName; } if (!contact.IsLastNameNull()) { this._lastname = contact.LastName; } if (!contact.IsFullNameNull()) { this._fullname = contact.FullName; } else { this._fullname = this._firstname + " " + this._lastname; } if (!contact.IsPhoneNull()) { this._phone = contact.Phone; } if (!contact.IsMobileNull()) { this._mobile = contact.Mobile; } if (!contact.IsFaxNull()) { this._fax = contact.Fax; } if (!contact.IsEmailNull()) { this._email = contact.Email; } } } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Contact instance.", ex); } }