|
@@ -150,7 +150,8 @@ namespace DutyApp.ViewModels
|
|
.DefaultIfEmpty()
|
|
.DefaultIfEmpty()
|
|
.FirstOrDefaultAsync();
|
|
.FirstOrDefaultAsync();
|
|
|
|
|
|
- var dailyDuty = await _dutyContext.Information.Include(x => x.DailyNews)
|
|
|
|
|
|
+ var dailyDuty = await _dutyContext.Information
|
|
|
|
+ .Include(x => x.DailyNews)
|
|
.FirstOrDefaultAsync(x => x.Date == maxDate);
|
|
.FirstOrDefaultAsync(x => x.Date == maxDate);
|
|
|
|
|
|
if (dailyDuty == null)
|
|
if (dailyDuty == null)
|
|
@@ -159,6 +160,21 @@ namespace DutyApp.ViewModels
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (_information != null)
|
|
|
|
+ {
|
|
|
|
+ var result = await MessageBox.Show("导入上次值班信息记录会删除当前信息", "警告", MessageBoxButtons.YesNoCancel);
|
|
|
|
+ if (result == MessageBoxResult.Cancel) { return; }
|
|
|
|
+
|
|
|
|
+ var info = await _dutyContext.Information.FirstOrDefaultAsync(x => x.Id == _information.Id);
|
|
|
|
+ if (info != null)
|
|
|
|
+ {
|
|
|
|
+ _dutyContext.Information.Remove(info);
|
|
|
|
+ await _dutyContext.SaveChangesAsync();
|
|
|
|
+
|
|
|
|
+ _information = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
var temp = dailyDuty.Temperature.Split('>');
|
|
var temp = dailyDuty.Temperature.Split('>');
|
|
MaxTemp = int.Parse(temp[1]);
|
|
MaxTemp = int.Parse(temp[1]);
|
|
MinTemp = int.Parse(temp[0]);
|
|
MinTemp = int.Parse(temp[0]);
|
|
@@ -214,6 +230,12 @@ namespace DutyApp.ViewModels
|
|
{
|
|
{
|
|
if (_dutyContext == null) return;
|
|
if (_dutyContext == null) return;
|
|
|
|
|
|
|
|
+ if (MaxTemp < MinTemp)
|
|
|
|
+ {
|
|
|
|
+ await MessageBox.Show("最高温度不能小于最低温度");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
for (var index = 0; index < DailyNews.Count; index++)
|
|
for (var index = 0; index < DailyNews.Count; index++)
|
|
{
|
|
{
|
|
var dailyNew = DailyNews[index];
|
|
var dailyNew = DailyNews[index];
|