private void RemoveAnimal()
        {
            var animals = SearchForAnimal().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found please refine your search.");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Press enter to continue");
                Console.ReadLine();
                return;
            }
            else if (animals.Count < 1)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            var           animal  = animals[0];
            List <string> options = new List <string>()
            {
                "Animal found:", animal.Name, animal.Species.Name, "would you like to delete?"
            };

            if ((bool)UserInterface.GetBitData(options))
            {
                Query.RemoveAnimal(animal);
            }
        }
        private void RemoveAnimal() //Useful to look at when removing from table in adoption method
        {
            var updates = UserInterface.GetAnimalSearchCriteria();
            var animals = Query.SearchForAnimalsByMultipleTraits(updates).ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found please refine your search.");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Press enter to continue");
                Console.ReadLine();
                return;
            }
            else if (animals.Count < 1)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            var           animal  = animals[0];
            List <string> options = new List <string>()
            {
                "Animal found:", animal.Name, animal.Category.Name, "would you like to delete?"
            };

            if ((bool)UserInterface.GetBitData(options))
            {
                Query.RemoveAnimal(animal);
            }
        }
        private void RemoveAnimal()

        {
            Dictionary <int, string> searchParameters = UserInterface.GetAnimalCriteria();
            var animals = Query.SearchForAnimalByMultipleTraits(searchParameters).ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found please refine your search.");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Press enter to continue");
                Console.ReadLine();
                return;
            }
            else if (animals.Count < 1)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            else
            {
                var           animal    = animals[0];
                List <string> selection = new List <string>()
                {
                    "Animal found:", animal.Name, animal.Specy.Name, "would you like to delete?"
                };
                if ((bool)UserInterface.GetBitData(selection))
                {
                    Query.RemoveAnimal(animal);
                }
            }
        }
        private void MoveAnimal()
        {
            var animals = SearchForAnimal().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found please refine your search.");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Press enter to continue");
                Console.ReadLine();
                return;
            }
            else if (animals.Count < 1)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            var  animal = animals[0];
            Room room;

            do
            {
                int roomNumber = UserInterface.AskForRoom(animal);
                room = Query.GetRoomById(roomNumber);
            }while (room == default(Room));
            Room oldRoom = Query.GetRoom(animal.AnimalId);

            Query.MoveAnimal(animal, oldRoom, room);
            RunUserMenus();
        }
Exemple #5
0
        private void RunSearch()
        {
            Console.Clear();
            var animals = SearchForAnimal().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animals);
                Console.ReadLine();
            }
            else if (animals.Count == 0)
            {
                UserInterface.DisplayUserOptions("No animals found please try another search");
                Console.ReadLine();
                RunUserMenus();
            }
            else
            {
                UserInterface.DisplayAnimalInfo(animals[0]);
                Console.ReadLine();
            }
            UserInterface.DisplayUserOptions("Press enter to continue");
            Console.ReadLine();
        }
        private void RemoveAnimal()
        {
            Dictionary <int, string> searchDictionary = UserInterface.GetAnimalCriteria();
            var animals = Query.SearchForAnimalByMultipleTraits(searchDictionary).ToList();

            while (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found please refine your search.");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Press enter to continue searching");
                Console.ReadLine();
                searchDictionary = UserInterface.GetAnimalCriteria();
                animals          = Query.SearchForAnimalByMultipleTraits(searchDictionary).ToList();
            }
            if (animals.Count < 1)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            var           animal  = animals[0];
            List <string> options = new List <string>()
            {
                "Animal found:", animal.Name, animal.Category.Name, "would you like to delete?"
            };

            if ((bool)UserInterface.GetBitData(options))
            {
                Query.RemoveAnimal(animal);
            }
            else
            {
                UserInterface.DisplayUserOptions("Animal was not deleted. Press any key to continue.");
                Console.ReadLine();
            }
        }
Exemple #7
0
        private void ApplyForAdoption()
        {
            HumaneSocietyDataContext db = new HumaneSocietyDataContext();

            Console.Clear();
            UserInterface.DisplayAnimals(db.Animals.ToList());
            UserInterface.DisplayUserOptions("Please enter the ID of the animal you wish to adopt or type reset or exit");
            int iD     = UserInterface.GetIntegerData();
            var animal = Query.GetAnimalByID(iD);

            UserInterface.DisplayAnimalInfo(animal);
            UserInterface.DisplayUserOptions("Would you like to adopt?");
            if ((bool)UserInterface.GetBitData())
            {
                Query.Adopt(animal, client);
                UserInterface.DisplayUserOptions($"Adoption request sent we will hold ${Admin.AdoptionFee} adoption fee until processed");
            }
        }
        private void RunSearch(IQueryable <Animal> animals)
        {
            List <Animal> animalsList = animals.ToList();

            Console.Clear();
            if (animalsList.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animalsList);
                RunSearch(Query.SearchAnimalsByTrait(animals));
            }
            else if (animalsList.Count == 0)
            {
                UserInterface.DisplayUserOptions("No animals found please try another search");
            }
            else
            {
                UserInterface.DisplayAnimalInfo(animalsList[0]);
            }
        }
Exemple #9
0
        private void FindAnimal()
        {
            Console.Clear();
            var animals = SearchForAnimal().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Enter the ID of the animal you would like to check");
                int ID = UserInterface.GetIntegerData();
                UpdateRoom(ID);
                return;
            }
            if (animals.Count == 0)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
        }
Exemple #10
0
        private void CheckAnimalStatus()
        {
            Console.Clear();
            var animals = Query.SearchForAnimalByMultipleTraits().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Enter the ID of the animal you would like to check");
                int ID = UserInterface.GetIntegerData();
                CheckAnimalStatus(ID);
                return;
            }
            if (animals.Count == 0)
            {
                UserInterface.DisplayUserOptions("Animal not found please use different search criteria");
                return;
            }
            RunCheckMenu(animals[0]);
        }
        private void RunSearch()
        {
            Console.Clear();
            var animals = Query.SearchForAnimalByMultipleTraits(UserInterface.GetAnimalCriteria()).ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animals);
            }
            else if (animals.Count == 0)
            {
                UserInterface.DisplayUserOptions("No animals found please try another search");
            }
            else
            {
                UserInterface.DisplayAnimalInfo(animals[0]);
            }
            UserInterface.DisplayUserOptions("Press enter to continue");
            Console.ReadLine();
        }
Exemple #12
0
        private void RunSearchMultipleTraits(List <Animal> animals = null)
        {
            Console.Clear();

            if (animals == null)
            {
                animals = Query.GetAnimal();
            }

            animals = SearchForAnimals().ToList();

            if (animals.Count > 1)
            {
                UserInterface.DisplayUserOptions("Several animals found");
                UserInterface.DisplayAnimals(animals);
                UserInterface.DisplayUserOptions("Search by more traits to narrow it down? Or start over? Yes continues search.  'yes' or 'no' ");
                string input = UserInterface.GetUserInput();
                if (input == "yes")
                {
                    RunSearchMultipleTraits(animals);
                }
                else
                {
                    RunUserMenus();
                }
            }
            else if (animals.Count == 0)
            {
                UserInterface.DisplayUserOptions("No animals found please try another search");
                RunUserMenus();
            }
            else
            {
                UserInterface.DisplayUserOptions("One result was found!");
                UserInterface.DisplayAnimalInfo(animals[0]);
            }
            UserInterface.DisplayUserOptions("Press enter to continue");
            Console.ReadLine();
        }
Exemple #13
0
        private void DisplayRooms()
        {
            var rooms = Query.DisplayRooms();

            UserInterface.DisplayAnimals(rooms);
        }
 private void RemoveAnimal()
 {
     UserInterface.DisplayAnimals(Query.SearchForAnimalByMultipleTraits().ToList());
     Console.WriteLine("Please enter the ID of the animal you would like to delete.");
     Query.RemoveAnimal(UserInterface.GetIntegerData("of the Animal?", "the ID"));
 }