Exemple #1
0
        public e removePet(int petNumber)
        {
            e errCode = e.success;


            PetReservation        petRes     = new PetReservation();
            List <PetReservation> petResList = petRes.ListPetReservations().FindAll(p => p.petNum == petNumber);

            Reservation res = new Reservation();

            for (int i = 0; i < petResList.Count; i++)
            {
                if (res.ListActiveReservation().Find(r => r.number == petResList[i].reservationNum) != null)
                {
                    errCode = e.petInRes;
                }
            }

            if (errCode == e.success)
            {
                PetDB petDB = new PetDB();
                if (petDB.Delete(petNumber) == false)
                {
                    errCode = e.deleteFail;
                }
            }
            return(errCode);
        }
Exemple #2
0
        //Deletes one dog and all the related services for that dog from a reservation.
        //If there is only one dog in the reservation, the reservation is cancelled.
        public int DeleteDogFromReservation(int reservationNumber, int petNumber)
        {
            e errCode = e.success;

            if (Validation.invalidRes(reservationNumber))
            {
                errCode = e.invalidRes;
            }
            else if (Validation.invalidPet(petNumber))
            {
                errCode = e.invalidPet;
            }
            else if (Validation.petNotInRes(petNumber, reservationNumber))
            {
                errCode = e.petNotInRes;
            }
            else
            {
                PetReservation petRes = new PetReservation();
                Service        serv   = new Service();
                foreach (PetReservation pr in petRes.ListPetReservations().Where(pr => pr.reservationNum == reservationNumber))
                {
                    serv.Delete(pr.petResNum);
                }
                petRes.RemovePetFromRes(petNumber, reservationNumber);
            }
            return(Convert.ToInt16(errCode));
        }
        public static List <PetReservation> ListPetReservationsDir()
        {
            PetReservation pr = new PetReservation();

            return(pr.ListPetReservations());
        }