diff --git a/ENI2/Controls/MaerskListControl.xaml.cs b/ENI2/Controls/MaerskListControl.xaml.cs index 1f6e8b6d..e7bec545 100644 --- a/ENI2/Controls/MaerskListControl.xaml.cs +++ b/ENI2/Controls/MaerskListControl.xaml.cs @@ -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 removeList = new List(); + 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 temp; @@ -425,6 +448,7 @@ namespace ENI2.Controls maerskDataList.Add(md); } } + this.TimeFilterItemSource(); this.SortItemSource(); busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL; }