public static void DisplayAnimalInfo(Animals animal)
        {
            Rooms         animalRoom = Query.GetRoom(animal.AnimalId);
            List <string> info       = new List <string>()
            {
                "ID: " + animal.AnimalId, animal.Name, animal.Age + "years old", "Demeanour: " + animal.Demeanor, "Kid friendly: " + BoolToYesNo(animal.KidFriendly), "pet friendly: " + BoolToYesNo(animal.PetFriendly), $"Location: " + animalRoom.RoomId, "Weight: " + animal.Weight.ToString(), "Food amoumnt in cups:" + animal.DietPlan.FoodAmountInCups
            };

            DisplayUserOptions(info);
            Console.ReadLine();
        }
Пример #2
0
        internal static void UpdateShot(string shotName, Animals animal)
        {
            var foundShot     = db.Shots.Where(x => x.Name == shotName).FirstOrDefault();
            var newAnimalShot = new AnimalShots();

            newAnimalShot.AnimalId     = animal.AnimalId;
            newAnimalShot.ShotId       = foundShot.ShotId;
            newAnimalShot.DateReceived = DateTime.Now;

            db.AnimalShots.Add(newAnimalShot);
            db.SaveChanges();
        }
Пример #3
0
        // TODO: Adoption CRUD Operations
        internal static void Adopt(Animals animal, Clients client)
        {
            var newAdoption = new Adoptions();

            newAdoption.ApprovalStatus   = "In Progress";
            newAdoption.PaymentCollected = true;
            newAdoption.ClientId         = client.ClientId;
            newAdoption.AnimalId         = animal.AnimalId;
            newAdoption.AdoptionFee      = 50;

            db.Adoptions.Add(newAdoption);
            db.SaveChanges();
        }
Пример #4
0
        public void manageAdopter(Animals theAnimals, Cages theCages)
        {
            char menuChoice;

            do
            {
                Console.SetCursorPosition(0, 0);    // move the cursor up Nine lines to paint next menu on top.
                                                    //"12345678901234567890123456789012"
                Console.WriteLine("    MANAGE ADOPTER              ");
                Console.WriteLine("1-) Fill Aplication             ");
                Console.WriteLine("2-) Pay Fee                     ");
                Console.WriteLine("3-) Select Pet                  ");
                Console.WriteLine("4-)                             ");
                Console.WriteLine("5-)                             ");
                Console.WriteLine("6-)                             ");      // setup the cages available in the facility
                Console.WriteLine("9-) QUIT                        ");
                Console.Write("ENTER CHOICE:                   ");
                Console.SetCursorPosition(Console.CursorLeft - 5, Console.CursorTop);    // move the cursor up Nine lines to paint next menu on top.
                menuChoice = Console.ReadKey().KeyChar;
                switch (menuChoice)
                {
                case '1':
                    fillApplication();
                    break;

                case '2':
                    payFee();
                    break;

                case '3':
                    selectPet(theAnimals, theCages);
                    break;

                case '4':
                    break;

                case '5':
                    break;

                case '6':
                    break;

                case '9':
                    cleanUpBack();
                    break;
                }
            } while (menuChoice != '9');
        }
Пример #5
0
        // Creates an animal
        // Additional method
        internal static Animals CreateAnAnimal(string name, int weight, int age, string demeanor, bool?kidFriendly, bool?petFriendly, string gender, string adoptionStatus, int categoryId, int dietPlanId, int employeeId)
        {
            Animals newAnimal = new Animals();

            newAnimal.Name           = name;
            newAnimal.Weight         = weight;
            newAnimal.Age            = age;
            newAnimal.Demeanor       = demeanor;
            newAnimal.KidFriendly    = kidFriendly;
            newAnimal.PetFriendly    = petFriendly;
            newAnimal.Gender         = gender;
            newAnimal.AdoptionStatus = adoptionStatus;
            newAnimal.DietPlanId     = dietPlanId;
            newAnimal.EmployeeId     = employeeId;

            return(newAnimal);
        }
Пример #6
0
        private void AddAnimal()
        {
            Console.Clear();

            string animalCategoryName = UserInterface.GetStringData("category/breed", "the name of the animal's");
            string animalDietPlanName = UserInterface.GetStringData("diet plan", "the name of the animal's");

            Animals animal = new Animals();

            animal.CategoryId  = Query.GetCategoryId(animalCategoryName);
            animal.Name        = UserInterface.GetStringData("name", "the animal's");
            animal.Age         = UserInterface.GetIntegerData("age", "the animal's");
            animal.Demeanor    = UserInterface.GetStringData("demeanor", "the animal's");
            animal.KidFriendly = UserInterface.GetBitData("the animal", "child friendly");
            animal.PetFriendly = UserInterface.GetBitData("the animal", "pet friendly");
            animal.Weight      = UserInterface.GetIntegerData("the animal", "the weight of the");
            animal.DietPlanId  = Query.GetDietPlanId(animalDietPlanName);
            Query.AddAnimal(animal);
        }
Пример #7
0
        private void CheckShots(Animals animal)
        {
            List <string> shotInfo = new List <string>();
            var           shots    = Query.GetShots(animal);

            foreach (AnimalShots shot in shots.ToList())
            {
                shotInfo.Add($"{shot.Shot.Name} Date: {shot.DateReceived}");
            }

            if (shotInfo.Count > 0)
            {
                UserInterface.DisplayUserOptions(shotInfo);
            }
            if (UserInterface.GetBitData("Would you like to Update shots?"))
            {
                string shotToAdd = UserInterface.GetStringData("the animal received", "the shot");
                Query.UpdateShot(shotToAdd, animal);
            }
        }
Пример #8
0
        private void selectPet(Animals theAnimals, Cages theCages)
        {
            int cageID;

            if (this.theApplication.AnimalKind == "DOG")
            {
                cageID = selectDog(theAnimals);
                theAnimals.removeDog(cageID, theCages);
            }
            if (this.theApplication.AnimalKind == "CAT")
            {
                cageID = selectCat(theAnimals);
                theAnimals.removeCat(cageID, theCages);
            }
            if (this.theApplication.AnimalKind == "BIRD")
            {
                cageID = selectBird(theAnimals);
                theAnimals.removeBird(cageID, theCages);
            }
        }
Пример #9
0
        // TODO: Animal CRUD Operations
        internal static void AddAnimal(Animals animal)
        {
            Animals newAnimal = new Animals();

            newAnimal.Name           = animal.Name;
            newAnimal.Weight         = animal.Weight;
            newAnimal.Age            = animal.Age;
            newAnimal.Demeanor       = animal.Demeanor;
            newAnimal.KidFriendly    = animal.KidFriendly;
            newAnimal.PetFriendly    = animal.PetFriendly;
            newAnimal.Gender         = animal.Gender;
            newAnimal.AdoptionStatus = animal.AdoptionStatus;
            newAnimal.CategoryId     = animal.CategoryId;
            newAnimal.DietPlanId     = animal.DietPlanId;
            newAnimal.EmployeeId     = animal.EmployeeId;

            db.Add(newAnimal);
            db.SaveChanges();

            Console.Clear();
        }
Пример #10
0
        private void RunCheckMenu(Animals animal)
        {
            bool isFinished = false;

            Console.Clear();
            while (!isFinished)
            {
                List <string> options = new List <string>()
                {
                    "Animal found:", animal.Name, animal.Category.Name, "Would you like to:", "1. Get Info", "2. Update Info", "3. Check shots", "4. Return"
                };
                UserInterface.DisplayUserOptions(options);
                int input = UserInterface.GetIntegerData();
                if (input == 4)
                {
                    isFinished = true;
                    continue;
                }
                RunCheckMenuInput(input, animal);
            }
        }
Пример #11
0
        private void RunCheckMenuInput(int input, Animals 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;

            default:
                UserInterface.DisplayUserOptions("Input not accepted please select a menu choice");
                break;
            }
        }
Пример #12
0
        // TODO: Shots Stuff
        internal static IQueryable <AnimalShots> GetShots(Animals animal)
        {
            var query = db.AnimalShots.Where(a => a.AnimalId == animal.AnimalId).Select(a => a);

            return(query);
        }
Пример #13
0
        internal static void RemoveAnimal(Animals animal)
        {
            var queryRoom = db.Rooms.Where(a => a.AnimalId == animal.AnimalId).FirstOrDefault();

            if (queryRoom != null)
            {
                try
                {
                    if (queryRoom != null)
                    {
                        queryRoom.AnimalId = null;
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }


            var queryShot = db.AnimalShots.Where(a => a.AnimalId == animal.AnimalId).Select(a => a);

            try
            {
                foreach (var item in queryShot)
                {
                    db.AnimalShots.Remove(item);
                }

                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            var queryAdoptions = db.Adoptions.Where(a => a.AnimalId == animal.AnimalId).Select(a => a);

            try
            {
                foreach (var item in queryAdoptions)
                {
                    db.Adoptions.Remove(item);
                }

                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            var queryAnimal = db.Animals.Where(a => a.AnimalId == animal.AnimalId).Select(a => a);

            if (queryAnimal != null)
            {
                foreach (var item in queryAnimal)
                {
                    db.Animals.Remove(item);
                }
            }
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #14
0
        internal static Animals GetAnimalByID(int id)
        {
            Animals foundAnimal = db.Animals.Where(i => i.AnimalId == id).FirstOrDefault();

            return(foundAnimal);
        }
Пример #15
0
        public void Run()
        {
            Animals  theAnimals  = new Animals();
            Supplies theSupplies = new Supplies();
            Cages    theCages    = new Cages();
            char     menuChoice;

            do
            {
                Console.SetCursorPosition(0, 0);    // move the cursor up Nine lines to paint next menu on top.
                                                    //"12345678901234567890123456789012"
                Console.WriteLine("Humane Society Management System");
                Console.WriteLine("1-) Manage Animals              ");
                Console.WriteLine("2-) Manage  Adopter             ");
                Console.WriteLine("3-) Show Animals                ");
                Console.WriteLine("4-) Manage Food Supplies        ");
                Console.WriteLine("5-) Manage Medication Supplies  ");
                Console.WriteLine("6-) Manage Cages                ");      // setup the cages available in the facility
                Console.WriteLine("7-)                             ");
                Console.WriteLine("8-)                             ");
                Console.WriteLine("9-) QUIT                        ");
                Console.Write("ENTER CHOICE:                   ");
                Console.SetCursorPosition(Console.CursorLeft - 5, Console.CursorTop);    // move the cursor up Nine lines to paint next menu on top.
                menuChoice = Console.ReadKey().KeyChar;
                // or just pass 0,0

                switch (menuChoice)
                {
                case '1':
                    theAnimals.manageAnimals(theSupplies, theCages);
                    break;

                case '2':
                    Adopter theAdopter = new Adopter();
                    theAdopter.manageAdopter(theAnimals, theCages);

                    break;

                case '3':
                    theAnimals.showAnimals();
                    break;

                case '4':
                    theSupplies.manageFoodSupplies();
                    break;

                case '5':
                    //manageMedication();
                    break;

                case '6':
                    theCages.manageCages();
                    break;

                case '7':
                case '8':
                    Console.Beep(5000, 250);
                    Console.Beep(2000, 250);

                    break;

                case '9':
                    letsQuit();
                    break;
                }
            } while (menuChoice != '9');
        }