public async Task <JsonResult> OnGetAsync(string name, string sort) { JsonResult results = null; await Task.Run(() => { if (Program.Workspace.QueryExists(name)) { string className = name + DateTime.Now.Ticks.ToString(); IDataList test = Program.Workspace.GetQueryData(name); if (!string.IsNullOrEmpty(sort)) { var sorts = sort.Split(','); for (int i = 0; i < sorts.Length; i++) { string field = sorts[i]; bool ascend = field[0] == '+'; string[] parts = field.Substring(1).Split('.'); string prop = parts[parts.Length - 1]; DataList.Sort(test, prop, ascend); } } var list = ClassFactory.CreateFromDataList(test, className); results = new JsonResult(list); } }); return(results ?? new JsonResult(null)); }
public MainWindow() { InitializeComponent(); Workspace workspace = Northwind.Invoice.GetWorkspace(); var results = workspace.GetQueryData("SalesByEmployeeCountry"); dataGrid1.ItemsSource = ClassFactory.CreateFromDataList(results); }
public MainWindow() { InitializeComponent(); ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; Workspace workspace = Northwind.Invoice.GetWorkspace(); var results = workspace.GetQueryData("SalesByEmployeeCountry"); dataGrid1.ItemsSource = ClassFactory.CreateFromDataList(results); }
public void OnGet() { IDataList species = Program.Workspace.GetQueryData("BySpecies"); BySpecies = ClassFactory.CreateFromDataList(species, "BySpecies"); IDataList years = Program.Workspace.GetQueryData("ByYear"); ByYear = ClassFactory.CreateFromDataList(years, "ByYear"); IDataList names = Program.Workspace.GetQueryData("DogNames", 10); // Limit results to 10 rows DataList.Sort(names, "Count", false); // Sort by Count in descending order DogNames = ClassFactory.CreateFromDataList(names); IDataList others = Program.Workspace.GetQueryData("OtherAnimals"); OtherAnimals = ClassFactory.CreateFromDataList(others, "OtherAnimals"); IDataList king = Program.Workspace.GetQueryData("KingCounty"); KingCounty = ClassFactory.CreateFromDataList(king, "KingCounty"); }