private Document GetDocument() { var document = new Document(); var row = new Row(); row.AddCell <string> ("valor1"); row.AddCell <string> ("valor2"); row.AddCell <double> ("10.5"); row.AddCell <bool> ("true"); document.AddRow(row); row = new Row(); row.AddCell <string> ("valor3"); row.AddCell <string> ("valor4"); row.AddCell <double> ("12.5"); row.AddCell <bool> ("false"); document.AddRow(row); row = new Row(); row.AddCell <string> ("valor5"); row.AddCell <string> ("valor6"); row.AddCell <double> ("14.5"); row.AddCell <bool> ("false"); document.AddRow(row); return(document); }
/// <summary> /// Expected data table format: /// { /// "datatable": [ /// ["Creator", "algorithm/logic", "build", ..., "testing"], /// ["Patrick Zhong", 3, 1, ..., 0] /// ] /// } /// </summary> /// <param name="source"></param> /// <param name="creators"></param> /// <returns></returns> private DataTable DefectCountOfTypeByCreator(List <DefectRecord> source, List <Employee> creators) { DataTable dataTable = new DataTable(); dataTable.AddColumn(new Column("string", "Creator")); foreach (string type in EagleEyeSettingsReader.Settings.DefectTypes) { dataTable.AddColumn(new Column("number", type)); } var query = creators .GroupJoin( source, employee => employee.LoginName, record => record.CreatorLogin, (employee, matching) => new { Creator = employee.FullName, Records = matching.ToList() } ); foreach (var item in query) { Row row = new Row(); row.AddCell(new Cell(item.Creator)); foreach (string type in EagleEyeSettingsReader.Settings.DefectTypes) { int count = item.Records.Count(record => record.Type == type); row.AddCell(new Cell(count)); } dataTable.AddRow(row); } return(dataTable); }
/// <summary> /// 密码登录 /// </summary> /// <param name="p_phone">手机号</param> /// <param name="p_pwd">密码</param> /// <returns></returns> public async Task <Row> LoginByPwd(string p_phone, string p_pwd) { Row result = new Row(); if (string.IsNullOrWhiteSpace(p_phone) || string.IsNullOrWhiteSpace(p_pwd)) { result.AddCell("IsSuc", false); result.AddCell("Error", "手机号或密码不可为空!"); return(result); } // 从缓存读取 var user = await _dp.GetByKey <User>("phone", p_phone); if (user == null || user.Pwd != p_pwd) { result.AddCell("IsSuc", false); result.AddCell("Error", "手机号不存在或密码错误!"); return(result); } result.AddCell("IsSuc", true); result.AddCell("UserID", user.ID); result.AddCell("Phone", p_phone); result.AddCell("Name", user.Name); result.AddCell("Photo", user.Photo); result.AddCell("Version", await GetAllVers(user.ID)); return(result); }
private void AddSavedGame(FileInfo fileInfo) { // Create row var row = new Row(fileInfo); // Add single cell var newSaveCell = new Cell( text: m_loadedWorldsByFilePaths[fileInfo.DirectoryName].SessionName, userData: fileInfo, icon: FileCellIconTexture, iconOriginAlign: FileCellIconAlign ); // Corrupted worlds should be red if (m_loadedWorldsByFilePaths[fileInfo.DirectoryName].IsCorrupted) { newSaveCell.TextColor = Color.Red; } row.AddCell(newSaveCell); // Add creation time row.AddCell(new Cell( text: fileInfo.CreationTime.ToString() )); Add(row); }
public Table GetTable() { var columns = new Dictionary <string, Column>(); var rows = new List <Row>(); foreach (var objectRow in _objectRows) { var row = new Row(); if (System.Convert.GetTypeCode(objectRow) == System.TypeCode.Object) { foreach (var property in objectRow.GetType().GetProperties()) { var name = property.Name; var column = columns.GetOrAdd(name, _ => new Column(name)); var value = property.GetValue(objectRow, null); row.AddCell(column, new Cell(value)); } } else { string name = objectRow.GetType().Name; var column = columns.GetOrAdd(name, _ => new Column(name)); row.AddCell(column, new Cell(objectRow)); } rows.Add(row); } return(new Table(columns.Values.ToList(), rows)); }
Row CreateData() { Row row = new Row(); row.AddCell <long>("id", -1); row.AddCell("name", "新目录"); return(row); }
private Row makeRow(DataTable dt, string name, string value) { Row r = dt.NewRow(); r.AddCell(new Cell(name)); r.AddCell(new Cell(value)); return(r); }
public TableData CreateTableData() { TableData td = new TableData(field); //int nrow; foreach (DataGridViewRow row in grid.Rows) { if (row.IsNewRow) { continue; } //nrow = row.Index; Row trow = td.AddRow(); foreach (DataGridViewColumn column in grid.Columns) { ColumnProperty cp = (ColumnProperty)column.Tag; DataGridViewCell cell = row.Cells[column.Name]; if (cell.Value != null) { if (cp.Reference != null) { bool find = false; foreach (ObjectData od in this.database.Objects.GetData(cp.Reference)) { if (od.ToString() == cell.Value.ToString()) { //td.AddCell(column.Name, nrow, od); trow.AddCell(cp, od); find = true; break; } } if (!find) { //td.AddCell(column.Name, nrow, string.Empty); trow.AddCell(cp, string.Empty); } } else { //td.AddCell(column.Name, nrow, dgvc.Value); trow.AddCell(cp, cell.Value); } } else { //td.AddCell(column.Name, nrow, string.Empty); trow.AddCell(cp, string.Empty); } } } return(td); }
public string GenerateGamesDatatableJson() { DataTable dt = new DataTable(); dt.AddColumn(new Column(ColumnType.String, "Stat", "Stat")); dt.AddColumn(new Column(ColumnType.String, "Value", "Value")); List <string> games = new List <string> { "krunker.io", "surviv.io", "2048.io", "tetris.io", "roblox.com", "fortnite.com" }; List <string> topDomains = new List <string>(); List <int> searches = new List <int>(); using (var scope = _scopeFactory.CreateScope()) { var _context = scope.ServiceProvider.GetRequiredService <NetworkVisualizerContext>(); topDomains = _context.Packet .Where(p => games.Contains(p.DestinationHostname)) .GroupBy(q => q.DestinationHostname) .OrderByDescending(gp => gp.Count()) .Take(10) .Select(g => g.Key).ToList(); int numberSearched; foreach (string domain in topDomains) { numberSearched = (from packet in _context.Packet where packet.DestinationHostname == domain && DateTime.UtcNow - packet.DateTime <= TimeSpan.FromHours(12) select packet).Count(); searches.Add(numberSearched); } } foreach (string domain in topDomains) { Row r = dt.NewRow(); r.AddCell(new Cell(domain)); r.AddCell(new Cell(searches[topDomains.IndexOf(domain)])); dt.AddRow(r); } return(dt.GetJson()); }
internal void LoadItem(RptText p_item) { _total = p_item.Parent as RptMtxSubtotal; Row row = new Row(); row.AddCell("span", _total.Data.Int("span")); row.AddCell("beforelevel", _total.Data.Bool("beforelevel")); row.Changed += OnChanged; _fv.Data = row; _fvMtx.LoadItem(_total.Level.Matrix); }
public Table GetTable() { var columns = new Dictionary <string, Column>(); var rows = new List <Row>(); var typeAccessors = new Dictionary <Type, TypeAccessor>(); var memberLists = new Dictionary <Type, Member[]>(); foreach (var objectRow in _objectRows) { var row = new Row(); var rowType = objectRow.GetType(); if (Convert.GetTypeCode(objectRow) == TypeCode.Object) { var accessor = typeAccessors.GetOrAdd(rowType, TypeAccessor.Create); var members = memberLists.GetOrAdd(rowType, type => GetMemberAccessors(accessor, type)); foreach (var member in members) { var name = member.Name; var column = columns.GetOrAdd(name, _ => new Column(name)); object GetValue() { try { return(accessor[objectRow, name]); } catch (Exception exception) { throw new ArgumentException($"Could not get value from property '{name}' of {rowType}", exception); } } var value = GetValue(); row.AddCell(column, new Cell(value)); } } else { var name = rowType.Name; var column = columns.GetOrAdd(name, _ => new Column(name)); row.AddCell(column, new Cell(objectRow)); } rows.Add(row); } return(new Table(columns.Values.ToList(), rows)); }
private Row GetRow(string[] fields, DocumentMetadata metadata, long line) { var row = new Row(); for (var i = 0; i < fields.Length; i++) { var columnMetadata = metadata.Columns.FirstOrDefault(x => x.ColumnNumber == i); if (columnMetadata == null) { throw new FieldFormatException(string.Format(Resources.CsvDocumentReader_ColumnNotDefined, i, metadata.DocumentName)); } var value = this.Normalize(fields[i]); if (!columnMetadata.IsNullable && string.IsNullOrEmpty(value)) { throw new FieldFormatException(string.Format(Resources.CsvDocumentReader_NullValueOnFieldNotAllowed, columnMetadata.Name, metadata.DocumentName, line)); } if ((typeof(string)) == (columnMetadata.GetType()) && columnMetadata.RemovableAccents) { value = this.RemoveAccents(value.ToLower()); } if ((typeof(string)) == (columnMetadata.GetType()) && columnMetadata.UpperCase) { value = value.ToUpper(); } var formattedValue = this.FormatField(metadata, columnMetadata, value); row.AddCell(formattedValue, columnMetadata.GetType()); } if (fields.Length < metadata.Columns.Count()) { for (var i = fields.Length; i < metadata.Columns.Count; i++) { var columnMetadata = metadata.Columns.FirstOrDefault(x => x.ColumnNumber == i); var cellType = columnMetadata.GetType(); var formattedValue = this.FormatField(metadata, columnMetadata, cellType.GetDefault().ToString()); row.AddCell(formattedValue, cellType); } } return(row); }
/// <summary> /// Add a row of elements to the table. /// </summary> public Row AddRow(params Element[] cells) { if (_update) { Update(); } // create a new row var row = new Row(this); // iterate the cells to be added to the new row foreach (var cell in cells) { row.AddCell(cell); if (row.Cells.Count > _columnCount) { _columnCount = row.Cells.Count; } } if (_columnCount < cells.Length) { _columnCount = cells.Length; } _rows.Add(row); return(row); }
static Table GetTableFromJsonArray(JArray jsonArray) { var columns = new Dictionary <string, Column>(); var rows = new List <Row>(); foreach (var jsonToken in jsonArray) { var row = new Row(); var jsonObject = jsonToken.Value <JObject>(); foreach (var property in jsonObject.Properties()) { var name = property.Name; var column = columns.GetOrAdd(name, _ => new Column(name)); var value = property.Value; var stringValue = value.Type == JTokenType.Array ? GetAsLines(value) : value.ToString(); row.AddCell(column, new Cell(stringValue)); } rows.Add(row); } return(new Table(columns.Values.ToList(), rows)); }
public void CanTakeAHint() { var column = new Column("Just a colum"); var row = new Row(); row.AddCell(column, new Cell(new string('*', 80))); var table = new Table(new List <Column> { column }, new List <Row> { row }); var text = TableFormatter.FormatTable(table, new Hints { MaxTableWidth = 50 }); Console.WriteLine(text); Assert.That(text.Normalized(), Is.EqualTo(@" =============================================== | Just a colum | =============================================== | ******************************************* | | ************************************* | =============================================== ".Normalized())); }
protected Table GetDataItemControl(Value.Item valueItem) { Table result = new Table() { ID = GetUniqueID(ID) }; Row headerRow = new Row() { Key = NON_DATA_KEY }; Row menuRow = new Row() { Key = NON_DATA_KEY }; Row tableRow = new Row(); headerRow.AddCell(new Cell()); menuRow.AddCell(new Cell()); tableRow.AddCell(GetNavigationCell(result.ID)); foreach (var field in SourceRowTemplate) { string editorId = GetUniqueID(ID); Item fieldItemType = SitecoreReflected.Instance.GetFieldTypeItem(field); headerRow.AddCell(new Cell(new LiteralWithViewState(HttpUtility.HtmlEncode(field.DisplayName ?? field.Name)), NON_DATA_KEY)); menuRow.AddCell(new Cell(SitecoreReflected.Instance.GetMenuButtons(fieldItemType, editorId), NON_DATA_KEY)); System.Web.UI.Control editor = SitecoreReflected.Instance.GetEditor(fieldItemType); SitecoreReflected.Instance.SetProperties(editor, editorId, field, ItemID, ItemVersion, ItemLanguage, ReadOnly); //TODO - Sitecore.Shell.Applications.ContentEditor.EditorFormatter.SetAttributes //TODO - Sitecore.Shell.Applications.ContentEditor.EditorFormatter.SetStyle if (valueItem != null) { SitecoreReflected.Instance.SetValue(editor, valueItem.properties.Where(p => p.key == field.Name).Select(p => p.value).FirstOrDefault()); } tableRow.AddCell(new Cell(editor, field.Name)); } result.AddRow(headerRow); result.AddRow(menuRow); result.AddRow(tableRow); return(result); }
public string GenerateMainDatatableJson() { DataTable dt = new DataTable(); // Get most searched domains in database, add non-top for graph List <string> topDomains; using (var scope = _scopeFactory.CreateScope()) { // Get context (database) var _context = scope.ServiceProvider.GetRequiredService <NetworkVisualizerContext>(); topDomains = _context.Packet .GroupBy(q => q.DestinationHostname) .OrderByDescending(gp => gp.Count()) .Take(4) .Select(g => g.Key).ToList(); topDomains.Add("other sites"); } // Add most searched domains as columns in datatable, with Time and Other category dt.AddColumn(new Column(ColumnType.String, "Time", "Time")); foreach (string domain in topDomains) { dt.AddColumn(new Column(ColumnType.Number, domain, domain)); } // Create datapoints for every hour, starting with 23 hours ago up to now for (int t = 0; t <= 24; t++) { Row r = dt.NewRow(); DateTime targetDateTime = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).AddHours(t); // Add rows, each with top search result numbers & a time with offset applied List <int> domainSearches = DomainSearches(topDomains, targetDateTime); r.AddCell(new Cell($"{targetDateTime.AddHours(Config.config.UTCHoursOffset).Hour}:00")); foreach (int s in domainSearches) { r.AddCell(new Cell(s)); } dt.AddRow(r); } // Return datatable as json return(dt.GetJson()); }
public void ExistCells_Exist_ReturnTrue() { Cell cell = createCell(); Row row = new Row(); row.AddCell(cell); Assert.IsTrue(row.ExistCell(cell.column.columnName)); }
public void AddCell() { Cell cell = createCell(); Row row = new Row(); row.AddCell(cell); Assert.IsNotNull(row.GetCell(cell.column.columnName)); }
private string GenerateDomainDatatableJson(string provider, bool inclusive) { DataTable dt = new DataTable(); // Get most searched domains with Google (eg. drive.google.com) List <string> topDomains = new List <string>(); using (var scope = _scopeFactory.CreateScope()) { var _context = scope.ServiceProvider.GetRequiredService <NetworkVisualizerContext>(); topDomains = _context.Packet .Where(p => p.DestinationHostname.Contains(provider) == inclusive) .GroupBy(q => q.DestinationHostname) .OrderByDescending(gp => gp.Count()) .Take(4) .Select(g => g.Key).ToList(); } // Add most searched domains as columns in datatable with Time dt.AddColumn(new Column(ColumnType.String, "Time", "Time")); foreach (string domain in topDomains) { dt.AddColumn(new Column(ColumnType.Number, domain, domain)); } // Create datapoints for every hour, starting with 12 hours ago up to now for (int t = 0; t <= 12; t++) { Row r = dt.NewRow(); DateTime targetDateTime = DateTime.UtcNow.Subtract(TimeSpan.FromHours(12)).AddHours(t); // Add rows, each with top search result numbers & a time with offset applied List <int> domainSearches = DomainSearches(topDomains, targetDateTime); r.AddCell(new Cell($"{targetDateTime.AddHours(Config.config.UTCHoursOffset).Hour}:00")); foreach (int s in domainSearches) { r.AddCell(new Cell(s)); } dt.AddRow(r); } return(dt.GetJson()); }
// Adds folder entry protected virtual void AddFolderRow(DirectoryInfo dir) { // Create row var row = new Row(dir); // Add single cell row.AddCell(new Cell( text: dir.Name, userData: dir, icon: FolderCellIconTexture, iconOriginAlign: FolderCellIconAlign )); // add filler - needed for sorting otherwise crashes row.AddCell(new Cell(String.Empty)); Add(row); }
public static Row CreateRow(List <string> cellData, List <Column> columns) { Row row = new Row(); for (int i = 0; i < cellData.Count; i++) { row.AddCell(new Cell(columns[i], cellData[i], null)); } return(row); }
public void GetCell() { String columnName = "C1"; Row row = new Row(); Cell c = new Cell(new Column(columnName, (DoubleType)DataTypesFactory.GetDataTypesFactory().GetDataType(TypesKeyConstants.DoubleTypeKey)), "data", null); row.AddCell(c); Assert.IsNotNull(row.GetCell(columnName)); }
public RptDemo() { InitializeComponent(); Row row = new Row(); //row.AddCell("type", "打开模板编辑窗口"); row.AddCell("type", "使用RptView预览"); _fv.Data = row; AttachEvent(); }
// Adds back entry that allows user to go up a level protected virtual void AddBackRow() { // Init new row if (m_backRow == null) { m_backRow = new Row(); m_backRow.AddCell(new Cell("..", icon: MyGuiConstants.TEXTURE_BLUEPRINTS_ARROW, iconOriginAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } Add(m_backRow); }
private void AddSavedGame(FileInfo fileInfo) { // Create row var row = new Row(fileInfo); // Add single cell row.AddCell(new Cell( text: m_loadedWorldsByFilePaths[fileInfo.DirectoryName].SessionName, userData: fileInfo, icon: FileCellIconTexture, iconOriginAlign: FileCellIconAlign )); // Add creation time row.AddCell(new Cell( text: fileInfo.CreationTime.ToString() )); Add(row); }
// Adds file entry protected virtual void AddFileRow(FileInfo file) { // Create row var row = new Row(file); // Add single cell row.AddCell(new Cell( text: file.Name, userData: file, icon: FileCellIconTexture, iconOriginAlign: FileCellIconAlign )); // Add creation time row.AddCell(new Cell( text: file.CreationTime.ToString() )); Add(row); }
internal void LoadItem(RptText p_item) { _title = p_item.Parent as RptMtxSubtitle; Row row = new Row(); row.AddCell("span", _title.Data.Int("span")); row.Changed += OnChanged; _fv.Data = row; _fvMtx.LoadItem(_title.Level.Matrix); }
public RptViewSetting(RptRoot p_root) { Root = p_root; Data = new Row(); Data.AddCell <string>("script"); Data.AddCell("showsearchform", true); Data.AddCell <bool>("autoquery"); Data.AddCell <bool>("showcolheader"); Data.AddCell <bool>("showrowheader"); Data.AddCell <bool>("showgridline"); Data.AddCell("showmenu", true); Data.AddCell("showcontextmenu", true); Data.Changed += Root.OnCellValueChanged; }
/// <summary> /// Expected data table format: /// { /// "datatable": [ /// ["Product", "Major", "Minor"], /// ["Team1", 20, 3], /// ["Team2", 16, 0] /// ] /// } /// </summary> public void GenerateDefectCountOfSeverityByProduct() { log.Info("Generating: Defect severity count by product ..."); DataTable dataTable = new DataTable(); dataTable.AddColumn(new Column("string", "Product")); foreach (string severity in EagleEyeSettingsReader.Settings.DefectSeverityTypes) { dataTable.AddColumn(new Column("number", severity)); } var query = EagleEyeSettingsReader.Settings.Products .GroupJoin( GetValidRecords(), product => product, record => record.CreatorProductName, (product, matching) => new { ProductName = product, Records = matching.ToList() } ); foreach (var item in query) { Row row = new Row(); row.AddCell(new Cell(item.ProductName)); foreach (string severity in EagleEyeSettingsReader.Settings.DefectSeverityTypes) { int count = item.Records.Count(record => record.Severity == severity); row.AddCell(new Cell(count)); } dataTable.AddRow(row); } EagleEyePlatformApi.EditDataTable(EagleEyeSettingsReader.Settings.DefectCountBySeverity.ChartId, dataTable); log.Info("Generating: Defect severity count by product ... Done."); }
public Result Select(string sql) { List<string> fields = new List<string>(); string fieldset = sql.Split(new string[] { "FROM" }, StringSplitOptions.None)[0].Replace("SELECT", ""); string[] sf = fieldset.Split(','); foreach (string item in sf) { string adder = ""; if (item.ToLower().Contains(" as ")) { adder = item.ToLower().Split(new string[] { " as " }, StringSplitOptions.None)[1].Trim(); } else { adder = item.Trim(); } if (adder.Contains('.')) { adder = adder.Split('.')[1]; } fields.Add(adder); } this.cmd.CommandText = sql; Result r = new Result(this.cmd.CommandText); if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open(); SQLiteDataReader re = this.cmd.ExecuteReader(); while (re.Read()) { Row row = new Row(re.StepCount); foreach (string f in fields) { row.AddCell(f, re[f].ToString()); } r.AddRow(row); } re.Close(); return r; }
// Adds back entry that allows user to go up a level protected virtual void AddBackRow() { // Init new row if(m_backRow == null) { m_backRow = new Row(); m_backRow.AddCell(new Cell("..", icon: MyGuiConstants.TEXTURE_BLUEPRINTS_ARROW, iconOriginAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } Add(m_backRow); }
public Result getRow(string table, string[] fields, string filter = "", string orderby = "", int limit = 0) { this.cmd.CommandText = "SELECT " + String.Join(",", fields) + " FROM " + table; if (!String.IsNullOrEmpty(filter)) this.cmd.CommandText += " WHERE " + filter; if (!String.IsNullOrEmpty(orderby)) this.cmd.CommandText += " ORDER BY " + orderby; if (limit > 0) this.cmd.CommandText += " LIMIT " + limit.ToString(); Result r = new Result(this.cmd.CommandText); if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open(); SQLiteDataReader re = this.cmd.ExecuteReader(); while (re.Read()) { Row row = new Row(re.StepCount); foreach (string f in fields) { row.AddCell(f, re[f].ToString()); } r.AddRow(row); } re.Close(); return r; }
public Result getRow(Joinable j, string[] fields, Condition[] c = null, GroupBy g = null, OrderBy[] o = null, int limit = 0) { this.cmd.CommandText = "SELECT " + String.Join(",", fields) + " FROM " + j.GetTableName(); if (c != null) { this.cmd.CommandText += " WHERE ("; foreach (Condition item in c) { this.cmd.CommandText += item.ToString() + " AND "; } this.cmd.CommandText = this.cmd.CommandText.Remove(this.cmd.CommandText.Length - 5); this.cmd.CommandText += ") "; } if (g != null) { this.cmd.CommandText += g.ToString(); } if (o != null) { this.cmd.CommandText += " ORDER BY "; foreach (OrderBy item in o) { this.cmd.CommandText += item.ToShortString() + ", "; } this.cmd.CommandText = this.cmd.CommandText.Remove(this.cmd.CommandText.Length - 2); } if (limit != 0) { this.cmd.CommandText += " LIMIT " + limit.ToString(); } Result r = new Result(this.cmd.CommandText); if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open(); SQLiteDataReader re = this.cmd.ExecuteReader(); while (re.Read()) { Row row = new Row(re.StepCount); foreach (string f in fields) { row.AddCell(f, re[f].ToString()); } r.AddRow(row); } re.Close(); return r; }
/// <summary> /// Get a Join on TWO tables. /// </summary> /// <param name="tables"></param> /// <param name="c"></param> /// <param name="g"></param> /// <param name="o"></param> /// <returns></returns> public Result Join(Joinable[] tables, Condition[] c, GroupBy g, OrderBy[] o) { string sql = "SELECT "; List<string> fields = new List<string>(); foreach (Joinable j in tables) { sql += String.Join(",", j.GetFields(true)) + ", "; foreach (string item in j.GetFields(true)) { fields.Add(item); } } sql = sql.Remove(sql.Length - 2); sql += " FROM "; foreach (Joinable j in tables) { sql += j.GetTableName() + ", "; } sql = sql.Remove(sql.Length - 2); sql += " WHERE ("; sql += tables[0].GetJoinOn(tables[1]) + "=" + tables[1].GetJoinOn(tables[0]); //TODO: make this work for more tables... sql += ") "; if (c != null) { sql += " AND ("; foreach (Condition item in c) { sql += item.ToString() + " AND "; } sql = sql.Remove(sql.Length - 5); sql += ") "; } if (g != null) { sql += g.ToString(); } if (o != null) { sql += " ORDER BY "; foreach (OrderBy item in o) { sql += item.ToShortString() + ", "; } sql = sql.Remove(sql.Length - 2); } this.cmd.CommandText = sql; Result r = new Result(this.cmd.CommandText); if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open(); SQLiteDataReader re = this.cmd.ExecuteReader(); while (re.Read()) { Row row = new Row(re.StepCount); foreach (string f in fields) { row.AddCell(f, re[f].ToString()); } r.AddRow(row); } re.Close(); return r; }