예제 #1
0
        public void AddHealth()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            Shot addShot             = new Shot();
            AnimalsMasterList Animal = db.AnimalsMasterLists.FirstOrDefault(e => e.Name.Equals(newAnimalInfo.name));

            addShot.AnimalID = Animal.AnimalID;
            UI.AskShotsStatus();
            addShot.Shots = Convert.ToBoolean(Console.ReadLine());

            db.Shots.InsertOnSubmit(addShot);
            db.SubmitChanges();
        }
예제 #2
0
        public void AddFood()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            Food addFood             = new Food();
            AnimalsMasterList Animal = db.AnimalsMasterLists.FirstOrDefault(e => e.Name.Equals(newAnimalInfo.name));

            addFood.AnimalID = Animal.AnimalID;
            UI.AskAnimalFoodAmount();
            addFood.Amount = Int32.Parse(Console.ReadLine());
            UI.AskAnimalFoodKind();
            addFood.Kind = Console.ReadLine();

            db.Foods.InsertOnSubmit(addFood);
            db.SubmitChanges();
        }
예제 #3
0
        public void AdoptAnimal()
        {
            Console.Write("Enter the ID of the animal you wish to adopt");

            try
            {
                animalToAdopt.searchID = Int32.Parse(Console.ReadLine());
            }
            catch
            {
                UI.NeedIntException();
                AdoptAnimal();
            }

            DataClasses1DataContext db = new DataClasses1DataContext();

            AnimalsMasterList deleteAnimal = db.AnimalsMasterLists.FirstOrDefault(e => e.Equals(animalToAdopt.searchID));

            try
            {
                db.AnimalsMasterLists.DeleteOnSubmit(deleteAnimal);

                db.SubmitChanges();
            }
            catch
            {
                Console.Write("Animal not found. Please try again");
                AdoptAnimal();
            }


            Console.Write("Here are all the animals remaining in the database:");
            var animalList = db.AnimalsMasterLists;

            foreach (AnimalsMasterList animal in animalList)
            {
                Console.WriteLine("AnimalId = {0} , Name = {1}", animal.AnimalID, animal.Name);
            }

            Console.WriteLine("\nPress any key to continue.");
            Console.ReadKey();
        }
예제 #4
0
        public void AddAnimal()
        {
            DataClasses1DataContext db        = new DataClasses1DataContext();
            AnimalsMasterList       newAnimal = new AnimalsMasterList();

            newAnimal.Name        = newAnimalInfo.name;
            newAnimal.AnimalType  = newAnimalInfo.type;
            newAnimal.Price       = newAnimalInfo.price;
            newAnimal.EntryDate   = DateTime.Now;
            newAnimal.AdoptedDate = DateTime.Now;
            newAnimal.Adopted     = newAnimal.Adopted;

            db.AnimalsMasterLists.InsertOnSubmit(newAnimal);

            db.SubmitChanges();

            AnimalsMasterList Animal = db.AnimalsMasterLists.FirstOrDefault(e => e.Name.Equals(newAnimalInfo.name));

            Console.WriteLine("Let's update the food and healthrecords for Animal Id = {0} , Name = {1}", Animal.AnimalID, Animal.Name);
            AddFood();
            AddHealth();
            AddAnimalToRoom();

            Console.Write("Now let's set some personality traits for the animal. These will be determined through a series of true / false questions.");
            AddTraits();

            DataClasses1DataContext datab = new DataClasses1DataContext();
            Trait addedTraits             = new Trait();

            addedTraits.AnimalID       = Animal.AnimalID;
            addedTraits.Energetic      = newAnimalInfo.energetic;
            addedTraits.Cuddly         = newAnimalInfo.cuddly;
            addedTraits.SpayedNuetered = newAnimalInfo.spayedNeutered;
            addedTraits.Young          = newAnimalInfo.young;

            datab.Traits.InsertOnSubmit(addedTraits);

            datab.SubmitChanges();
            Console.WriteLine("\n Animal added. Press any key to return to Main Menu.\n");
            Console.ReadKey();
        }
예제 #5
0
 partial void DeleteAnimalsMasterList(AnimalsMasterList instance);
예제 #6
0
 partial void UpdateAnimalsMasterList(AnimalsMasterList instance);
예제 #7
0
 partial void InsertAnimalsMasterList(AnimalsMasterList instance);