diff --git a/SolarPower/Quartz/Jobs/ExceptionSchedule.cs b/SolarPower/Quartz/Jobs/ExceptionSchedule.cs
index 797a454..9828c3b 100644
--- a/SolarPower/Quartz/Jobs/ExceptionSchedule.cs
+++ b/SolarPower/Quartz/Jobs/ExceptionSchedule.cs
@@ -72,15 +72,20 @@ namespace SolarPower.Quartz.Jobs
{
Content += $"當前數值:{Exception.errValue}" + "
";
}
- Content += $"發生時間:{Exception.dev_time}";
+ //Content += $"發生時間:{Exception.dev_time}";
+ string subTime = $",發生時間:{Exception.dev_time}";
+
+
foreach (var user in UserListWithPowerstation)
{
+ var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
+ string companyName = getCompany.Result;
NoticeSchedule DaySchedule = new NoticeSchedule()
{
UserId = user.Id,
EmailType = 4,
RecipientEmail = user.Email,
- Subject = "異常通知",
+ Subject = companyName + "太陽能監控" + Exception.alarmClassName + "-異常通知" + subTime,
Content = Content,
RecipientName = user.Name,
Type = 1,
diff --git a/SolarPower/Quartz/Jobs/OperationScheduleJob.cs b/SolarPower/Quartz/Jobs/OperationScheduleJob.cs
index 911a475..69bf43b 100644
--- a/SolarPower/Quartz/Jobs/OperationScheduleJob.cs
+++ b/SolarPower/Quartz/Jobs/OperationScheduleJob.cs
@@ -250,6 +250,9 @@ namespace SolarPower.Quartz.Jobs
var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented));
if (stationReportName != "")
{
+ var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
+ string companyName = getCompany.Result;
+
if (user.Email != null && IsValidEmail(user.Email))
{
NoticeSchedule DaySchedule = new NoticeSchedule()
@@ -257,7 +260,7 @@ namespace SolarPower.Quartz.Jobs
UserId = user.Id,
EmailType = 0,
RecipientEmail = user.Email,
- Subject = "日報表",
+ Subject = companyName + "太陽能監控-日報表",
Attachment = stationReportName,
RecipientName = user.Name,
Type = 1
@@ -290,12 +293,14 @@ namespace SolarPower.Quartz.Jobs
var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented));
if (user.Email != null && IsValidEmail(user.Email))
{
+ var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
+ string companyName = getCompany.Result;
NoticeSchedule MaxSchedule = new NoticeSchedule()
{
UserId = user.Id,
EmailType = 2,
RecipientEmail = user.Email,
- Subject = "綜合報表",
+ Subject = companyName + "太陽能監控-綜合報表",
Attachment = stationMaxReportName,
RecipientName = user.Name,
Type = 1
@@ -326,10 +331,12 @@ namespace SolarPower.Quartz.Jobs
var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented));
if (user.Email != null && IsValidEmail(user.Email))
{
+ var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
+ string companyName = getCompany.Result;
NoticeSchedule MaxmonthSchedule = new NoticeSchedule()
{
RecipientEmail = user.Email,
- Subject = "綜合報表",
+ Subject = companyName + "太陽能監控-綜合報表",
Attachment = stationReportmaxmonthName,
RecipientName = user.Name,
Type = 1,
@@ -372,10 +379,12 @@ namespace SolarPower.Quartz.Jobs
{
if (user.Email != null && IsValidEmail(user.Email))
{
+ var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
+ string companyName = getCompany.Result;
NoticeSchedule MonthSchedule = new NoticeSchedule()
{
RecipientEmail = user.Email,
- Subject = "月報表",
+ Subject = companyName + "太陽能監控-月報表",
Attachment = stationReportmonthName,
RecipientName = user.Name,
Type = 1,
diff --git a/SolarPower/Quartz/Jobs/SendEmailJob.cs b/SolarPower/Quartz/Jobs/SendEmailJob.cs
index 0302aa5..33d55d2 100644
--- a/SolarPower/Quartz/Jobs/SendEmailJob.cs
+++ b/SolarPower/Quartz/Jobs/SendEmailJob.cs
@@ -54,11 +54,7 @@ namespace SolarPower.Quartz.Jobs
{
attachments = notice.Attachment.Split(',').ToList();
}
-
- var getCompany = noticeScheduleRepository.GetCompanyNameById(notice.Id);
- string companyName = getCompany.Result;
-
- var result = Send(recipientEmails, notice.Subject, notice.Content, attachments, companyName);
+ var result = Send(recipientEmails, notice.Subject, notice.Content, attachments);
if (result.CompareTo("成功") == 0)
{
@@ -99,7 +95,7 @@ namespace SolarPower.Quartz.Jobs
}
}
- private string Send(List recipientEmails, string subject, string content, List attachments, string companyName)
+ private string Send(List recipientEmails, string subject, string content, List attachments)
{
var reason = string.Empty;
var CanDoSend = true;
@@ -108,8 +104,7 @@ namespace SolarPower.Quartz.Jobs
MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式
- //var kkk = $"FIC 太陽能電站管理系統通知 <{smtp.UserName}>";
- var kkk = companyName + $" 太陽能電站管理系統通知 <{smtp.UserName}>";
+ var kkk = $"太陽能電站管理系統通知 <{smtp.UserName}>";
MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人
foreach (var email in recipientEmails)
{