I couldn't express better what I am asking in the title.
This is what I'm looking.
I have a disordered List of an Specific Object I have a DateTime
and String
Property.
The String Property Has values Like this ones (note that it is an string, not a number, it always has the K letter, I should be ordering with just the numbers):
K07000564,
K07070000
K07069914
K07026318
K07019189
What I want is to order the List By Date... but when ordering if the String value is present in the collection with other Date I want to order them just after this one (By Date also in that miniGroup of IdFinders)... and then keep ordering...
Something Like this:
Edit
I edited the example to clarify that ordering by IdFinder will not work... I need to order By Date.. if when ordering by Date the IdFinder is present more than once in the collection should show them just after this last one, and then keep ordering the rest of them and so on by each idfinder
ID Date
**K07000564** Today
K07000562 Yesterday
K07000563 The Day Before Yesterday
**K07000564** The day before the day before yesterday
Should be
K07000564 Today
K07000564 The day before the day before yesterday
K07000562 Yesterday
K07000563 The Day Before Yesterday
I achieved this in SQL Server 2008 in a project before with something like this:
WITH B
AS
(
SELECT
ID,
MAX(DATE_COLUMN) DATE_COLUMN,
ROW_NUMBER() OVER (ORDER BY MAX(DATE_COLUMN) DESC) RN
FROM MYTABLE
GROUP BY ID
)
SELECT *
FROM MYTABLE c
, B
WHERE ID= b.ID
ORDER BY b.rn, c.DATE_COLUMN desc;
But I'm not good with Linq and I have no idea of how doing this in Linq.
Maybe an Important Note I'm in .NEt 2.0, so no LINQ available but I'm using Linqbridge to use Linq.
I tried this, but as you will notice, this will not work
oList.OrderBy(i => i.IdFinder).ThenByDescending(i => i.OperationDate);
I hope to have explained this clearly