diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 76fae44..3c9b2cb 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -102,6 +102,11 @@ namespace solarApp // } + /// + /// timer 觸發 + /// + /// + /// private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { //每日歸檔 @@ -120,10 +125,10 @@ namespace solarApp if ((DateTime.Now.Minute % 5) == 0 && autoTask == false) { autoTask = true; - lbMsgTitle.Text = "異常處理 " + DateTime.Now.ToString() + " timer start"; + lbMsgTitle.Text = "異常處理 " + DateTime.Now.ToString() + " timer start"; btSyncErr.PerformClick(); - lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString() ; - autoTask = false; + lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString(); + autoTask = false; } @@ -308,6 +313,8 @@ namespace solarApp invSvc.report_invDay(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd")); } } + + #region 累計日照 sensorSvc.isFirst = true; foreach (var item in site_list) { @@ -318,7 +325,8 @@ namespace solarApp sensorSvc.isFirst = false; } } - + #endregion + lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!"; } @@ -579,8 +587,12 @@ namespace solarApp MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼 MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼 MyMail.IsBodyHtml = true; //是否使用html格式 - var kkk = $"FIC 太陽能電站管理系統通知 <{tbUserName.Text.Trim()}>"; - MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人 + if (tbUserName.Text.Trim().Length > 0) + { + var kkk = $"FIC 太陽能電站管理系統通知 <{tbUserName.Text.Trim()}>"; + MyMail.From = new System.Net.Mail.MailAddress(tbUserName.Text.Trim()); //寄件人 + } + foreach (var email in recipientEmails) { MyMail.To.Add(email); //設定收件者Email @@ -611,7 +623,8 @@ namespace solarApp if (CanDoSend) { SMTPConfig smtp = new SMTPConfig(); ; - smtp.Host = "smtp.gmail.com"; + //smtp.Host = "smtp.gmail.com"; + smtp.Host = "msa.hinet.net"; //smtp.UserName = "ficgreen01@gmail.com"; //smtp.Password = "qwe2015qwe"; //smtp.UserName = "ficgreen02@gmail.com"; @@ -620,8 +633,13 @@ namespace solarApp //smtp.Password = "wswgnluvoodfexrb"; //smtp.EnableSsl = true; //smtp.Port = 587; - smtp.UserName = tbUserName.Text; - smtp.Password = tbPassword.Text; + if (tbUserName.Text.Trim().Length > 0) + { + smtp.UserName = tbUserName.Text; + smtp.Password = tbPassword.Text; + } + //smtp.UserName = tbUserName.Text; + //smtp.Password = tbPassword.Text; if (rbSSL.Checked) { smtp.EnableSsl = true;