I have a class that has 4 properties: employee number, logintime, last delivery time, and position.
I need to assign position first by log in time, then by last delivery time. (so whoever logged in first is first, but whoever took the last delivery is last regardless of log in times)
Please help, it is of type List<>.
Loading

Kirtan PatelRank #292 · 8.6K reputationPosted Aug 18, 2009, 9:19 AM EDT
where the Fields Are Deliver time Etc ??in database ?
patrickRank #4,458 · 342 reputationPosted Aug 18, 2009, 9:19 AM EDT
private static int CompareDrivers(DriverQueuePosition x, DriverQueuePosition y)
{
if (x.LoggedIn == y.LoggedIn)
{
return 0;
}
else if (x.LoggedIn < y.LoggedIn)
{
if (x.LastDelTime < y.LastDelTime)
{
return -1;
}
else
{
return 1;
}
}
else
{
if (x.LastDelTime > y.LastDelTime)
{
return 1;
}
else
{
return -1;
}
}
}
patrickRank #4,458 · 342 reputationPosted Aug 18, 2009, 9:20 AM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 18, 2009, 9:27 AM EDT
patrickRank #4,458 · 342 reputationPosted Aug 18, 2009, 9:31 AM EDT
patrickRank #4,458 · 342 reputationPosted Aug 18, 2009, 9:35 AM EDT