Esempio n. 1
0
        public static int deleteDogFromReservation(int reservationNumber, int petNumber)
        {
            Search search = new HawkeyehvkBLL.Search();

            if (!search.validateReservationNumber(reservationNumber))// check reservation number
            {
                return(1);
            }
            else if (!search.validatePetNumber(petNumber))// check pet number
            {
                return(2);
            }
            else if (!ReservationDB.isDogInReservation(reservationNumber, petNumber))// check that dog is in reservation
            {
                return(3);
            }
            else if (isReservationActive(reservationNumber))//check is res is active
            {
                return(4);
            }
            else
            {
                // before running check if the reservation is going from 3 to 2 dogs in order to remove the discount
                int count = PetReservation.listPetRes(reservationNumber).Count;
                if (count == 3)
                {
                    Discount.deleteReservationDiscount(2, reservationNumber);
                }
                return(ReservationDB.deleteDogFromReservationDB(reservationNumber, petNumber));
            }
        }