public ClassicReportDataEventArgs(object target, ReportComposerEventArgs e) { this._target = target; this.ArrayIndex = e.ArrayIndex; this.ColumnName = e.ColumnName; this.Index = e.Index; this.TableName = e.TableName; this.Value = e.Value; }
public ClassicReportDataEventArgs(object target, ReportComposerEventArgs e) { this._target = target; this.ArrayIndex = e.ArrayIndex; this.ColumnName = e.ColumnName; this.Index = e.Index; this.TableName = e.TableName; this.Value = e.Value; }
void OnReadData(object sender, ReportComposerEventArgs e) { // let the client process the data first ClassicReportDataEventArgs args = new ClassicReportDataEventArgs(target, e); if (ValueOverride != null) { ValueOverride(this, args); if (args.Handled) { e.Value = args.Value; return; } } // the client did not process the data object _ds; if (DataSource is BindingSource) { _ds = ((BindingSource)DataSource).DataSource; } else { _ds = DataSource; } if (_ds is System.Data.DataSet || _ds is System.Data.DataTable) { System.Data.DataRow row = (System.Data.DataRow)target; e.Value = row[e.ColumnName]; } else { PropertyInfo property = target.GetType().GetProperty(e.ColumnName); if (property != null) { e.Value = property.GetValue(target, null); } else { e.Value = null; } } }
void OnInitData(object sender, ReportComposerEventArgs e) { object _ds; if (DataSource is BindingSource) { _ds = ((BindingSource)DataSource).DataSource; } else { _ds = DataSource; } // initialize the record count and datasource here if (e.Bof) { e.Bof = false; if (_ds is System.Data.DataSet) { e.Count = ((System.Data.DataSet)_ds).Tables[0].Rows.Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds is System.Data.DataTable) { e.Count = ((System.Data.DataTable)_ds).Rows.Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds is IEnumerable) { e.Count = int.MaxValue; enumerator = ((IEnumerable)_ds).GetEnumerator(); } else if (_ds is IList) { e.Count = ((IList)_ds).Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds != null) { e.Count = 1; } else { e.Eof = true; return; } } // process a row here. if (_ds is System.Data.DataSet) { target = ((System.Data.DataSet)_ds).Tables[0].Rows[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else if (_ds is System.Data.DataTable) { target = ((System.Data.DataTable)DataSource).Rows[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else if (_ds is IEnumerable) { if (enumerator.MoveNext()) { target = enumerator.Current; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else { e.Eof = true; } } else if (_ds is IList) { target = ((IList)_ds)[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else { target = _ds; } }
void OnReadData(object sender, ReportComposerEventArgs e) { // let the client process the data first ClassicReportDataEventArgs args = new ClassicReportDataEventArgs(target, e); if (ValueOverride != null) { ValueOverride(this, args); if (args.Handled) { e.Value = args.Value; return; } } // the client did not process the data object _ds; if (DataSource is BindingSource) _ds = ((BindingSource)DataSource).DataSource; else _ds = DataSource; if (_ds is System.Data.DataSet || _ds is System.Data.DataTable) { System.Data.DataRow row = (System.Data.DataRow)target; e.Value = row[e.ColumnName]; } else { PropertyInfo property = target.GetType().GetProperty(e.ColumnName); if (property != null) e.Value = property.GetValue(target, null); else e.Value = null; } }
void OnInitData(object sender, ReportComposerEventArgs e) { object _ds; if (DataSource is BindingSource) _ds = ((BindingSource)DataSource).DataSource; else _ds = DataSource; // initialize the record count and datasource here if (e.Bof) { e.Bof = false; if (_ds is System.Data.DataSet ) { e.Count = ((System.Data.DataSet)_ds).Tables[0].Rows.Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds is System.Data.DataTable) { e.Count = ((System.Data.DataTable)_ds).Rows.Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds is IEnumerable) { e.Count = int.MaxValue; enumerator = ((IEnumerable)_ds).GetEnumerator(); } else if (_ds is IList) { e.Count = ((IList)_ds).Count; if (e.Count == 0) { e.Eof = true; return; } } else if (_ds != null) { e.Count = 1; } else { e.Eof = true; return; } } // process a row here. if (_ds is System.Data.DataSet) { target = ((System.Data.DataSet)_ds).Tables[0].Rows[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else if (_ds is System.Data.DataTable) { target = ((System.Data.DataTable)DataSource).Rows[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else if (_ds is IEnumerable) { if (enumerator.MoveNext()) { target = enumerator.Current; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else e.Eof = true; } else if (_ds is IList) { target = ((IList)_ds)[e.Index]; OnRowChanged(new ClassicReportDataEventArgs(target, e)); } else { target = _ds; } }