private void RunCheckMenuInput(int input, Animal animal) { Dictionary <int, string> dictionary = new Dictionary <int, string>(); switch (input) { case 1: UserInterface.DisplayAnimalInfo(animal); Console.Clear(); return; case 2: UpdateAnimal(animal, dictionary); Console.Clear(); return; case 3: CheckShots(animal); Console.Clear(); return; default: UserInterface.DisplayUserOptions("Input not accepted please select a menu choice"); return; } }
private void RunCheckMenuInput(int input, Animal animal) { switch (input) { case 1: UserInterface.DisplayAnimalInfo(animal); Console.Clear(); break; case 2: UpdateAnimal(animal); Console.Clear(); break; case 3: CheckShots(animal); Console.Clear(); break; case 4: UserInterface.DisplayUserOptions("What room would you like to move the animal to?"); int newRoom = UserInterface.GetIntegerData(); Query.MoveAnimal(animal, newRoom); break; case 5: Query.ChangeAnimalDiet(animal); break; default: UserInterface.DisplayUserOptions("Input not accepted please select a menu choice"); break; } }
private void ApplyForAdoption() { Console.Clear(); UserInterface.DisplayUserOptions("Please enter the ID of the animal you wish to adopt or type reset or exit"); int iD = 0; try { iD = int.Parse(UserInterface.GetUserInput()); } catch (Exception) { } var animal = Query.GetAnimalByID(iD); UserInterface.DisplayAnimalInfo(animal); if (animal.AdoptionStatus == "not adopted") { UserInterface.DisplayUserOptions("Would you like to adopt?"); if ((bool)UserInterface.GetBitData()) { Query.Adopt(animal, client); UserInterface.DisplayUserOptions("Adoption request sent we will hold $75 adoption fee until processed"); } } else { UserInterface.DisplayUserOptions($"Sorry {animal.Name} is not up for adoption."); Console.ReadLine(); ApplyForAdoption(); } }
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(); }
internal static Animal GetAnimalByID(int id) { var animal = db.Animals.Where(a => a.AnimalId == id).SingleOrDefault(); UserInterface.DisplayAnimalInfo(animal); return(animal); }
private void ApplyForAdoption() { Console.Clear(); UserInterface.DisplayUserOptions("Please enter the ID of the animal you wish to adopt or type reset or exit"); int iD = UserInterface.GetIntegerData(); List <int?> animalIds = Query.GetAllAdoptedAnimals(); bool isAdopted = false; foreach (int?id in animalIds) { if (id == iD) { isAdopted = true; } } if (iD < Query.GetMaxAnimalId() && isAdopted == false) { 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 $75 adoption fee until processed"); } } else { UserInterface.DisplayUserOptions("Input not accepted please try again"); ApplyForAdoption(); return; } }
private void RunCheckMenuInput(int input, Animal animal) { switch (input) { case 1: UserInterface.DisplayAnimalInfo(animal); Console.Clear(); return; case 2: UpdateAnimal(animal); Console.Clear(); return; case 3: CheckShots(animal); Console.Clear(); return; case 4: Query.ChangeAnimalRoom(animal); Console.Clear(); return; default: UserInterface.DisplayUserOptions("Input not accepted please select a menu choice"); return; } }
private void ApplyForAdoption() { Console.Clear(); var availableAnimals = Query.GetAvailableAnimals(); var animalList = new List <string>(); animalList.Add("Please enter the ID of the animal you wish to adopt or type reset or exit"); foreach (var adoptable in availableAnimals) { animalList.Add($"{adoptable.ID}. {adoptable.name}: {adoptable.adoptionStatus}"); } UserInterface.DisplayUserOptions(animalList); 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 $75 adoption fee until processed"); Console.ReadKey(); } }
private void CompleteAdoption(ClientAnimalJunction clientAnimalJunction) { UserInterface.DisplayAnimalInfo(clientAnimalJunction.Animal1); UserInterface.DisplayClientInfo(clientAnimalJunction.Client1); UserInterface.DisplayUserOptions("How much have your received for this adoption?"); Query.UpdateAdoptionFeesPaid(clientAnimalJunction, UserInterface.GetIntegerData()); UserInterface.DisplayUserOptions("Would you like to update the adoption status to 'ADOPTED'?"); if ((bool)UserInterface.GetBitData()) { Query.UpdateAdoptionStatus("adopted", clientAnimalJunction); } }
private void ApplyForAdoption() { Console.Clear(); var animal = SearchForAnimal().Single(); 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 $75 adoption fee until processed"); } }
private void ApplyForAdoption() { Console.Clear(); 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 $75 adoption fee until processed"); } }
private void ApproveAdoption(ClientAnimalJunction clientAnimalJunction) { UserInterface.DisplayAnimalInfo(clientAnimalJunction.Animal1); UserInterface.DisplayClientInfo(clientAnimalJunction.Client1); UserInterface.DisplayUserOptions("Would you approve this adoption?"); if ((bool)UserInterface.GetBitData()) { Query.UpdateAdoption(true, clientAnimalJunction); } else { Query.UpdateAdoption(false, clientAnimalJunction); } }
private void ApproveAdoption(Adoption adoption) { UserInterface.DisplayAnimalInfo(adoption.Animal); UserInterface.DisplayClientInfo(adoption.Client); UserInterface.DisplayUserOptions("Do you want to approve this adoption?"); if ((bool)UserInterface.GetBitData()) { Query.UpdateAdoption(true, adoption); } else { Query.UpdateAdoption(false, adoption); } }
private void ApproveAdoption(Adoption adoption) { UserInterface.DisplayAnimalInfo(adoption.Animal); UserInterface.DisplayClientInfo(adoption.Client); UserInterface.DisplayUserOptions("Would you approve this adoption?"); if ((bool)UserInterface.GetBitData()) { Query.UpdateAdoption(true, adoption); Query.ChargeAdoptionFee(adoption, employee); } else { Query.UpdateAdoption(false, adoption); } }
private void ApproveAdoption(Adoption adoption) { UserInterface.DisplayAnimalInfo(adoption.Animal); UserInterface.DisplayClientInfo(adoption.Client); UserInterface.DisplayUserOptions("Would you approve this adoption?"); if ((bool)UserInterface.GetBitData()) { Query.UpdateAdoption(true, adoption); HumaneSocietyBankAccount += 200; } else { Query.UpdateAdoption(false, adoption); } }
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]); } }
private void ApplyForAdoption() { Console.Clear(); 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); if (animal == null) { UserInterface.DisplayUserOptions("That animal does not exist in our database. Press any key to go back to the main menu."); Console.ReadLine(); RunUserMenus(); } 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 $75 adoption fee until processed"); } }
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(); }
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(); }
private void ApplyForAdoption() { Console.Clear(); 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 (UserInterface.GetBitData() == true) { if (animal.AdoptionStatus == "adopted" || animal.AdoptionStatus == "Adopted") { Console.WriteLine("This animal has already been adopted."); Console.ReadLine(); } else { Query.Adopt(animal, client); UserInterface.DisplayUserOptions("Adoption request sent we will hold $75 adoption fee until processed"); } } }
private void ApplyForAdoption() { Console.Clear(); 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); //add if else for animal availability if (animal.AdoptionStatus != "Available") { UserInterface.DisplayUserOptions("Animal is not available for adoption"); UserInterface.Pause(); return; } 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 $75 adoption fee until processed"); UserInterface.Pause(); } }