/// <summary> /// 上午上班打卡提醒 /// </summary> public static void Morning() { if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday) { return; } var model = Repository.GetAttendanceCaches(); var person = Repository.GetPerson(); List <string> none = new List <string>(); Dictionary <string, DateTime> dictionary = new Dictionary <string, DateTime>(); var now = DateTime.Now; var start = new DateTime(now.Year, now.Month, now.Day, 8, 0, 0); var middle = new DateTime(now.Year, now.Month, now.Day, 8, 31, 0); foreach (var item in person) { var exists = model.Exists(p => p.EnrollNumber == item.EnrollNumber && p.AttendancedOn >= start && p.AttendancedOn <= now); if (!exists) { none.Add(item.Phone); } if (!model.Exists(p => p.EnrollNumber == item.EnrollNumber && p.AttendancedOn <= middle) && model.Exists(p => p.EnrollNumber == item.EnrollNumber && p.AttendancedOn >= middle && p.AttendancedOn <= now)) { var late = model.Where(p => p.EnrollNumber == item.EnrollNumber).OrderBy(p => p.AttendancedOn).FirstOrDefault(); dictionary.Add(item.Phone, late.AttendancedOn); } } Push push = new Push(); push.Morning(none); push.MorningLate(dictionary); }