Exemplo n.º 1
0
        /// <summary>
        /// Notify continuous child activity
        /// </summary>
        public void NotifyContinuousChildActivity()
        {
            var sevenDaysAgo    = DateTime.UtcNow.AddDays(-8).Date;
            var fourteenDaysAgo = DateTime.UtcNow.AddDays(-15).Date;
            var thirtyDaysAgo   = DateTime.UtcNow.AddDays(-31).Date;
            var yesterDay       = DateTime.UtcNow.AddDays(-1).Date;

            var sevenContinuousChildActivity = _choreService.GetContinuousChildActivity(sevenDaysAgo, yesterDay);

            if (sevenContinuousChildActivity.Count > 0)
            {
                SendEmailToAdmin(sevenContinuousChildActivity, EmailTemplateType.SevenStraightDaysofActivity, EmailType.SevenStraightDaysofActivity);
            }

            var fourteenContinuousChildActivity = _choreService.GetContinuousChildActivity(fourteenDaysAgo, yesterDay);

            if (fourteenContinuousChildActivity.Count > 0)
            {
                SendEmailToAdmin(fourteenContinuousChildActivity, EmailTemplateType.TwoWeeksStraightDaysofActivity, EmailType.TwoWeeksStraightDaysofActivity);
            }

            var oneMonthContinuousChildActivity = _choreService.GetContinuousChildActivity(thirtyDaysAgo, yesterDay);

            if (oneMonthContinuousChildActivity.Count > 0)
            {
                SendEmailToAdmin(oneMonthContinuousChildActivity, EmailTemplateType.OneMonthStraightDaysofActivity, EmailType.OneMonthStraightDaysofActivity);
            }
        }