private void ShowFood() { TxtDogFood.Text = caretakingLogic.GetFood(Enums.Foodtype.Dogfood).ToString(); TxtCatFood.Text = caretakingLogic.GetFood(Enums.Foodtype.Catfood).ToString(); DtpEmptySupplies.Value = caretakingLogic.CalcDateWhenNoFoodLeft(); }
public List <string> TodoToday() { List <string> returnList = new List <string>(); if (caretakingLogic.CalcDateWhenNoFoodLeft() <= DateTime.Today.AddDays(3)) { returnList.Add($"WAARSCHUWING: Er is nog maar eten genoeg voor {(caretakingLogic.CalcDateWhenNoFoodLeft() - DateTime.Today).Days} dag(en)!"); } foreach (Animal animal in animalLogic.GetAllAnimals()) { if (caretakingLogic.GetFeedingDate(animal) <= DateTime.Today.AddDays(-1)) { returnList.Add($"Geef {animal.name} eten. (Laatst gevoerd op {caretakingLogic.GetFeedingDate(animal).ToShortDateString()})"); } if (animal.species == Animal.Species.Dog && caretakingLogic.GetWalkingDate(animal) <= DateTime.Today.AddDays(-1)) { returnList.Add($"Laat {animal.name} uit. (Laatst uitgelaten op {caretakingLogic.GetWalkingDate(animal).ToShortDateString()})"); } } foreach (Cage cage in caretakingLogic.GetAllCages()) { if (cage.lastCleaningdate <= DateTime.Today.AddDays(-7)) { returnList.Add($"Maak hok {cage.cageNumber} schoon. (Laatst schoon gemaakt op {cage.lastCleaningdate.ToShortDateString()})"); } } return(returnList); }
public void CalcDaysLeftOfFood() { database.FoodCount.ForEach(x => x.Amount = 0); database.Animals.Clear(); database.Animals.AddRange(new Animal[] { testAnimal, testAnimal1, testAnimal2 }); caretakingLogic.AddFood(Enums.Foodtype.Dogfood, 4); caretakingLogic.AddFood(Enums.Foodtype.Catfood, 6); Console.WriteLine(caretakingLogic.CalcDateWhenNoFoodLeft()); Assert.IsTrue(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 3) == caretakingLogic.CalcDateWhenNoFoodLeft()); }