public int Compare(object x, object y) { DataSourceRow r1 = (DataSourceRow)x; DataSourceRow r2 = (DataSourceRow)y; return(baseComparer.Compare(r1.BoundItem, r2.BoundItem)); }
public override void SetMemberValue(object pValue) { try { DataSourceRow.SetMemberValue(_fieldName, pValue); } catch (Exception ex) { _log.Error(ex.Message, ex); } }
private void InitDataSet() { DataTable table = ((DataSet)dataSource).Tables[this.dataMember]; // use reflection to discover all properties of the object foreach (DataColumn c in table.Columns) { Columns.Add(c.ColumnName); ColumnTypes.Add(c.GetType()); } foreach (DataRow r in table.Rows) { DataSourceRow row = new DataSourceRow(this, r); for (int i = 0; i < Columns.Count; i++) { row.Add(r[i]); } Rows.Add(row); } }
private void InitList() { IList list = (IList)dataSource; // use reflection to discover all properties of the object BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty; PropertyInfo[] props = list[0].GetType().GetProperties(); foreach (PropertyInfo pi in props) { Columns.Add(pi.Name); ColumnTypes.Add(pi.PropertyType); } foreach (object obj in list) { DataSourceRow row = new DataSourceRow(this, obj); foreach (PropertyInfo pi in props) { object result = obj.GetType().InvokeMember(pi.Name, bf, null, obj, null); row.Add(result); } Rows.Add(row); } }
private void InitGrid() { OutlookGrid grid = (OutlookGrid)dataSource; // use reflection to discover all properties of the object foreach (DataGridViewColumn c in grid.Columns) { Columns.Add(c.Name); ColumnTypes.Add(c.GetType()); } foreach (OutlookGridRow r in grid.Rows) { if (!r.IsGroupRow && !r.IsNewRow) { DataSourceRow row = new DataSourceRow(this, r); for (int i = 0; i < Columns.Count; i++) { row.Add(r.Cells[i].Value); } Rows.Add(row); } } }
public override object GetMemberValue() { return(DataSourceRow.GetMemberValue(_fieldName)); }