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); } } } } }
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); } } }
public Animal() { FeedDate = DateFormatter.getCurrentDate(); Hungry = true; }