public static QueryResult Get(string selectText) { IDbConnection dbConnection = App.Instance.DbConnection; if (dbConnection.State.ToString () == "Closed") { dbConnection.Open (); } IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = selectText; IDataReader dataReader = dbCommand.ExecuteReader (); QueryResult queryResult = new QueryResult (); queryResult.ColumNames = getColumnNames (dataReader); int numeroColumnas = dataReader.FieldCount; List<IList> values = new List<IList> (); while (dataReader.Read()) { values.Add(getValues(dataReader)); } queryResult.Rows = values; dataReader.Close (); dbConnection.Close (); return queryResult; }
public static void Fill(TreeView treeView, QueryResult queryResult) { string[] columnNames = queryResult.ColumnNames; CellRendererText cellRendererText = new CellRendererText (); for (int index = 0; index < columnNames.Length; index++) { int column = index; treeView.AppendColumn (columnNames [index], cellRendererText, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue(iter, 0); cellRendererText.Text = row[column].ToString(); }); } ListStore listStore = new ListStore (typeof(IList)); foreach (IList row in queryResult.Rows) listStore.AppendValues (row); treeView.Model = listStore; }
public static QueryResult Get(string selectText) { IDbConnection dbConnection = App.Instance.DbConnection; IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = selectText; IDataReader dataReader = dbCommand.ExecuteReader (); QueryResult queryResult = new QueryResult (); queryResult.ColumnNames = getColumnNames (dataReader); List<IList> rows = new List<IList> (); while (dataReader.Read()) { IList row = getRow (dataReader); rows.Add (row); } queryResult.Rows = rows; dataReader.Close (); return queryResult; }
public static void fill(ComboBox comboBox,QueryResult queryResult) { CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { IList row = (IList) tree_model.GetValue(iter,0); cellRendererText.Text = row[1].ToString(); }); ListStore listStore = new ListStore(typeof(IList)); IList first = new object[]{null,"<sin asignar>"}; TreeIter treeIterFirst = listStore.AppendValues (first); foreach(IList row in queryResult.Rows){ listStore.AppendValues(row); } comboBox.Model = listStore; comboBox.SetActiveIter (treeIterFirst); }
public TreeViewHelper(TreeView treeViewExt, QueryResult queryResultExt) { this.treeView = treeViewExt; this.queryResult = queryResultExt; }
public TreeViewHelperGenericGraphic(TreeView treeViewExt, QueryResult queryResultExt,string tabla) { this.treeView = treeViewExt; this.queryResult = queryResultExt; this.tabla = tabla; }