using Quartz; using System.Linq; using System.Threading.Tasks; using wispro.sp.entity; namespace wispro.sp.api.Job { public class AgentMessageJob : IJob { public Task Execute(IJobExecutionContext context) { spDbContext spDb = new spDbContext(); CalMonth calMonth = spDb.CalMonths.FirstOrDefault(s => s.Status == 0); var lstStaff = spDb.Staffs.Where(s => s.ItemStaffs.Where(p => p.Item.CalMonthId == calMonth.Id).Count() > 0); foreach (var staff in lstStaff.ToList()) { string strSubject = $"{calMonth.Year}年{calMonth.Month}月绩效数据确认通知"; string strBody = $"
{staff.Name},您好!
{calMonth.Year}年{calMonth.Month}月绩效已开始计算,请登录绩效系统查看,如有任何问题,请使用绩效系统在{utility.ConfigHelper.GetSectionValue("Lastest_feedback_date")}日前反馈!
小美集团绩效管理系统
"; string strTo = staff.Mail; if (!string.IsNullOrEmpty(strTo)) { _ = QuartzUtil.AddMailJob(strSubject, strBody, staff.Name, strTo); } } return Task.CompletedTask; } } }