예제 #1
0
        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);
        }
예제 #2
0
        public DateTime CalcDateWhenNoFoodLeft()
        {
            List <Animal> animals       = animalLogic.GetAllAnimals();
            decimal       leastDaysLeft = -1;

            foreach (Enums.Foodtype type in Enum.GetValues(typeof(Enums.Foodtype)))
            {
                decimal daysLeft = (GetFood(type) / animals.Where(x => (int)x.species == (int)type).ToList().Count);
                if (daysLeft < leastDaysLeft || leastDaysLeft == -1)
                {
                    leastDaysLeft = daysLeft;
                }
            }
            DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + (int)Math.Floor(leastDaysLeft));

            return(date);
        }
예제 #3
0
        private void UpdateAnimalList()
        {
            LvAnimalList.Items.Clear();
            foreach (Animal A in animalLogic.GetAllAnimals())
            {
                ListViewItem listViewItem = new ListViewItem(A.name);
                listViewItem.SubItems.Add(A.age.ToString());
                listViewItem.SubItems.Add(A.weight.ToString());
                listViewItem.SubItems.Add(Enum.GetName(typeof(Animal.Genders), A.gender));
                listViewItem.SubItems.Add(A.price.ToString());
                listViewItem.SubItems.Add(Enum.GetName(typeof(Animal.Species), A.species));
                listViewItem.SubItems.Add(A.breed);
                listViewItem.SubItems.Add(A.cage.ToString());
                listViewItem.SubItems.Add(A.reserved ? "Ja" : "Nee");

                LvAnimalList.Items.Add(listViewItem);
            }

            LbDogs.Items.Clear();
            LbDogs.Items.AddRange(animalLogic.GetAnimalsOfType(Animal.Species.Dog).ToArray());
            if (LbDogs.Items.Count > 0)
            {
                LbDogs.SelectedIndex = 0;
            }


            LbCages.Items.Clear();
            LbCages.Items.AddRange(caretakingLogic.GetAllCages().ToArray());
            if (LbDogs.Items.Count > 0)
            {
                LbCages.SelectedIndex = 0;
            }

            LbFeedingAnimals.Items.Clear();
            LbFeedingAnimals.Items.AddRange(animalLogic.GetAllAnimals().ToArray());
            if (LbDogs.Items.Count > 0)
            {
                LbFeedingAnimals.SelectedIndex = 0;
            }
        }
예제 #4
0
 public List <AnimalEntity> GetAllAnimals()
 {
     return(_animalLogic.GetAllAnimals());
 }