//计时器:发送一周邮件报告,每周一早上八点半进行发送 private void _sendWeeklyReportTimer_Tick(object sender, EventArgs e) { DayOfWeek today = DateTime.Now.DayOfWeek; bool orMonday = (today.ToString() == "Monday"); bool timeNow = (DateTime.Now.ToShortTimeString() == "8:30"); if (orMonday == false) { _notSendReport = true; } if (orMonday && timeNow && _notSendReport) { //发送一周总结报告邮件 SendMailSlack sendReportMail = new SendMailSlack(null, "../../../common/WeeklyReport.html", null, null); bool sendSuccess = sendReportMail.SendWeeklyReport(); _notSendReport = false; //进行数据清空 //进行成员数据清空 Dictionary <string, string> clearMemberZero = new Dictionary <string, string>(); clearMemberZero.Add("Week", "0"); clearMemberZero.Add("Success", "0"); clearMemberZero.Add("Failure", "0"); _projectController.ClearTimesAfterSendReport("config/Member", "../../../common/res/InfoStatics.xml", clearMemberZero, "memberTimes"); //进行总提交次数清空 Dictionary <string, string> clearWeekTotalZero = new Dictionary <string, string>(); clearWeekTotalZero.Add("CommitTimes", "0"); clearWeekTotalZero.Add("BuildTimes", "0"); clearWeekTotalZero.Add("BuildSuccessTimes", "0"); clearWeekTotalZero.Add("BuildFailedTimes", "0"); _projectController.ClearTimesAfterSendReport("config/WeekTotal", "../../../common/res/InfoStatics.xml", clearWeekTotalZero, "totalTimes"); //projects进行清空 _projectController.ClearTimesAfterSendReport("config/Projects", "../../../common/res/InfoStatics.xml", null, null); } }
//计时器:发送一周邮件报告,每周一早上八点半进行发送 private void _sendWeeklyReportTimer_Tick(object sender, EventArgs e) { DayOfWeek today = DateTime.Now.DayOfWeek; bool orMonday = (today.ToString() == "Monday"); bool timeNow = (DateTime.Now.ToShortTimeString() == "8:30"); if (orMonday == false) { _notSendReport = true; } if (orMonday && timeNow && _notSendReport) { //发送一周总结报告邮件 SendMailSlack sendReportMail = new SendMailSlack(null, "../../../common/WeeklyReport.html", null, null); bool sendSuccess = sendReportMail.SendWeeklyReport(); _notSendReport = false; //进行数据清空 //进行成员数据清空 Dictionary<string, string> clearMemberZero = new Dictionary<string, string>(); clearMemberZero.Add("Week", "0"); clearMemberZero.Add("Success", "0"); clearMemberZero.Add("Failure", "0"); _projectController.ClearTimesAfterSendReport("config/Member", "../../../common/res/InfoStatics.xml", clearMemberZero, "memberTimes"); //进行总提交次数清空 Dictionary<string, string> clearWeekTotalZero = new Dictionary<string, string>(); clearWeekTotalZero.Add("CommitTimes", "0"); clearWeekTotalZero.Add("BuildTimes", "0"); clearWeekTotalZero.Add("BuildSuccessTimes", "0"); clearWeekTotalZero.Add("BuildFailedTimes", "0"); _projectController.ClearTimesAfterSendReport("config/WeekTotal", "../../../common/res/InfoStatics.xml", clearWeekTotalZero, "totalTimes"); //projects进行清空 _projectController.ClearTimesAfterSendReport("config/Projects", "../../../common/res/InfoStatics.xml", null, null); } }