Bugfix for comparer when times value is null and DateTime.Now is inconsistent
This commit is contained in:
parent
d4903b80d4
commit
e33833235d
@ -817,14 +817,20 @@ namespace BreCalClient
|
||||
{
|
||||
if (x.Shipcall == null) return 0;
|
||||
if (y.Shipcall == null) return 0;
|
||||
DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? (x.Eta ?? now) : (x.Etd ?? now);
|
||||
|
||||
Times? xTimes = x.GetTimesForParticipantType(ParticipantType.AGENCY);
|
||||
if(xTimes != null)
|
||||
xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? xTimes.EtaBerth ?? DateTime.Now : xTimes.EtdBerth ?? DateTime.Now;
|
||||
DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
|
||||
xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? (xTimes.EtaBerth ?? now) : (xTimes.EtdBerth ?? now);
|
||||
|
||||
DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? (y.Eta ?? now) : (y.Etd ?? now);
|
||||
|
||||
Times? yTimes = y.GetTimesForParticipantType(ParticipantType.AGENCY);
|
||||
if (yTimes != null)
|
||||
yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? yTimes.EtaBerth ?? DateTime.Now : yTimes.EtdBerth ?? DateTime.Now;
|
||||
yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? (yTimes.EtaBerth ?? now) : (yTimes.EtdBerth ?? now);
|
||||
|
||||
return DateTime.Compare(xDate, yDate);
|
||||
});
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user