Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's the code I promised...</p> <p>It's not state of the art but it's a simple Console Application that gives you an idea about how to approach this. I basically read from the lists (in your case, you'd read from the database tables). Then I add the <code>DateCreated</code> and the Object itself into a custom class that allows one to order all objects by the <code>DateCreated</code> field. The presentation code is up to you, but I show you how to print to the console according to the object type.</p> <pre><code>class Program { static void Main(string[] args) { var projects = new List&lt;Project&gt;{ new Project() { ProjectId = 1, ProjectName = "My Secret Project", DateCreated = DateTime.Today.AddHours(-1) }, new Project() { ProjectId = 2, ProjectName = "My Big Project", DateCreated = DateTime.Today.AddHours(-2) }}; var projectImages = new List&lt;ProjectImage&gt; { new ProjectImage() { ProjectImageId = 1, ProjectImageSize = 17.17, DateCreated = DateTime.Today.AddHours(-3) }, new ProjectImage() { ProjectImageId = 2, ProjectImageSize = 10.17, DateCreated = DateTime.Today.AddHours(-4) }}; var objects = new List&lt;MyCustomClass&gt;(); foreach (var project in projects) { objects .Add( new MyCustomClass() { DateCreated = project.DateCreated, Object = project }); } foreach (var projectImage in projectImages) { objects.Add( new MyCustomClass() { DateCreated = projectImage.DateCreated, Object = projectImage }); } // Objects ordered by Date, Newest first... var objectsByDateCreated = objects.OrderByDescending(o =&gt; o.DateCreated); foreach (var @object in objectsByDateCreated) { Console.WriteLine(string.Format("{0} =&gt; {1}", @object.Object.GetType().Name, @object.DateCreated)); } // Displaying objects according to type foreach (var @object in objectsByDateCreated) { if (@object.Object is Project) { var project = @object.Object as Project; Console.WriteLine(project.ProjectName); } else if (@object.Object is ProjectImage) { var projectImage = @object.Object as ProjectImage; Console.WriteLine(projectImage.ProjectImageSize); } } } } public class MyCustomClass { public DateTime DateCreated { get; set; } public object Object { get; set; } } public class Project { public int ProjectId { get; set; } public string ProjectName { get; set; } public DateTime DateCreated { get; set; } } public class ProjectImage { public int ProjectImageId { get; set; } public double ProjectImageSize { get; set; } public DateTime DateCreated { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload