public static Contact GetContact(int contactID) { //Get issue types Contact contact = null; try { ContactDS contacts = GetContacts(); ContactDS.IssueContactTableRow c = (ContactDS.IssueContactTableRow)contacts.IssueContactTable.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.IssueContactTableRow 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); } }
public DataSet ToDataSet() { //Return a dataset containing values for this object ContactDS ds = null; try { ds = new ContactDS(); ContactDS.IssueContactTableRow contact = ds.IssueContactTable.NewIssueContactTableRow(); contact.ID = this._id; contact.FirstName = this._firstname; contact.LastName = this._lastname; contact.FullName = this._fullname; contact.Phone = this._phone; contact.Mobile = this._mobile; contact.Fax = this._fax; contact.Email = this._email; ds.IssueContactTable.AddIssueContactTableRow(contact); } catch (Exception) { } return(ds); }