예제 #1
0
파일: Person.cs 프로젝트: atb666/FitCard
        /// <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.");
        }
예제 #2
0
파일: Person.cs 프로젝트: atb666/FitCard
        /// <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);
        }
예제 #3
0
파일: Person.cs 프로젝트: atb666/FitCard
        /// <summary>
        /// Saves object to database.
        /// </summary>
        private void Save()
        {
            PersonManager manager = new PersonManager();

            manager.Save(this);
        }