/// <summary> /// Loads a Person from the database. /// Precondition: Must not be editing. /// Precondition: Must be new. /// Postcondition: Object is in a valid state. /// </summary> public void Load(string socialSecurityNumber) { Trace.Assert(!isEditing, "Must not be editing."); Trace.Assert(isNew, "Must be new."); // Load the object PersonManager manager = new PersonManager(); PersonProperties properties = manager.Load(socialSecurityNumber); Trace.Assert(properties.IsPopulated, "Person must have all its properties set."); this.SetState(properties); isNew = false; Trace.Assert(IsValid, "Should be valid."); }
/// <summary> /// Deletes object from database. /// </summary> /// <param name="socialSecurityNumber">Social Security Number.</param> private void Delete(string socialSecurityNumber) { PersonManager manager = new PersonManager(); manager.Delete(socialSecurityNumber); }
/// <summary> /// Saves object to database. /// </summary> private void Save() { PersonManager manager = new PersonManager(); manager.Save(this); }