예제 #1
0
        public void AddDog()
        {
            DogCage dogCage = new DogCage();

            runInterface.dogCageList.Add(dogCage);
            AskEnterNewAnimal();
        }
예제 #2
0
        //private int askAmount(string animalType)
        //{
        //    Console.Write("Enter Amount of %s Cages: ", animalType);
        //    int amount = Console.Read();
        //    return amount;
        //}
        void createDogCages()
        {
            DogCage newCage = new DogCage();

            newCage.cageID = (++lastCageID);
            dogCages.Add(newCage);
            Console.WriteLine(" ");
            Console.WriteLine("One Dog Cage Added. Total Dog Cages = {0}", dogCages.Count);
        }
예제 #3
0
        public DogCage getThisDogCage(int cageID)
        {
            DogCage adogCage = null;

            foreach (DogCage aCage in dogCages)
            {
                if (aCage.cageID == cageID)
                {
                    adogCage = aCage;
                }
            }

            return(adogCage);
        }
예제 #4
0
        public void removeDog(int cageID, Cages theCages)
        {
            Dog theDog = null;

            if (cageID == 0)
            {
                throw new System.NotImplementedException("remove Dog no valid cageID");
            }

            DogCage theDogCage = theCages.getThisDogCage(cageID);
            theDogCage.cageStatus = 0;          //set cage to empty so it can be used by another pet.
            theDog = theDogCage.removeDog();    // remove the Dog object reference from the cage object.
            Console.WriteLine("Dog {0} is in Cage {1}", theDog.Name, theDog.cageID);
            theDog.adopted = true;
            Dogs.Remove(theDog);                // remove the Dog object from the list of Dogs

        }
예제 #5
0
        private void addDog(DogCage aCage)
        {
            if (aCage == null)
            {
                return;
               // throw new System.NotImplementedException("addDog no cages null");
            }

            Dog aDog = new Dog();
            Console.Write("Enter new dog's name: ");
            string name = Console.ReadLine();
            aDog.Name = name;
            aDog.cageID = aCage.cageID;
            aCage.addDog(aDog);
            Dogs.Add(aDog);

        }
예제 #6
0
        public DogCage getDogCage()
        {
            DogCage adogCage = null;

            foreach (var aCage in dogCages)
            {
                if (aCage.isCageEmpty())
                {
                    adogCage = aCage;
                    break;
                }
            }
            if (adogCage == null)
            {
                int currxPos = Console.CursorLeft;
                Console.Write("Sorry. No open cages at this time. Hit a key to continue.");
                Console.ReadKey();
                Console.SetCursorPosition(currxPos - 1, Console.CursorTop);                    // move the cursor up Nine lines to paint next menu on top.
                Console.Write("                                                            "); // to erase the last message
            }
            return(adogCage);
        }