protected async Task <Data.TableSet> FormatData(DataTableCollection tables) { Data.Table config = (new Config()).Learning(); return(await Task.Run(() => { Data.TableSet tableSet = new Data.TableSet(); foreach (DataTable _temp in tables) { Data.TableList liTable = new Data.TableList(); foreach (DataRow row in _temp.Rows) { var obj = new Data.Object(); foreach (var attribute in row.Table.Columns) { obj.Add(attribute.ToString(), row[attribute.ToString()]); } ; if (!String.IsNullOrEmpty(obj[config[row.Table.TableName]["key"].ToString()].ToString())) { liTable.Add(config[_temp.TableName.ToString()]["key"].ToString(), obj); } } ; Data.Table tbl = new Data.Table(); foreach (var list in liTable.Objects) { var properties = new Dictionary <string, List <string> >(); foreach (var item in list) { foreach (var p in item) { if (properties.ContainsKey(p.Key) && !String.IsNullOrEmpty(p.Value.ToString())) { properties[p.Key.ToString()].Add(p.Value.ToString()); List <string> li = properties[p.Key] .Distinct() .ToList(); properties[p.Key.ToString()] = li; } else if (!String.IsNullOrEmpty(p.Value.ToString())) { List <string> li = new List <string>(); li.Add(p.Value.ToString()); properties.Add(p.Key.ToString(), li); } } } tbl.Add(config[_temp.TableName.ToString()]["key"].ToString(), new Data.Object() { { config[_temp.TableName.ToString()]["key"].ToString(), list.First()[config[_temp.TableName.ToString()]["key"].ToString()] }, { "properties", properties } }); } tableSet.Add(_temp.TableName.ToString(), tbl); } ; return tableSet; })); }
public Data.Table AnalyzeClick() { Data.Table tbl = new Data.Table(); tbl.Add("name", new Data.Object() { { "name", "Load" }, { "message", "Loading Data..." }, { "data", null } }); tbl.Add("name", new Data.Object() { { "name", "Format" }, { "message", "Formatting Data..." }, { "data", null } }); tbl.Add("name", new Data.Object() { { "name", "Analyze" }, { "message", "Analyzing Data..." }, { "data", null } }); tbl.Add("name", new Data.Object() { { "name", "Export" }, { "message", "Exporting Data..." }, { "data", null } }); return(tbl); }
public Data.Table Learning() { Data.Table tbl = new Data.Table(); tbl.Add("name", new Data.Object() { { "name", "Summary" }, { "key", "Web Service" }, { "analyze", false } }); tbl.Add("name", new Data.Object() { { "name", "Topics" }, { "key", "Learning Topic Name*" }, { "analyze", false } }); tbl.Add("name", new Data.Object() { { "name", "Instructors" }, { "key", "Learning Instructor" }, { "analyze", false } }); tbl.Add("name", new Data.Object() { { "name", "Blended Courses" }, { "key", "Course Title*" }, { "analyze", true } }); tbl.Add("name", new Data.Object() { { "name", "Course Offerings" }, { "key", "Blended Course*" }, { "analyze", true } }); tbl.Add("name", new Data.Object() { { "name", "Digital Course" }, { "key", "Course Title*_1" }, { "analyze", true } }); return(tbl); }