Exemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Username.Length != 0)
            {
                hash ^= Username.GetHashCode();
            }
            hash ^= emailAddresses_.GetHashCode();
            if (Type != global::Dogdata.CustomType.Roar)
            {
                hash ^= Type.GetHashCode();
            }
            if (testCase_ == TestOneofCase.Name)
            {
                hash ^= Name.GetHashCode();
            }
            if (testCase_ == TestOneofCase.Name2)
            {
                hash ^= Name2.GetHashCode();
            }
            hash ^= AnimalFood.GetHashCode();
            if (noDiffrentWhat_ != null)
            {
                hash ^= NoDiffrentWhat.GetHashCode();
            }
            hash ^= (int)testCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 2
0
 public ViewFoodAnimalTotal(AnimalFood animalFood)
 {
     Id            = animalFood.Id;
     AnimalName    = animalFood.Animal.Name;
     TotalQuantity = animalFood.Quantity * animalFood.Animal.Quantity;
     TotalPrice    = TotalQuantity * animalFood.Food.Price;
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            AnimalFood animalFood = db.AnimalFoods.Find(id);

            db.AnimalFoods.Remove(animalFood);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ViewFoodTotal(AnimalFood animalFood)
 {
     FoodName      = animalFood.Food.Name;                             // Grass
     FoodPrice     = animalFood.Food.Price;                            // 3
     TotalQuantity = animalFood.Animal.Quantity * animalFood.Quantity; // 3 * 3 = 9
     TotalPrice    = FoodPrice * TotalQuantity;
     Id            = animalFood.Id;
     FoodId        = animalFood.FoodId;
 }
Exemplo n.º 5
0
        public ViewTotalFood(AnimalFood animalfoods)
        {
            FoodName      = animalfoods.food.Name;
            FoodPrice     = animalfoods.food.Price;
            TotalQuantity = animalfoods.animal.Quantity * animalfoods.Quantity;

            TotalPrice = FoodPrice * TotalQuantity;
            Id         = animalfoods.Id;
            FoodId     = animalfoods.foodId;
        }
 public ActionResult Edit([Bind(Include = "Id,FoodName,FoodPrice,TotalQuantity,TotalPrice")] AnimalFood animalFood)
 {
     if (ModelState.IsValid)
     {
         db.Entry(animalFood).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(animalFood));
 }
Exemplo n.º 7
0
        public ViewFoodTotal(AnimalFood animalFood)
        {
            FoodName      = animalFood.Food.Name;                             //Grass 5kg
            FoodPrice     = animalFood.Food.Price;                            //10
            TotalQuantity = animalFood.Animal.Quantiry * animalFood.Quantity; //5*10 =50
            TotalPrice    = FoodPrice * TotalQuantity;

            Id     = animalFood.Id;
            FoodId = animalFood.FoodId;
        }
Exemplo n.º 8
0
 public ViewFoodTotal(AnimalFood animalFood)
 {
     FoodName      = animalFood.Food.Name;
     FoodPrice     = animalFood.Food.Price;
     TotalQuantity = animalFood.Animals.Quantity *
                     animalFood.Quantity;
     TotalPrice = FoodPrice * TotalQuantity;
     Id         = animalFood.Id;
     FoodId     = animalFood.FoodId;
 }
        public ActionResult Create([Bind(Include = "Id,FoodName,FoodPrice,TotalQuantity,TotalPrice")] AnimalFood animalFood)
        {
            if (ModelState.IsValid)
            {
                db.AnimalFoods.Add(animalFood);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(animalFood));
        }
Exemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "Id,animalId,foodId,Quantity")] AnimalFood animalFood)
 {
     if (ModelState.IsValid)
     {
         db.Entry(animalFood).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.animalId = new SelectList(db.animals, "Id", "Name", animalFood.animalId);
     ViewBag.foodId   = new SelectList(db.foods, "Id", "Name", animalFood.foodId);
     return(View(animalFood));
 }
Exemplo n.º 11
0
 public ActionResult Edit(AnimalFood animalFood)
 {
     if (ModelState.IsValid)
     {
         db.Entry(animalFood).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AnimalId = new SelectList(db.Animals, "Id", "Name", animalFood.AnimalId);
     ViewBag.FoodId   = new SelectList(db.Foods, "Id", "Name", animalFood.FoodId);
     return(View(animalFood));
 }
Exemplo n.º 12
0
        public ActionResult Create(AnimalFood animalFood)
        {
            if (ModelState.IsValid)
            {
                db.AnimalFoods.Add(animalFood);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AnimalId = new SelectList(db.Animals, "Id", "Name", animalFood.AnimalId);
            ViewBag.FoodId   = new SelectList(db.Foods, "Id", "Name", animalFood.FoodId);
            return(View(animalFood));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Feeds the zebra.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Milk)
            {
                Console.WriteLine("Throw some grass to the zebras!");
                return;
            }

            Console.WriteLine(
                "Zebra {0} got fresh grass and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 14
0
Arquivo: Goat.cs Projeto: crDahaka/Zoo
        /// <summary>
        /// Feeds the goat.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Milk)
            {
                Console.WriteLine("Feed the goats only with milk.");
                return;
            }

            Console.WriteLine(
                "Goat {0} drunk milk and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 15
0
        /// <summary>
        /// Feeds the lion.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Crumbs)
            {
                Console.WriteLine("Lion eats only meat!");
                return;
            }

            Console.WriteLine(
                "Lion {0} got some fresh meat and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 16
0
        /// <summary>
        /// Feeds the owl.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Crumbs)
            {
                Console.WriteLine("Give crackers to the owl!");
                return;
            }

            Console.WriteLine(
                "Owl {0} eated tasty crackers and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Feeds the parrot.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Crackers)
            {
                Console.WriteLine("Parrot eats only crackers!");
                return;
            }

            Console.WriteLine(
                "Parrot {0} ate some tasty crackers and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 18
0
        // GET: AnimalFoods/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AnimalFood animalFood = db.AnimalFoods.Find(id);

            if (animalFood == null)
            {
                return(HttpNotFound());
            }
            return(View(animalFood));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Feeds the duck.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Crumbs)
            {
                Console.WriteLine("Give crackers to the duck!");
                return;
            }

            Console.WriteLine(
                "Duck {0} got some fresh crackers and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 20
0
        /// <summary>
        /// Feeds the mule deer.
        /// </summary>
        /// <param name="food"></param>
        public override void Eat(AnimalFood food)
        {
            if (food.Type != FoodType.Crumbs)
            {
                Console.WriteLine("Give milk to the deers!");
                return;
            }

            Console.WriteLine(
                "Mule Deer {0} got some fresh milk and increased its stamina with {1}.",
                this.Name, food.RegenerateStamina());

            this.IncreaseStamina(food.RegenerateStamina());
        }
Exemplo n.º 21
0
        // GET: AnimalFoods/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AnimalFood animalFood = db.AnimalFoods.Find(id);

            if (animalFood == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AnimalId = new SelectList(db.Animals, "Id", "Name", animalFood.AnimalId);
            ViewBag.FoodId   = new SelectList(db.Foods, "Id", "Name", animalFood.FoodId);
            return(View(animalFood));
        }
Exemplo n.º 22
0
        public override void Eat(AnimalFood food)
        {
            if (food == null)
            {
                throw new ArgumentNullException("Food cannot be null");
            }
            else if (food.FoodType != AnimalFoodType.Grass && food.FoodType != AnimalFoodType.Milk)
            {
                Console.WriteLine("I am a mammal. I eat only grass and milk!");
                return;
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(String.Format("Zebra {0} eated some {1} and increased stamina with {2}",
                                            this.Name, food.FoodType, food.Calories));

            this.IncreaseStamina((int)food.Calories);
        }
Exemplo n.º 23
0
        public override void Eat(AnimalFood food)
        {
            if (food == null)
            {
                throw new ArgumentNullException("Food cannot be null");
            }
            else if (food.FoodType != AnimalFoodType.Meat)
            {
                Console.WriteLine("I am a carnivore. I eat only meat!");
                return;
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(String.Format("Tiger {0} eated some meat and increased stamina with {1}",
                                            this.Name, food.Calories));

            this.IncreaseStamina((int)food.Calories);
        }
Exemplo n.º 24
0
 public bool Equals(Customer other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     if (ReferenceEquals(other, this))
     {
         return(true);
     }
     if (Username != other.Username)
     {
         return(false);
     }
     if (!emailAddresses_.Equals(other.emailAddresses_))
     {
         return(false);
     }
     if (Type != other.Type)
     {
         return(false);
     }
     if (Name != other.Name)
     {
         return(false);
     }
     if (Name2 != other.Name2)
     {
         return(false);
     }
     if (!AnimalFood.Equals(other.AnimalFood))
     {
         return(false);
     }
     if (!object.Equals(NoDiffrentWhat, other.NoDiffrentWhat))
     {
         return(false);
     }
     if (TestCase != other.TestCase)
     {
         return(false);
     }
     return(Equals(_unknownFields, other._unknownFields));
 }
Exemplo n.º 25
0
        private void InitialiteConsumables()
        {
            AnimalFood  animalFood  = new AnimalFood();
            AnimalWater animalWater = new AnimalWater();
            Fertilizer  fertilizer  = new Fertilizer();
            Fungicide   fungicide   = new Fungicide(50);
            Herbicide   herbicide   = new Herbicide(50);
            Irrigation  irrigation  = new Irrigation();
            Pesticide   pesticide   = new Pesticide(50);
            Vaccine     vaccine     = new Vaccine(50);

            market.AddConsumable(animalFood);
            market.AddConsumable(animalWater);
            market.AddConsumable(fertilizer);
            market.AddConsumable(fungicide);
            market.AddConsumable(herbicide);
            market.AddConsumable(irrigation);
            market.AddConsumable(pesticide);
            market.AddConsumable(vaccine);
        }
Exemplo n.º 26
0
        public void Feed(Animal animalToFeed)
        {
            if (animalToFeed.ZooKeeperId != this.id)
            {
                Console.WriteLine("This animal is not asigned to this zoo keeper!");
                return;
            }

            // If the animal is dead, we dont feed it.
            if (!animalToFeed.IsAlive())
            {
                return;
            }

            switch (animalToFeed.Specie)
            {
            case Species.Carnivore:
                AnimalFood carnivoreFood = new AnimalFood(AnimalFoodType.Meat, (uint)randomFoodAmount.Next(1, 6));
                animalToFeed.Eat(carnivoreFood);
                break;

            case Species.Omnivore:
                AnimalFood omnivoreFood = new AnimalFood(AnimalFoodType.Mandja, (uint)randomFoodAmount.Next(1, 5));
                animalToFeed.Eat(omnivoreFood);
                break;

            case Species.Mammal:
                AnimalFood mammalFood = new AnimalFood(AnimalFoodType.Milk, (uint)randomFoodAmount.Next(1, 5));
                animalToFeed.Eat(mammalFood);
                break;

            case Species.Herbivore:
                AnimalFood herbivoreFood = new AnimalFood(AnimalFoodType.Grass, (uint)randomFoodAmount.Next(1, 5));
                animalToFeed.Eat(herbivoreFood);
                break;

            default:
                break;
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Feed an animal.
        /// </summary>
        /// <param name="animal"></param>
        public void FeedAnimal(Animal animal)
        {
            if (!animal.IsAlive())
            {
                return;
            }

            switch (animal.Specie)
            {
            case Species.Herbivore:
                AnimalFood herbivoreFood =
                    new AnimalFood(FoodType.Grass, (uint)generateFoodQuantity.Next(1, 5));
                animal.Eat(herbivoreFood);
                break;

            case Species.Mammal:
                AnimalFood mammalFood =
                    new AnimalFood(FoodType.Milk, (uint)generateFoodQuantity.Next(1, 5));
                animal.Eat(mammalFood);
                break;

            case Species.Bird:
                AnimalFood birdFood =
                    new AnimalFood(FoodType.Crackers, (uint)generateFoodQuantity.Next(1, 5));
                animal.Eat(birdFood);
                break;

            case Species.Carnivore:
                AnimalFood carnivoreFood =
                    new AnimalFood(FoodType.Crumbs, (uint)generateFoodQuantity.Next(1, 5));
                animal.Eat(carnivoreFood);
                break;

            default:
                break;
            }
        }
Exemplo n.º 28
0
 public override AnimalFood Eat(AnimalFood food)
 {
     return(base.Eat(food));
 }
Exemplo n.º 29
0
 // Methods
 public Animal(AnimalSize size, AnimalFood food)
 {
     Size = size;
     Food = food;
 }
Exemplo n.º 30
0
 public override void Eat(AnimalFood food)
 {
     throw new NotImplementedException();
 }