123456789101112131415161718192021222324252627282930313233 |
- 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<Staff>(s => s.ItemStaffs.Where<ItemStaff>(p => p.Item.CalMonthId == calMonth.Id).Count<ItemStaff>() > 0);
- foreach (var staff in lstStaff.ToList<Staff>())
- {
- string strSubject = $"{calMonth.Year}年{calMonth.Month}月绩效数据确认通知";
- string strBody = $"<div style=\"position:absolute;width:800;height:300;margin-top:50px;margin-left:200px;margin-right:200px;box-shadow:0px 0px 3px 3px #ccc \"><div style= \"margin-top: 20px; margin-left:20px;;font-size:14px; \">{staff.Name},您好!</div><div style= \"margin-top: 25px; margin-left:20px;font-size:14px; \"><div>{calMonth.Year}年{calMonth.Month}月绩效已开始计算,请<a href= \"http://1.116.113.26\">登录绩效系统</a>查看,如有任何问题,请使用绩效系统在<B>{utility.ConfigHelper.GetSectionValue("Lastest_feedback_date")}日</B>前反馈!</div><div style= \"margin-top: 100px;margin-right:15px; padding-bottom: 20px; font-size:14px;color:#888888;float:right; \">小美集团绩效管理系统</div></div>";
- string strTo = staff.Mail;
- if (!string.IsNullOrEmpty(strTo))
- {
- _ = QuartzUtil.AddMailJob(strSubject, strBody, staff.Name, strTo);
- }
- }
- return Task.CompletedTask;
- }
- }
- }
|