Filterung der Ergebnisse nach dem Zeitintervall hinzugefügt

This commit is contained in:
Daniel Schick 2023-03-01 10:49:33 +01:00
parent 47336e0b8d
commit 6fc09ad7da

View File

@ -270,7 +270,7 @@ namespace ENI2.Controls
this.maerskDataList.Add(md);
}
}
this.TimeFilterItemSource();
this.SortItemSource();
this.dataGridPOCores.SelectedItem = null;
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
@ -291,6 +291,29 @@ namespace ENI2.Controls
return null;
}
private void TimeFilterItemSource()
{
List<MaerskData> removeList = new List<MaerskData>();
foreach (MaerskData md in this.maerskDataList)
{
if (md.ETA.HasValue)
{
if (this.dateTimePickerFrom.SelectedDate.HasValue && (md.ETA.Value < this.dateTimePickerFrom.SelectedDate.Value))
removeList.Add(md);
if (this.dateTimePickerTo.SelectedDate.HasValue) {
DateTime toDate = this.dateTimePickerTo.SelectedDate.Value.ToUniversalTime().Add(new TimeSpan(23, 59, 59));
if(md.ETA.Value > toDate)
removeList.Add(md);
}
}
}
foreach (MaerskData md in removeList)
this.maerskDataList.Remove(md);
}
private void SortItemSource()
{
ObservableCollection<MaerskData> temp;
@ -425,6 +448,7 @@ namespace ENI2.Controls
maerskDataList.Add(md);
}
}
this.TimeFilterItemSource();
this.SortItemSource();
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
}