Ejemplo n.º 1
0
        /*
         * Transaction: Delete a doctor from the database
         * Returns true iff the doctor exists in the database and
         * it was successfully deleted.
         */
        public static bool DeleteDoctor(Doctor delDoctor)
        {
            Doctor checkDoctor = DoctorPersistence.GetDoctor(delDoctor);

            if (checkDoctor == null)
            {
                return(false);
            }
            return(DoctorPersistence.DeleteDoctor(delDoctor));
        }
Ejemplo n.º 2
0
        /*
         * Transaction: Update a doctor in the database
         * Returns true iff the doctor exists in the database and
         * it was successfully changed.
         */
        public static bool ChangeDoctor(Doctor changeDoctor)
        {
            Doctor checkDoctor = DoctorPersistence.GetDoctor(changeDoctor);

            if (checkDoctor == null)
            {
                return(false);
            }

            return(DoctorPersistence.ChangeDoctor(changeDoctor));
        }
Ejemplo n.º 3
0
        /*
         * Transaction: Add a new doctor to the database
         * Returns true iff the new doctor has a unique ISBN
         * and it was successfully added.
         */
        public static bool AddNewDoctor(Doctor newDoctor)
        {
            // Verify that the doctor doesn't already exist
            Doctor oldDoctor = DoctorPersistence.GetDoctor(newDoctor);

            // oldDoctor should be null, if this is a new doctor
            if (oldDoctor != null)
            {
                return(false);
            }


            return(DoctorPersistence.AddDoctor(newDoctor));
        }