Exemple #1
0
 public void sendMessagesToStuff()
 {
     foreach (Animal animal in DB.animals)
     {
         if (animal.Hungry || animal.FeedDate == DateFormatter.getCurrentDate())
         {
             foreach (User user in DB.users)
             {
                 if (user.isAppointed(animal))
                 {
                     botClient.SendTextMessageAsync(
                         user.ChatId != 0 ? user.ChatId : chatId,
                         user.ChatId == 0 ? user.Name + " must to feed the " + animal.Name : "You must feed the: " + animal.Name);
                 }
             }
         }
     }
 }
Exemple #2
0
        public override void calculateFeedDate()
        {
            var month = DateTime.Now.Month;

            if (FeedDate.Equals(DateFormatter.getCurrentDate()))
            {
                Hungry = true;
                return;
            }
            if (isWinter(month))
            {
                int year = DateTime.Now.Year;
                if (month == 12)
                {
                    year++;
                }

                FeedDate = year + "-03-01";
                return;
            }

            if (Hungry)
            {
                FeedDate = DateFormatter.getCurrentDate();
                return;
            }

            if (!isWinter(month) && !Hungry)
            {
                if (!isActivePeriod(month))
                {
                    FeedDate = DateFormatter.addDays(FeedDate, 2);
                }
                else
                {
                    FeedDate = DateFormatter.addDays(FeedDate, 1);
                }
            }
        }
Exemple #3
0
 public Animal()
 {
     FeedDate = DateFormatter.getCurrentDate();
     Hungry   = true;
 }