Пример #1
0
        //计时器:发送一周邮件报告,每周一早上八点半进行发送
        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);
            }
        }
Пример #2
0
        /// <summary>
        /// 计时器触发,发送一周编译报告
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _sendWeeklyReportTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            string    config             = System.AppDomain.CurrentDomain.BaseDirectory;
            int       p                  = config.LastIndexOf("\\");
            string    parent             = config.Substring(0, p - 25);
            string    mailWeekReportPath = parent + "\\common\\WeeklyReport.html";
            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, mailWeekReportPath, null, null, parent + "\\common\\res\\InfoStatics.xml");
                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", parent + "\\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", parent + "\\common\\res\\InfoStatics.xml", clearWeekTotalZero, "totalTimes");
                //projects进行清空
                _projectController.ClearTimesAfterSendReport("config/Projects", parent + "\\common\\res\\InfoStatics.xml", null, null);
            }
        }