修正Email為null時會出現錯誤
This commit is contained in:
parent
bf09f05433
commit
6cd312eed8
@ -677,7 +677,7 @@ namespace SolarPower.Controllers
|
||||
_ => ""
|
||||
};
|
||||
var user = await userRepository.GetOneAsync(person);
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
@ -721,7 +721,7 @@ namespace SolarPower.Controllers
|
||||
};
|
||||
//var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||
if (IsValidEmail(firm.Email))
|
||||
if (firm.Email != null && IsValidEmail(firm.Email))
|
||||
{
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
@ -909,7 +909,7 @@ namespace SolarPower.Controllers
|
||||
_ => ""
|
||||
};
|
||||
var user = await userRepository.GetOneAsync(person);
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
@ -952,7 +952,7 @@ namespace SolarPower.Controllers
|
||||
};
|
||||
// var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||
if (IsValidEmail(firm.Email))
|
||||
if (firm.Email != null && IsValidEmail(firm.Email))
|
||||
{
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
|
||||
@ -250,7 +250,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented));
|
||||
if (stationReportName != "")
|
||||
{
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule DaySchedule = new NoticeSchedule()
|
||||
{
|
||||
@ -288,7 +288,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
Userid = user.Id
|
||||
};
|
||||
var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented));
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule MaxSchedule = new NoticeSchedule()
|
||||
{
|
||||
@ -324,7 +324,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
Userid = user.Id
|
||||
};
|
||||
var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented));
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule MaxmonthSchedule = new NoticeSchedule()
|
||||
{
|
||||
@ -370,7 +370,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var stationReportmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(monthexcel, Formatting.Indented));
|
||||
if (stationReportmonthName != "")
|
||||
{
|
||||
if (IsValidEmail(user.Email))
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
NoticeSchedule MonthSchedule = new NoticeSchedule()
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var updateNoticeSchedules = new List<NoticeSchedule>();
|
||||
foreach (var notice in noticeSchedules)
|
||||
{
|
||||
if (IsValidEmail(notice.RecipientEmail)) {
|
||||
if (notice.RecipientEmail != null && IsValidEmail(notice.RecipientEmail)) {
|
||||
var attachments = new List<string>();
|
||||
var recipientEmails = new List<string>()
|
||||
{
|
||||
|
||||
@ -649,7 +649,7 @@ namespace SolarPower.Repository.Implement
|
||||
List<string> value = new List<string>();
|
||||
foreach (MyUser a in personal)
|
||||
{
|
||||
if (IsValidEmail(a.Email))
|
||||
if (a.Email != null && IsValidEmail(a.Email))
|
||||
{
|
||||
value.Add($@"(1,'{a.Name}','{a.Email}','{Title}','{content}',{a.Id}, {emailType})");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user