static public void TaskNot(string url) { TaskObj obj = new TaskObj(); foreach (var item in obj.ViewsListObj()) { if (item.Status == false && item.DateEnd.Date > DateTime.Now.Date) { Add(new Notification { AspNetUserId = Guid.Parse("3950eec4-39b4-4b16-a4e7-c7e7e3f978c8"), Status = false, Url = url, Message = "Данный пользователь " + obj.ViewUserName(item.UserId).UserName + " не выполнил задания." }); } } }
static public void TaskSrok(Guid id, string url) { ApplicationDbContext db = new ApplicationDbContext(); var linq = from task in db.TasksManager.ToList() where (task.UserId == id && task.DateEnd.Day + 1 == DateTime.Now.Day && task.Status == false) || (task.UserId == id && task.DateEnd.Day == DateTime.Now.Day && task.Status == false) select task; if (linq.Count() > 0) { TaskObj obj = new TaskObj(); foreach (var item in linq) { Add(new Notification { AspNetUserId = id, Url = url, Status = false, Message = "Уважаемый " + obj.ViewUserName(id).UserName + " у вас заканчиваеться срок задачи." }); } } }