Example #1
0
        /// <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.");
        }