public override CurrentItemsCollection FillDataRow(int pos) { CurrentItemsCollection ci = new CurrentItemsCollection(); var obj = CurrentFromPosition(pos); if (obj != null) { CurrentItem currentItem = null; foreach (PropertyDescriptor pd in this.listProperties) { currentItem = new CurrentItem(pd.Name, pd.PropertyType); PropertyPath prop = obj.ParsePropertyPath(pd.Name); if (prop != null) { var pp = prop.Evaluate(obj); if (pp != null) { currentItem.Value = pp.ToString(); } } ci.Add(currentItem); } } return(ci); }
CurrentItemsCollection FillCurrentRow(DataRow row) { CurrentItemsCollection ci = new CurrentItemsCollection(); if (row != null) { CurrentItem c = null; foreach (DataColumn dc in table.Columns) { c = new CurrentItem(dc.ColumnName, dc.DataType); c.Value = row[dc.ColumnName]; ci.Add(c); } } return(ci); }
/* * public override CurrentItemsCollection FillDataRow(int pos) * { * CurrentItemsCollection ci = new CurrentItemsCollection(); * var obj = CurrentFromPosition(pos); * if (obj != null) * { * CurrentItem currentItem = null; * foreach (PropertyDescriptor pd in this.listProperties) * { * currentItem = new CurrentItem(); * currentItem.ColumnName = pd.Name; * currentItem.DataType = pd.PropertyType; * * var propValue = FollowPropertyPath(obj,pd.Name); * if (propValue != null) * { * currentItem.Value = propValue.ToString(); * } * else * { * currentItem.Value = String.Empty; * } * ci.Add(currentItem); * } * } * return ci; * } */ public override CurrentItemsCollection FillDataRow() { CurrentItemsCollection ci = base.FillDataRow(); if (current != null) { CurrentItem c = null; foreach (PropertyDescriptor pd in this.listProperties) { c = new CurrentItem(pd.Name, pd.PropertyType); var s = pd.GetValue(this.Current); if (s != null) { c.Value = s.ToString(); } else { c.Value = String.Empty; } ci.Add(c); } } return(ci); }
public override CurrentItemsCollection FillDataRow(int pos) { CurrentItemsCollection ci = new CurrentItemsCollection(); var obj = CurrentFromPosition(pos); if (obj != null) { CurrentItem currentItem = null; foreach (PropertyDescriptor pd in this.listProperties) { currentItem = new CurrentItem(pd.Name, pd.PropertyType); PropertyPath prop = obj.ParsePropertyPath(pd.Name); if (prop != null) { var pp = prop.Evaluate(obj); if (pp != null) { currentItem.Value = pp.ToString(); } } ci.Add(currentItem); } } return ci; }
CurrentItemsCollection FillCurrentRow( DataRow row) { CurrentItemsCollection ci = new CurrentItemsCollection(); if (row != null) { CurrentItem c = null; foreach (DataColumn dc in table.Columns) { c = new CurrentItem(dc.ColumnName,dc.DataType); c.Value = row[dc.ColumnName]; ci.Add(c); } } return ci; }