|
|
|
@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
|
|
|
|
|
// This code was generated by a tool.
|
|
|
|
|
// Runtime Version: 1.1.4322.2032
|
|
|
|
|
//
|
|
|
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
|
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
|
|
|
// the code is regenerated.
|
|
|
|
|
// </autogenerated>
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
@ -14,8 +14,6 @@ using System.Collections;
@@ -14,8 +14,6 @@ using System.Collections;
|
|
|
|
|
using System.ComponentModel; |
|
|
|
|
using System.Globalization; |
|
|
|
|
|
|
|
|
|
//using SharpReportCore;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This Class is used as a wrapper around Databinding
|
|
|
|
|
/// </summary>
|
|
|
|
@ -23,10 +21,11 @@ using System.Globalization;
@@ -23,10 +21,11 @@ using System.Globalization;
|
|
|
|
|
/// created by - Forstmeier Peter
|
|
|
|
|
/// created on - 16.10.2005 14:49:43
|
|
|
|
|
/// </remarks>
|
|
|
|
|
namespace SharpReportCore { |
|
|
|
|
namespace SharpReportCore { |
|
|
|
|
|
|
|
|
|
public class DataManager : IDataContainer,IEnumerator,IDisposable { |
|
|
|
|
public class DataManager : IDataContainer,IEnumerator,IDisposable { |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Operand to use when filtering...
|
|
|
|
|
/// </summary>
|
|
|
|
@ -36,6 +35,8 @@ namespace SharpReportCore {
@@ -36,6 +35,8 @@ namespace SharpReportCore {
|
|
|
|
|
Includes, |
|
|
|
|
NotIncludes, |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
int currentRow = -1; |
|
|
|
|
|
|
|
|
|
ReportSettings reportSettings; |
|
|
|
@ -45,10 +46,10 @@ namespace SharpReportCore {
@@ -45,10 +46,10 @@ namespace SharpReportCore {
|
|
|
|
|
IDbConnection connection; |
|
|
|
|
IDataViewStrategy dataViewStrategy; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); |
|
|
|
|
|
|
|
|
|
public event ListChangedEventHandler ListChanged; |
|
|
|
|
// private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1);
|
|
|
|
|
|
|
|
|
|
public event EventHandler <ListChangedEventArgs> ListChanged; |
|
|
|
|
public event EventHandler <GroupChangedEventArgs> GroupChanged; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -70,7 +71,7 @@ namespace SharpReportCore {
@@ -70,7 +71,7 @@ namespace SharpReportCore {
|
|
|
|
|
|
|
|
|
|
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged); |
|
|
|
|
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged); |
|
|
|
|
} catch (Exception) { |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
@ -83,11 +84,10 @@ namespace SharpReportCore {
@@ -83,11 +84,10 @@ namespace SharpReportCore {
|
|
|
|
|
CheckAndSetSource(dataSource); |
|
|
|
|
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged); |
|
|
|
|
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged); |
|
|
|
|
} catch (Exception) { |
|
|
|
|
throw ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DataManager(DataSet dataSource, ReportSettings reportSettings) |
|
|
|
@ -102,8 +102,8 @@ namespace SharpReportCore {
@@ -102,8 +102,8 @@ namespace SharpReportCore {
|
|
|
|
|
CheckAndSetReportSettings(reportSettings); |
|
|
|
|
CheckAndSetSource(dataSource); |
|
|
|
|
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged); |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged); |
|
|
|
|
} catch (Exception ) { |
|
|
|
|
throw ; |
|
|
|
|
} |
|
|
|
@ -115,8 +115,8 @@ namespace SharpReportCore {
@@ -115,8 +115,8 @@ namespace SharpReportCore {
|
|
|
|
|
CheckAndSetSource(dataSource); |
|
|
|
|
this.dataViewStrategy = new CollectionStrategy ((IList)this.dataSource, |
|
|
|
|
this.dataMember, |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged); |
|
|
|
|
reportSettings); |
|
|
|
|
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged); |
|
|
|
|
} catch (Exception) { |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
@ -124,11 +124,11 @@ namespace SharpReportCore {
@@ -124,11 +124,11 @@ namespace SharpReportCore {
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CheckAndSetReportSettings(ReportSettings settings) { |
|
|
|
|
if (settings == null) { |
|
|
|
|
throw new ArgumentNullException("DataManager:ReportSettings"); |
|
|
|
|
throw new ArgumentNullException("settings"); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
if (settings.DataModel != GlobalEnums.enmPushPullModel.PushData) { |
|
|
|
@ -150,38 +150,39 @@ namespace SharpReportCore {
@@ -150,38 +150,39 @@ namespace SharpReportCore {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (source is IList ||source is IListSource || source is IBindingList) { |
|
|
|
|
|
|
|
|
|
//DataTable
|
|
|
|
|
this.dataSource = source; |
|
|
|
|
if (source is DataTable) { |
|
|
|
|
DataTable tbl = source as DataTable; |
|
|
|
|
this.dataMember = tbl.TableName; |
|
|
|
|
DataTable table = this.dataSource as DataTable; |
|
|
|
|
if (table != null) { |
|
|
|
|
|
|
|
|
|
this.dataMember = table.TableName; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//DataSet
|
|
|
|
|
if (source is DataSet) { |
|
|
|
|
DataSet ds = source as DataSet; |
|
|
|
|
if (ds.Tables.Count > 0) { |
|
|
|
|
|
|
|
|
|
DataSet dataSet = this.dataSource as DataSet; |
|
|
|
|
if (dataSet != null) { |
|
|
|
|
if (dataSet.Tables.Count > 0) { |
|
|
|
|
DataTable tbl; |
|
|
|
|
if (String.IsNullOrEmpty(this.dataMember)){ |
|
|
|
|
tbl = ds.Tables[0]; |
|
|
|
|
tbl = dataSet.Tables[0]; |
|
|
|
|
} else { |
|
|
|
|
DataTableCollection tcol = ds.Tables; |
|
|
|
|
DataTableCollection tcol = dataSet.Tables; |
|
|
|
|
if (tcol.Contains(this.dataMember)) { |
|
|
|
|
tbl = tcol[this.dataMember]; |
|
|
|
|
this.dataSource = tbl; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
}else { |
|
|
|
|
throw new ArgumentException("DataManager:No Tables in DataSet"); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//IList
|
|
|
|
|
if (source is IList) { |
|
|
|
|
IList list = source as IList; |
|
|
|
|
IList list = source as IList; |
|
|
|
|
if (list != null) { |
|
|
|
|
this.dataSource = list; |
|
|
|
|
this.dataMember = source.ToString(); |
|
|
|
|
if (list.Count == 0) { |
|
|
|
@ -189,7 +190,18 @@ namespace SharpReportCore {
@@ -189,7 +190,18 @@ namespace SharpReportCore {
|
|
|
|
|
throw new ArgumentException("No empty IList allowed"); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// if (source is IList) {
|
|
|
|
|
// IList list = source as IList;
|
|
|
|
|
// this.dataSource = list;
|
|
|
|
|
// this.dataMember = source.ToString();
|
|
|
|
|
// if (list.Count == 0) {
|
|
|
|
|
// //System.Console.WriteLine("List mit {0} Rows",list.Count);
|
|
|
|
|
// throw new ArgumentException("No empty IList allowed");
|
|
|
|
|
// }
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
} else { |
|
|
|
|
throw new ArgumentException ("DataManager:Wrong DataSource"); |
|
|
|
|
} |
|
|
|
@ -225,7 +237,6 @@ namespace SharpReportCore {
@@ -225,7 +237,6 @@ namespace SharpReportCore {
|
|
|
|
|
DataSet ds = new DataSet(); |
|
|
|
|
ds.Locale = CultureInfo.CurrentCulture; |
|
|
|
|
adapter.Fill (ds); |
|
|
|
|
// System.Console.WriteLine("\t {0} in Table",ds.Tables[0].Rows.Count);
|
|
|
|
|
return ds; |
|
|
|
|
} catch (Exception) { |
|
|
|
|
throw; |
|
|
|
@ -237,7 +248,7 @@ namespace SharpReportCore {
@@ -237,7 +248,7 @@ namespace SharpReportCore {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void CheckForAndBuildParams (OleDbCommand cmd,ReportSettings reportSettings) { |
|
|
|
|
private static void CheckForAndBuildParams (OleDbCommand cmd,ReportSettings reportSettings) { |
|
|
|
|
if (reportSettings.SqlParametersCollection != null && reportSettings.SqlParametersCollection.Count > 0) { |
|
|
|
|
SqlParameter rpPar; |
|
|
|
|
OleDbParameter oleDBPar = null; |
|
|
|
@ -267,7 +278,7 @@ namespace SharpReportCore {
@@ -267,7 +278,7 @@ namespace SharpReportCore {
|
|
|
|
|
if (this.dataViewStrategy.AvailableFields.Count > 0) { |
|
|
|
|
foreach (SortColumn col in this.reportSettings.SortColumnCollection) { |
|
|
|
|
string colName = col.ColumnName; |
|
|
|
|
AbstractColumn c = this.dataViewStrategy.AvailableFields.Find (colName); |
|
|
|
|
AbstractColumn c = this.dataViewStrategy.AvailableFields.Find (colName); |
|
|
|
|
if (c == null) { |
|
|
|
|
string str = String.Format (CultureInfo.CurrentCulture, |
|
|
|
|
"<{0}> is not a member of <{1}>",colName,this.reportSettings.ReportName); |
|
|
|
@ -349,7 +360,7 @@ namespace SharpReportCore {
@@ -349,7 +360,7 @@ namespace SharpReportCore {
|
|
|
|
|
return hierarchicalList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region SharpReportCore.IDataContainer interface implementation
|
|
|
|
@ -391,11 +402,9 @@ namespace SharpReportCore {
@@ -391,11 +402,9 @@ namespace SharpReportCore {
|
|
|
|
|
this.dataViewStrategy.Bind(); |
|
|
|
|
this.dataViewStrategy.GroupChanged += new EventHandler <GroupChangedEventArgs>(NotifyGroupChange); |
|
|
|
|
CheckReportColumns(); |
|
|
|
|
// this.NotifyListChanged (this,this.resetList);
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//ToDo Remove this
|
|
|
|
|
public void Skip() { |
|
|
|
|
this.dataViewStrategy.CurrentRow ++; |
|
|
|
|
} |
|
|
|
@ -406,7 +415,7 @@ namespace SharpReportCore {
@@ -406,7 +415,7 @@ namespace SharpReportCore {
|
|
|
|
|
foreach (IItemRenderer item in collection) { |
|
|
|
|
this.dataViewStrategy.Fill(item); |
|
|
|
|
} |
|
|
|
|
} catch (Exception) { |
|
|
|
|
} catch (Exception) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|