diff --git a/SolarPower/DBSchema/solar_power_schema.sql b/SolarPower/DBSchema/solar_power_schema.sql index 141635b..110137e 100644 --- a/SolarPower/DBSchema/solar_power_schema.sql +++ b/SolarPower/DBSchema/solar_power_schema.sql @@ -1983,6 +1983,14 @@ ALTER TABLE `inverter_history_day` ALTER TABLE `inverter_history_month` ADD COLUMN `TOTALKWH` DOUBLE NULL DEFAULT NULL AFTER `TODAYKWH`; +-- 新增帳號是否接收通知權限 20210730 +ALTER TABLE `user` + ADD COLUMN `EmailDayReport` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '接收Email日報 0:不接收 1:接收' AFTER `Email`, + ADD COLUMN `EmailMonthReport` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '接收Email月報 0:不接收 1:接收' AFTER `EmailDayReport`, + ADD COLUMN `EmailComplexReport` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '接收Email綜合報告 0:不接收 1:接收' AFTER `EmailMonthReport`, + ADD COLUMN `EmailException` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '接收Email異常通知 0:不接收 1:接收' AFTER `EmailComplexReport`; + + /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; diff --git a/SolarPower/Models/User.cs b/SolarPower/Models/User.cs index 52a2c03..8a92a9d 100644 --- a/SolarPower/Models/User.cs +++ b/SolarPower/Models/User.cs @@ -142,6 +142,10 @@ namespace SolarPower.Models.User public string PowerStationName { get; set; } public string Code { get; set; } public string EscrowName { get; set; } + public byte EmailDayReport { get; set; } + public byte EmailMonthReport { get; set; } + public byte EmailComplexReport { get; set; } + public byte EmailException { get; set; } } public class PostUserPowerStation diff --git a/SolarPower/Repository/Implement/UserRepository.cs b/SolarPower/Repository/Implement/UserRepository.cs index 1c560ea..a2bdb8d 100644 --- a/SolarPower/Repository/Implement/UserRepository.cs +++ b/SolarPower/Repository/Implement/UserRepository.cs @@ -330,12 +330,17 @@ namespace SolarPower.Repository.Implement op.Id, ps.Code, ps.Name AS PowerStationName, + us.EmailDayReport, + us.EmailMonthReport, + us.EmailComplexReport, + us.EmailException, CASE ps.IsEscrow WHEN 1 THEN CONCAT(ps.EscrowName, '(代管)') WHEN 0 THEN c.Name END AS EscrowName FROM power_station_operation_personnel op LEFT JOIN power_station ps ON op.PowerStationId = ps.Id LEFT JOIN company c ON ps.CompanyId = c.Id + LEFT JOIN user us ON us.Id = @UserId WHERE op.Deleted = 0 AND op.UserId = @UserId"; result = (await conn.QueryAsync(sql, new { UserId = userId })).ToList(); diff --git a/SolarPower/Views/User/Index.cshtml b/SolarPower/Views/User/Index.cshtml index 31d3eae..e9ff42c 100644 --- a/SolarPower/Views/User/Index.cshtml +++ b/SolarPower/Views/User/Index.cshtml @@ -849,6 +849,32 @@ str += "" + value.code + ""; str += "" + value.powerStationName + ""; str += "" + value.escrowName + ""; + if (value.emailDayReport == 0) { + str += "" + "
"+ ""; + } + else + { + str += "" + "
" + ""; + } + if (value.emailMonthReport == 0) { + str += "" + "
" + ""; + } + else { + str += "" + "
" + ""; + } + if (value.emailComplexReport == 0) { + str += "" + "
" + ""; + } + else { + str += "" + "
" + ""; + } + if (value.emailException == 0) { + str += "" + "
" + ""; + } + else { + str += "" + "
" + ""; + } + str += "" + '' + ""; str += ""; diff --git a/SolarPower/Views/User/_UserManager.cshtml b/SolarPower/Views/User/_UserManager.cshtml index dc4a293..63fc01a 100644 --- a/SolarPower/Views/User/_UserManager.cshtml +++ b/SolarPower/Views/User/_UserManager.cshtml @@ -137,6 +137,10 @@ 電站代碼 電站名稱 公司 + 收email日報 + 收email月報 + 收email綜合報告 + 收email異常通知 功能