Last active
November 5, 2019 20:35
-
-
Save vpetkovic/e6b93bc98db319c33753055eadb8ad28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install System.Data.DataSetExtensions from NUGET | |
using System; | |
using System.Linq; | |
using System.Data; | |
public class newClass | |
{ | |
public object DataSetToObject() | |
{ | |
DataTable search = new DataTable(); | |
search = utilities.sql.storedProcToTable([connectionName], [StoredProecude]); | |
List<object> summaryByDay = new List<object>(); | |
foreach (DataTable tbl in ds.Tables) | |
{ | |
summaryByDay.Add( | |
new SummaryByDay | |
{ | |
date = tbl.Rows[0]["runDate"].ToString(), | |
summary = tbl.AsEnumerable().Select(row => | |
new summary | |
{ | |
DocType = row.Field<string>("DocType") | |
}).ToList() | |
} | |
); | |
} | |
} | |
} | |
public class SummaryByDay | |
{ | |
public string date { get; set; } | |
public ICollection<summary> summary { get; set; } | |
} | |
public class summary | |
{ | |
public string DocType { get; set; } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment