public void ChangeShotStatus(Guid input) { var Query = from search in humaneSocietyDataBase.Animals where search.animalID == input select search; foreach (Animal item in Query) { string newShotStatus = UserUI.GetStringInput(item.name + "'s shot status is " + item.Shots + ". What would you like to change " + item.name + "'s Shot Status to? Enter 'true' or 'false'"); bool s; if (newShotStatus == "true") { s = true; } else if (newShotStatus == "false") { s = false; } else { s = true; } item.Shots = s; humaneSocietyDataBase.SubmitChanges(); } }
private void PickTheTask(string choice) { switch (choice) { case "1": EnterBio(); ConfirmBio(); AddBioToDatabase(); break; case "2": WhichSearchToExicute(); break; case "back": MainMenu.Run(); break; case "exit": break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); Run(); break; } }
private static void SelectUserType(string choice) { switch (choice) { case "adopter": Adopter adopter = new Adopter(); Console.Clear(); adopter.Run(); break; case "employee": EmployeePortal employeePortal = new EmployeePortal(); Console.Clear(); employeePortal.Run(); break; case "exit": break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); Run(); break; } }
public void Run() { string choice = UserUI.GetStringInput("What would you like to do? \n Add Animal to database: '1' \n View Adopter Bio: '2' \n Update Animal Bio: '3' \n Add CSV file to database: '4' \n View all animals in the database: '5' \n To go back: 'back' \n Exit the porgram: 'exit'" ); PickTheTask(choice); }
public void ConfirmAnimal() { foreach (string a in animalInputs) { UserUI.DisplayMessage(a); } string confirmInformation = UserUI.GetStringInput("is all your information correct? if yes enter 'y', if no enter 'n'"); switch (confirmInformation) { case "y": break; case "n": Console.Clear(); EnterNewAnimal(); break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); ConfirmAnimal(); break; } }
public void WhichSearchToExicute() { string input = UserUI.GetStringInput("what would you like to search by? 'adopter ID','first name','last name','first and last name','age','personality','species','breed'"); switch (input) { case "adopter ID": string idInput = UserUI.GetStringInput("Type in a UserID with dashes:"); Guid Guid = new Guid(idInput); SearchByID(Guid); break; case "first name": string firstNameInput = UserUI.GetStringInput("Type in a user's first name:"); SearchByFirstName(firstNameInput); break; case "last name": string lastNameInput = UserUI.GetStringInput("Type in a user's Last name:"); SearchByLastName(lastNameInput); break; case "first and last name": string firstName = UserUI.GetStringInput("Type in the user's first name:"); string lastName = UserUI.GetStringInput("Type in the user's first name:"); SearchByFullName(firstName, lastName); break; case "age": int ageInput = Convert.ToInt32(UserUI.GetStringInput("Type in a user's age:")); SearchByAge(ageInput); break; case "personality": string personalityInput = UserUI.GetStringInput("Type in a user's personality preference:"); SearchByPersonality(personalityInput); break; case "species": string speciesInput = UserUI.GetStringInput("Type in a user's speices preference:"); SearchBySpecies(speciesInput); break; case "breed": string breedInput = UserUI.GetStringInput("Type in a user's speices preference:"); SearchByBreed(breedInput); break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); WhichSearchToExicute(); break; } }
public void EnterBio() { UserUI.DisplayMessage("We here at the Humane Society Like to match our perspective Adopters with the animals we think would be a good fit for them. This is a Short Bio for you to fill out so that our Caretakers can match you with the right animal. We will ask you some questions and gather you animal preferance so we can better decide which animal is right for you."); Console.Clear(); bioInputs.Insert(0, UserUI.GetStringInput("What is your first name?")); bioInputs.Insert(1, UserUI.GetStringInput("What is your last name?")); bioInputs.Insert(2, UserUI.GetStringInput("How old are you? Enter a number")); bioInputs.Insert(3, UserUI.GetStringInput("What is your personality type? 'lounge and relax','laid back','semi-active','active mover', or 'never stop moving'")); bioInputs.Insert(4, UserUI.GetStringInput("What kind of animal are you intreseted in(eg dog, cat, bird, ferret, bunny, etc.)?")); bioInputs.Insert(5, UserUI.GetStringInput("What breed are you most interested in? you can write 'n/a' or 'none' if you're not sure")); }
public void ChangeAnimalPrice(Guid input) { var Query = from search in humaneSocietyDataBase.Animals where search.animalID == input select search; foreach (Animal item in Query) { decimal newName = UserUI.GetDecimalInput(item.name + "'s adoption price is $" + item.price + ". What would you like to change " + item.name + "'s price to? Enter new price:"); item.price = newName; humaneSocietyDataBase.SubmitChanges(); } }
public void ChangeAnimalName(Guid input) { var Query = from search in humaneSocietyDataBase.Animals where search.animalID == input select search; foreach (Animal item in Query) { string newName = UserUI.GetStringInput("What would you like to change " + item.name + "'s name to? Enter new name:"); item.name = newName; humaneSocietyDataBase.SubmitChanges(); } }
public void EnterNewAnimal() { animalInputs.Insert(0, UserUI.GetStringInput("What is the animal's name?")); animalInputs.Insert(1, UserUI.GetStringInput("What is the animal's species?")); animalInputs.Insert(2, UserUI.GetStringInput("What is the animal's breed?")); animalInputs.Insert(3, UserUI.GetStringInput("what room are they in?")); //int animalInputs.Insert(4, UserUI.GetStringInput("is the animal up for adoption? 'y' or 'n'")); //bool animalInputs.Insert(5, UserUI.GetStringInput("What is the animal's food type?")); animalInputs.Insert(6, UserUI.GetStringInput("How much of said food should the animal get per week?")); animalInputs.Insert(7, UserUI.GetStringInput("What is the animal's Personality type? 'lounge and relax','laid back','semi-active','active mover', or 'never stop moving'")); animalInputs.Insert(8, UserUI.GetStringInput("What is the adoption price for this animal?")); animalInputs.Insert(9, UserUI.GetStringInput("Does the animal have its Shots?")); }
public static void Run() { try { string choice = UserUI.GetStringInput("Welcome to the Humane Society Pet Adoption Database. To get started, type 'start' or to close out, type 'exit'"); StatOrEndProgram(choice); } catch { UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); Run(); } }
public void AddBioToDatabase() { Adopter adopter = new Adopter(); adopter.adopterID = System.Guid.NewGuid(); adopter._adopterFirstName = bioInputs[0]; adopter._adopterLastName = bioInputs[1]; adopter._age = Convert.ToInt32(bioInputs[2]); adopter._personallityType = bioInputs[3]; adopter._animalSpeciesPref = bioInputs[4]; adopter._animalBreedPref = bioInputs[5]; humaneSocietyDataBase.Adopters.InsertOnSubmit(adopter); humaneSocietyDataBase.SubmitChanges(); UserUI.DisplayMessage("Thank you for your interest in our animals here at the Humane Society."); Console.ReadLine(); Console.Clear(); Run(); }
public void UpdateAnimal() { UserUI.DisplayMessage("You can search for an animal to update its adoption status, change it's name, change its price, or update it's shots."); string idInput = UserUI.GetStringInput("Type in a animalID with dashes:"); try { Guid guid = new Guid(idInput); string choice = UserUI.GetStringInput("What would you like to update? 'adoption','name', 'price' or 'shots'"); switch (choice) { case "adoption": ChageAdoptionStatus(guid); break; case "name": ChangeAnimalName(guid); break; case "price": ChangeAnimalPrice(guid); break; case "shots": ChangeShotStatus(guid); break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); UpdateAnimal(); break; } } catch { UserUI.DisplayMessage("Oops! You entered a wrong GUID! try again."); Console.ReadLine(); Console.Clear(); UpdateAnimal(); } }
public void PickTheTask(string choice) { switch (choice) { case "1": EnterNewAnimal(); ConfirmAnimal(); AddAnimalToDatabase(); NextAdd(); break; case "2": WhichSearchToExicute(); break; case "3": UpdateAnimal(); break; case "4": string filePath = UserUI.GetStringInput("What is the filepath of the CSV file you want to add to the database? Copy and past the file path below:"); ImportCSVFile(filePath); break; case "5": ShowAll(); break; case "back": MainMenu.Run(); break; case "exit": break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); Run(); break; } }
public void WhichSearchToExicute() { string input = UserUI.GetStringInput("what would you like to search by? 'animal name','species','breed','personality','price', or 'all available'"); switch (input) { case "animal name": string name = UserUI.GetStringInput("What is the name of the animal you are looking for?"); SearchByName(name); break; case "species": string species = UserUI.GetStringInput("What species of animal are you are looking for?"); SearchBySpecies(species); break; case "breed": string breed = UserUI.GetStringInput("What breed of animal you are looking for?"); SearchByBreed(breed); break; case "personality": string personality = UserUI.GetStringInput("What is the name of the animal you are lookiing for?"); SearchByPersonality(personality); break; case "price": decimal priceChoice = UserUI.GetDecimalInput("What is the name of the animal you are lookiing for?"); SearchByPrice(priceChoice); break; case "all available": ShowAllAvailable(); break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); WhichSearchToExicute(); break; } }
private static void StatOrEndProgram(string choice) { switch (choice) { case "start": Console.Clear(); SelectUserType(UserUI.GetStringInput("Are you an adopter here to adopt an anaimal or Are you an employee? Type 'adopter' or 'employee' or, to close out, type 'exit'")); break; case "exit": break; default: UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); Run(); break; } }
public void NextAdd() { string finishInput = UserUI.GetStringInput("Would you like to add another animal? 'y' for yes and 'n' to go back to the main menu."); if (finishInput == "y") { EnterNewAnimal(); ConfirmAnimal(); AddAnimalToDatabase(); } else if (finishInput == "n") { Run(); } else { UserUI.DisplayMessage("Oops! You entered a wrong message! try again."); Console.ReadLine(); Console.Clear(); NextAdd(); } }
public void Run() { string choice = UserUI.GetStringInput("what would you like to do? \n Enter a bio: '1' \n Search for an animal: '2' \n To go back: 'back' \n Exit the porgram: 'exit'"); PickTheTask(choice); }
public void ImportCSVFile(string filePath) { try { IEnumerable <string> csvLines; csvLines = File.ReadAllLines(filePath); var query = from csvline in csvLines let data = csvline.Split(',') select new { name = data[0], species = data[1], breed = data[2], roomNumber = data[3], adoptionAvailability = data[4], foodType = data[5], foodAmount = data[6], personalityType = data[7], price = data[8], Shots = data[9] }; foreach (var data in query) { Animal animal = new HumaneSociety.Animal(); animal.animalID = System.Guid.NewGuid(); animal.name = data.name; animal.species = data.species; animal.breed = data.breed; animal.roomNumber = Convert.ToInt32(data.roomNumber); bool b; if (data.adoptionAvailability == "true") { b = true; } else if (data.adoptionAvailability == "false") { b = false; } else { b = true; } animal.adoptionAvailability = b; animal.foodType = data.foodType; animal.foodAmount = data.foodAmount; animal.personalityType = data.personalityType; animal.price = Convert.ToDecimal(data.price); bool s; if (data.Shots == "y") { s = true; } else if (data.Shots == "n") { s = false; } else { s = true; } animal.Shots = s; humaneSocietyDataBase.Animals.InsertOnSubmit(animal); humaneSocietyDataBase.SubmitChanges(); } } catch { UserUI.DisplayMessage("Opps! That's not a correct file path! Try again."); Run(); } }