Browse Source

Small changes in ReportGenerator and better handling of IDisposable

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1060 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
6991095c10
  1. 52
      src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs
  2. 3
      src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs
  3. 7
      src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs
  4. 24
      src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs
  5. 6
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs
  6. 10
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs
  7. 2
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs
  8. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs
  9. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs
  10. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs
  11. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs
  12. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs
  13. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs
  14. 2
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs
  15. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs
  16. 127
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  17. 1
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs
  18. 60
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs
  19. 17
      src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs
  20. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs
  21. 83
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
  22. 15
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs
  23. 17
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs
  24. 18
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs
  25. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs
  26. 8
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  27. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs
  28. 10
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs
  29. 8
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs
  30. 5
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  31. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs
  32. 21
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
  33. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs
  34. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs
  35. 23
      src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs
  36. 55
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs
  37. 30
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs
  38. 18
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs
  39. 4
      src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs
  40. 5
      src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs
  41. 6
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs
  42. 23
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs
  43. 14
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs

52
src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs

@ -61,7 +61,7 @@ namespace SharpReport {
/// <param name="schemaTable">SchemaDefinition Datatable</param> /// <param name="schemaTable">SchemaDefinition Datatable</param>
/// <returns>Collection of BaseDataItems</returns> /// <returns>Collection of BaseDataItems</returns>
public ReportItemCollection AutoColumnsFromTable (ReportModel model,DataTable schemaTable) { public ReportItemCollection ReportItemsFromTable (ReportModel model,DataTable schemaTable) {
ReportItemCollection itemCol = new ReportItemCollection(); ReportItemCollection itemCol = new ReportItemCollection();
for (int i = 0;i < schemaTable.Rows.Count;i++){ for (int i = 0;i < schemaTable.Rows.Count;i++){
@ -84,7 +84,7 @@ namespace SharpReport {
/// <param name="dataSet">DataSet from *.xsd File</param> /// <param name="dataSet">DataSet from *.xsd File</param>
/// <returns> Collection of BaseDataItems</returns> /// <returns> Collection of BaseDataItems</returns>
public ReportItemCollection AutoColumnsFromSchema (ReportModel model,DataSet dataSet) { public ReportItemCollection ReportItemsFromSchema (ReportModel model,DataSet dataSet) {
if (dataSet.Tables.Count > 1) { if (dataSet.Tables.Count > 1) {
MessageService.ShowError ("AutoBuildFromDataSet : at this time no more than one table is allowed " + dataSet.Tables.Count.ToString()); MessageService.ShowError ("AutoBuildFromDataSet : at this time no more than one table is allowed " + dataSet.Tables.Count.ToString());
throw new ArgumentException ("Too much Tables in DataSet"); throw new ArgumentException ("Too much Tables in DataSet");
@ -126,25 +126,9 @@ namespace SharpReport {
throw new ArgumentNullException ("AutoReport:ReportItemCollection"); throw new ArgumentNullException ("AutoReport:ReportItemCollection");
} }
} }
#endregion
public ReportItemCollection AutoHeaderColumns(ReportItemCollection col) { #region HeaderColumns
if (col != null) {
ReportItemCollection itemCol = new ReportItemCollection();
ReportDataItem oldItem = null;
for (int i = 0;i < col.Count ;i++ ){
ReportTextItem newItem = new ReportTextItem();
oldItem = (ReportDataItem)col[i];
newItem.VisualControl.Text = oldItem.ColumnName;
newItem.Text = oldItem.ColumnName;
newItem.Location = new Point (i * 30,5);
itemCol.Add(newItem);
}
return itemCol;
}else {
throw new ArgumentNullException ("AutoReport:ReportItemCollection");
}
}
/// <summary> /// <summary>
/// Build Headerline from a schemaDataTable /// Build Headerline from a schemaDataTable
/// </summary> /// </summary>
@ -154,7 +138,7 @@ namespace SharpReport {
/// <param name="setOnTop">Locate the Columns of Top or an Bottom of the Section</param> /// <param name="setOnTop">Locate the Columns of Top or an Bottom of the Section</param>
/// <returns>a Collection of BaseTextItems</returns> /// <returns>a Collection of BaseTextItems</returns>
public ReportItemCollection AutoHeaderFromTable (ReportModel model,BaseSection section,DataTable schemaTable,bool setOnTop) { public ReportItemCollection AutoHeaderFromTable (BaseSection section,DataTable schemaTable,bool setOnTop) {
ReportItemCollection itemCol = new ReportItemCollection(); ReportItemCollection itemCol = new ReportItemCollection();
for (int i = 0;i < schemaTable.Rows.Count;i++){ for (int i = 0;i < schemaTable.Rows.Count;i++){
DataRow r = schemaTable.Rows[i]; DataRow r = schemaTable.Rows[i];
@ -176,6 +160,32 @@ namespace SharpReport {
} }
public ReportItemCollection AutoHeaderFromReportItems(ReportItemCollection col,BaseSection section,bool setOnTop) {
if (col != null) {
ReportItemCollection itemCol = new ReportItemCollection();
ReportDataItem sourceItem = null;
for (int i = 0;i < col.Count ;i++ ){
BaseTextItem rItem = (BaseTextItem)iDesignableFactory.Create("ReportTextItem");
if (rItem != null) {
sourceItem = (ReportDataItem)col[i];
rItem.Text = sourceItem.ColumnName;
rItem.Text = sourceItem.ColumnName;
if (setOnTop) {
rItem.Location = new Point (i * 30,1);
} else {
int y = section.Size.Height - rItem.Size.Height - 5;
rItem.Location = new Point (i * 30,y);
}
itemCol.Add(rItem);
}
}
return itemCol;
}else {
throw new ArgumentNullException ("AutoReport:ReportItemCollection");
}
}
#endregion #endregion
} }
} }

3
src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs

@ -41,6 +41,7 @@ namespace SharpReport.Designer{
event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
event SelectedEventHandler Selected; // event EventHandler <GroupChangedEventArgs> GroupChanged;
event EventHandler <EventArgs> Selected;
} }
} }

7
src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs

@ -35,10 +35,11 @@ namespace SharpReport {
public string CreateName (ReportItemCollection collection, public string CreateName (ReportItemCollection collection,
string typeName) { string typeName) {
string name = Char.ToLower(typeName[0],CultureInfo.InvariantCulture) + typeName.Substring(1); string name = Char.ToLower(typeName[0],
CultureInfo.InvariantCulture) + typeName.Substring(1);
int number = 1; int number = 1;
while (collection.Find(name + number.ToString()) != null) { while (collection.Find(name + number.ToString(CultureInfo.InvariantCulture)) != null) {
++number; ++number;
} }
@ -61,7 +62,7 @@ namespace SharpReport {
public void ValidateName(ReportItemCollection collection, public void ValidateName(ReportItemCollection collection,
string name) { string name) {
if (!IsValidName(collection,name)) { if (!IsValidName(collection,name)) {
throw new System.Exception("Invalid name " + name); throw new SharpReportException("Invalid name " + name);
} }
} }
#endregion #endregion

24
src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs

@ -52,8 +52,8 @@ namespace SharpReport.Designer{
[EditorBrowsable(EditorBrowsableState.Always), Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always), Browsable(true)]
public event SelectedEventHandler ObjectSelected;
public event EventHandler <EventArgs> ObjectSelected;
public event EventHandler <SectionChangedEventArgs> SectionChanged; public event EventHandler <SectionChangedEventArgs> SectionChanged;
public event ItemDragDropEventHandler DesignViewChanged; public event ItemDragDropEventHandler DesignViewChanged;
@ -111,18 +111,18 @@ namespace SharpReport.Designer{
sectionCollection.Add(detail); sectionCollection.Add(detail);
sectionCollection.Add(pageFooter); sectionCollection.Add(pageFooter);
sectionCollection.Add(footer); sectionCollection.Add(footer);
header.Selected += new SelectedEventHandler(this.SectionSelected);
pageHeader.Selected += new SelectedEventHandler(this.SectionSelected);
detail.Selected += new SelectedEventHandler(this.SectionSelected);
footer.Selected += new SelectedEventHandler(this.SectionSelected);
pageFooter.Selected += new SelectedEventHandler(this.SectionSelected);
header.ItemSelected += new SelectedEventHandler(this.ItemSelected); header.Selected += new EventHandler <EventArgs>(this.SectionSelected);
pageHeader.ItemSelected += new SelectedEventHandler(this.ItemSelected); pageHeader.Selected += new EventHandler <EventArgs>(this.SectionSelected);
detail.ItemSelected += new SelectedEventHandler(this.ItemSelected); detail.Selected += new EventHandler <EventArgs>(this.SectionSelected);
footer.ItemSelected += new SelectedEventHandler(this.ItemSelected); footer.Selected += new EventHandler <EventArgs>(this.SectionSelected);
pageFooter.ItemSelected += new SelectedEventHandler(this.ItemSelected); pageFooter.Selected += new EventHandler <EventArgs>(this.SectionSelected);
header.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
pageHeader.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
detail.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
footer.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
pageFooter.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
//This events are from DragDropp //This events are from DragDropp
visualReportHeader.ReportItemsHandling += new ItemDragDropEventHandler (OnAddReportItem); visualReportHeader.ReportItemsHandling += new ItemDragDropEventHandler (OnAddReportItem);

6
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs

@ -34,9 +34,9 @@ namespace SharpReport{
const string contextMenuPath = "/SharpReport/ContextMenu/Section"; const string contextMenuPath = "/SharpReport/ContextMenu/Section";
private ReportSectionControlBase visualControl; private ReportSectionControlBase visualControl;
public event SelectedEventHandler ItemSelected;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> ItemSelected;
public event EventHandler <EventArgs> Selected;
#region Constructors #region Constructors
internal ReportSection() : base(){ internal ReportSection() : base(){
@ -247,7 +247,7 @@ namespace SharpReport{
SharpReport.Designer.IDesignable iDesignable = item as SharpReport.Designer.IDesignable; SharpReport.Designer.IDesignable iDesignable = item as SharpReport.Designer.IDesignable;
if (iDesignable != null) { if (iDesignable != null) {
if (this.VisualControl != null) { if (this.VisualControl != null) {
iDesignable.Selected += new SelectedEventHandler(this.ReportItemSelected); iDesignable.Selected += new EventHandler <EventArgs>(this.ReportItemSelected);
this.VisualControl.Body.Controls.Add(iDesignable.VisualControl); this.VisualControl.Body.Controls.Add(iDesignable.VisualControl);
iDesignable.VisualControl.BringToFront(); iDesignable.VisualControl.BringToFront();
iDesignable.VisualControl.Focus(); iDesignable.VisualControl.Focus();

10
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs

@ -36,7 +36,8 @@ namespace SharpReport.Designer{
private int currentY; private int currentY;
public event SelectedEventHandler ItemSelected; public event EventHandler <EventArgs> ItemSelected;
public event ItemDragDropEventHandler ItemDragDrop; public event ItemDragDropEventHandler ItemDragDrop;
public event EventHandler <SectionChangedEventArgs> SectionChanged; public event EventHandler <SectionChangedEventArgs> SectionChanged;
@ -66,13 +67,6 @@ namespace SharpReport.Designer{
private void BodyPanelPaint(object sender, PaintEventArgs e) { private void BodyPanelPaint(object sender, PaintEventArgs e) {
Graphics g = e.Graphics; Graphics g = e.Graphics;
g.Clear(this.Body.BackColor); g.Clear(this.Body.BackColor);
if (dragAllowed) {
// using (Pen p = new Pen (Color.Gray)) {
// p.Width = 5;
// g.DrawRectangle(p,2,2,this.Width - 4, this.Height -4);
// }
}
System.Windows.Forms.ControlPaint.DrawGrid (e.Graphics, System.Windows.Forms.ControlPaint.DrawGrid (e.Graphics,
this.Body.ClientRectangle, this.Body.ClientRectangle,
GlobalValues.GridSize, GlobalValues.GridSize,

2
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs

@ -22,8 +22,6 @@ namespace SharpReport.Designer {
/// created on - 20.12.2004 22:06:09 /// created on - 20.12.2004 22:06:09
/// </remarks> /// </remarks>
public delegate void SelectedEventHandler(object sender, EventArgs e);
public class SectionChangedEventArgs : System.EventArgs { public class SectionChangedEventArgs : System.EventArgs {
ReportSection section; ReportSection section;

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs

@ -159,7 +159,8 @@ namespace SharpReport.ReportItems.Functions {
} }
} }
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs

@ -174,8 +174,9 @@ namespace SharpReport.ReportItems.Functions {
return visualControl; return visualControl;
} }
} }
public event EventHandler <EventArgs> Selected;
public event SelectedEventHandler Selected;
#endregion #endregion
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs

@ -133,7 +133,8 @@ namespace SharpReport.ReportItems{
} }
} }
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs

@ -106,7 +106,8 @@ namespace SharpReport.ReportItems {
} }
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs

@ -137,7 +137,8 @@ namespace SharpReport.ReportItems{
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs

@ -148,7 +148,8 @@ namespace SharpReport.ReportItems{
} }
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }
} }

2
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs

@ -183,7 +183,7 @@ namespace SharpReport.ReportItems{
} }
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }
} }

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs

@ -168,7 +168,8 @@ namespace SharpReport.ReportItems {
} }
public new event PropertyChangedEventHandler PropertyChanged; public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected; public event EventHandler <EventArgs> Selected;
#endregion #endregion
} }
} }

127
src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs

@ -37,7 +37,7 @@ namespace SharpReport{
/// <summary> /// <summary>
/// Description of SharpReportManager. /// Description of SharpReportManager.
/// </summary> /// </summary>
public class SharpReportManager :SharpReportEngine { public class SharpReportManager :SharpReportEngine,IDisposable {
private BaseDesignerControl baseDesignerControl; private BaseDesignerControl baseDesignerControl;
private ReportModel reportModel; private ReportModel reportModel;
@ -145,7 +145,9 @@ namespace SharpReport{
#region Standarts for all reports (Headlines etc) #region Standarts for all reports (Headlines etc)
/// <summary> /// <summary>
/// Create TextItem in PageHeader with Reportmodel.ReportSettings.ReportName /// Insert a <see cref="ReportTextItem"></see> in the PageHeader with
/// the <see cref="ReportModel.ReportSettings.ReportName"></see> as
/// text
/// </summary> /// </summary>
/// <param name="model">ReportModel</param> /// <param name="model">ReportModel</param>
public void CreatePageHeader (ReportModel model) { public void CreatePageHeader (ReportModel model) {
@ -181,34 +183,24 @@ namespace SharpReport{
pageNumber.ResumeLayout(); pageNumber.ResumeLayout();
section.ResumeLayout(); section.ResumeLayout();
} }
public void AdjustNames (ReportModel model) {
NameService nameService = new NameService();
foreach (BaseSection section in model.SectionCollection) {
foreach (IItemRenderer item in section.Items) {
item.Name = nameService.CreateName(section.Items,item.Name);
}
}
}
#endregion #endregion
#region Create report from Query #region HeaderColumns
/// <summary> /// <summary>
/// Builds ColumHeaders for report, we take the ColumnNames as Text Property /// Builds ColumHeaders for Reports, we take the ColumnNames as Text Property
/// </summary> /// </summary>
/// <param name="model">A valid(filled) reportModel</param> /// <param name="model">A valid(filled) reportModel</param>
/// <param name="section">The Section to use for headerLines</param> /// <param name="section">The Section to use for headerLines</param>
/// <param name="schemaTable">SchemaTable witch contains the Column Informations</param> /// <param name="schemaTable">SchemaTable witch contains the Column Informations</param>
public void CreateColumnHeadersFromTable (ReportModel model,BaseSection section,DataTable schemaTable) { public void HeaderColumnsFromTable (BaseSection section,DataTable schemaTable) {
if (section == null) { if (section == null) {
throw new ArgumentException("SharpReportManager:CreateColumnHeadersFromTable <section>"); throw new ArgumentException("SharpReportManager:CreateColumnHeadersFromTable <section>");
} }
using (AutoReport auto = new AutoReport()){ using (AutoReport auto = new AutoReport()){
try { try {
ReportItemCollection headerCol = auto.AutoHeaderFromTable (model,section,schemaTable,false); ReportItemCollection headerCol = auto.AutoHeaderFromTable (section,schemaTable,false);
AddItemsToSection (section,headerCol); AddItemsToSection (section,headerCol);
} catch (Exception) { } catch (Exception) {
throw; throw;
@ -216,6 +208,31 @@ namespace SharpReport{
} }
} }
///<summary>
/// Create ColumHeaders for Reports
/// </summary>
/// <param name="section">A ReportSection whre to build the Hedarlines</param>
///<param name="collection">A <see cref="ReportitemCollection"></see>
/// containing the basic informations</param>
public void HeaderColumnsFromReportItems (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoHeaderFromReportItems (collection,section,false);
section.SuspendLayout();
AddItemsToSection (section,colDetail);
section.ResumeLayout();
} catch(Exception) {
throw;
}
}
}
#endregion
#region Create report from Query
/// <summary> /// <summary>
/// Create Columns from SchemaTable /// Create Columns from SchemaTable
/// </summary> /// </summary>
@ -223,14 +240,14 @@ namespace SharpReport{
///<param name="schemaTable">DataTable witch contaisn SchemaDefinitions</param> ///<param name="schemaTable">DataTable witch contaisn SchemaDefinitions</param>
/// ///
public void CreateColumnsFromTable (ReportModel model,DataTable schemaTable) { public void DataColumnsFromTable (ReportModel model,DataTable schemaTable) {
if ((model == null)||(schemaTable.Rows.Count == 0) ) { if ((model == null)||(schemaTable.Rows.Count == 0) ) {
throw new ArgumentException ("Invalid Arguments in SharpReportmanager:CreateColumnsFromFile"); throw new ArgumentException ("Invalid Arguments in SharpReportmanager:CreateColumnsFromFile");
} }
using (AutoReport auto = new AutoReport()){ using (AutoReport auto = new AutoReport()){
try { try {
ReportItemCollection colDetail = auto.AutoColumnsFromTable (model, ReportItemCollection colDetail = auto.ReportItemsFromTable (model,
schemaTable); schemaTable);
BaseSection section = model.DetailSection; BaseSection section = model.DetailSection;
section.SuspendLayout(); section.SuspendLayout();
@ -244,49 +261,8 @@ namespace SharpReport{
#endregion #endregion
#region Create Reports from .Xsd Files #region Create Reports from .Xsd Files
/*
/// <summary>
/// create Header from an .Xsd File
/// </summary>
/// <param name="model">a valid ReportModel</param>
/// <param name="section">Section in witch the header should be created</param>
/// <param name="fileName">File/Path to .Xsd file</param>
public void a_CreateColumnHeadersFromXsd (ReportModel model,BaseSection section,string fileName){
Debug.Assert (fileName.Length > 0,"CreateColumnsHeadersFromScheman : No valid FileName");
try {
DataSet ds = new DataSet();
ds.ReadXml (fileName);
using (AutoReport auto = new AutoReport()){
try {
// ReportItemCollection colDetail = auto.AutoHeaderFromSchema (model,section,ds,false);
// AddItemsToSection (section,colDetail);
} catch (Exception) {
throw;
}
}
} catch (Exception) {
throw;
}
}
*/
///<summary>
/// Create the ReportHeader
/// </summary>
/// <param name="section">A ReportSection whre to build the Hedarlines</param>
///<param name="collection">A reportItemcollection containing the basic informations</param>
public void CreateHeaderColumns (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoHeaderColumns (collection);
section.SuspendLayout();
AddItemsToSection (section,colDetail);
section.ResumeLayout();
} catch(Exception) {
throw;
}
}
}
///<summary> ///<summary>
/// Create the DataColumns /// Create the DataColumns
/// </summary> /// </summary>
@ -294,7 +270,7 @@ namespace SharpReport{
/// <see cref="ReportDataItem"></see> /// <see cref="ReportDataItem"></see>
/// DataItems</param> /// DataItems</param>
///<param name="collection">A reportItemcollection containing the basic informations</param> ///<param name="collection">A reportItemcollection containing the basic informations</param>
public void CreateDataColumns (BaseSection section,ReportItemCollection collection) { public void DataColumnsFromReportItems (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){ using (AutoReport auto = new AutoReport()){
try { try {
ReportItemCollection colDetail = auto.AutoDataColumns (collection); ReportItemCollection colDetail = auto.AutoDataColumns (collection);
@ -488,6 +464,35 @@ namespace SharpReport{
} }
#endregion #endregion
#region IDisposable
public new void Dispose(){
this.Dispose(true);
GC.SuppressFinalize(this);
}
~SharpReportManager(){
Dispose(false);
}
protected new void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.baseDesignerControl != null) {
this.baseDesignerControl.Dispose();
}
if (this.reportModel != null) {
this.reportModel.Dispose();
}
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
base.Dispose();
}
#endregion
} }
} }

1
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs

@ -553,7 +553,6 @@ namespace SharpReportAddin {
public FieldsExplorer() { public FieldsExplorer() {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange; WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange;
LabelEdit = true; LabelEdit = true;

60
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -32,7 +32,7 @@ namespace SharpReportAddin{
/// <summary> /// <summary>
/// Description of the view content /// Description of the view content
/// </summary> /// </summary>
public class SharpReportView : AbstractViewContent,IPrintable public class SharpReportView : AbstractViewContent,IPrintable,IDisposable
{ {
private SharpReportManager reportManager = null; private SharpReportManager reportManager = null;
@ -57,6 +57,11 @@ namespace SharpReportAddin{
BuildToolBarItems(); BuildToolBarItems();
PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings;
PropertyPad.Grid.Refresh(); PropertyPad.Grid.Refresh();
//Activate the FieldsExplorer - Pad
PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FieldsExplorer));
if (pad != null) {
pad.CreatePad();
}
} catch (Exception e) { } catch (Exception e) {
MessageService.ShowError(e,e.Message); MessageService.ShowError(e,e.Message);
throw e; throw e;
@ -83,7 +88,6 @@ namespace SharpReportAddin{
} }
} }
#endregion #endregion
@ -189,7 +193,7 @@ namespace SharpReportAddin{
ctrl.ReportControl.AutoScroll = true; ctrl.ReportControl.AutoScroll = true;
ctrl.Dock = DockStyle.Fill; ctrl.Dock = DockStyle.Fill;
ctrl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected); ctrl.ReportControl.ObjectSelected +=new EventHandler <EventArgs>(OnObjectSelected);
ctrl.ReportControl.DesignViewChanged += new ItemDragDropEventHandler (OnItemDragDrop); ctrl.ReportControl.DesignViewChanged += new ItemDragDropEventHandler (OnItemDragDrop);
ctrl.DesignerDirty += new System.ComponentModel.PropertyChangedEventHandler (OnPropertyChanged); ctrl.DesignerDirty += new System.ComponentModel.PropertyChangedEventHandler (OnPropertyChanged);
@ -495,12 +499,12 @@ namespace SharpReportAddin{
/// <param name="fileName">A valid Filename</param> /// <param name="fileName">A valid Filename</param>
public override void Load(string fileName){ public override void Load(string fileName){
try { try {
designerControl.ReportControl.ObjectSelected -= new SelectedEventHandler (OnObjectSelected); designerControl.ReportControl.ObjectSelected -= new EventHandler <EventArgs>(OnObjectSelected);
reportManager.LoadFromFile (fileName); reportManager.LoadFromFile (fileName);
base.FileName = fileName; base.FileName = fileName;
designerControl.ReportModel.ReportSettings.FileName = fileName; designerControl.ReportModel.ReportSettings.FileName = fileName;
designerControl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected); designerControl.ReportControl.ObjectSelected += new EventHandler <EventArgs>(OnObjectSelected);
PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings;
PropertyPad.Grid.Refresh(); PropertyPad.Grid.Refresh();
this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection; this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection;
@ -511,20 +515,7 @@ namespace SharpReportAddin{
} }
} }
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose(){
try {
PropertyPad.Grid.SelectedObject = null;
RemoveSideBarItem();
this.designerControl.Dispose();
this.reportManager = null;
} catch (Exception e){
MessageService.ShowError(e.Message);
return;
}
}
#endregion #endregion
@ -546,7 +537,38 @@ namespace SharpReportAddin{
#endregion #endregion
#region IDisposable
public override void Dispose(){
PropertyPad.Grid.SelectedObject = null;
RemoveSideBarItem();
this.Dispose(true);
GC.SuppressFinalize(this);
}
~SharpReportView(){
Dispose(false);
}
protected void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.reportManager != null) {
this.reportManager.Dispose();
}
if (this.designerControl != null) {
this.designerControl.Dispose();
}
this.tabControl.Dispose();
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
base.Dispose();
}
#endregion
} }
} }

17
src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs

@ -77,7 +77,8 @@ namespace SharpReportCore{
public IItemRenderer Find (string itemName) { public IItemRenderer Find (string itemName) {
for (int i = 0;i < this.Count ; i ++) { for (int i = 0;i < this.Count ; i ++) {
IItemRenderer col = this[i]; IItemRenderer col = this[i];
if (String.Compare(col.Name,itemName)== 0){ if (String.Compare(col.Name.ToLower(CultureInfo.CurrentCulture),
itemName.ToLower(CultureInfo.CurrentCulture))== 0){
return col; return col;
} }
} }
@ -129,7 +130,6 @@ namespace SharpReportCore{
return col; return col;
} }
} }
return null; return null;
} }
@ -143,7 +143,6 @@ namespace SharpReportCore{
public ColumnCollection(){ public ColumnCollection(){
culture = CultureInfo.CurrentCulture; culture = CultureInfo.CurrentCulture;
} }
@ -165,12 +164,12 @@ namespace SharpReportCore{
public CultureInfo Culture public CultureInfo Culture
{ {
get { return culture; } get { return culture; }
set // set
{ // {
if (value == null) // if (value == null)
value = CultureInfo.CurrentCulture; // value = CultureInfo.CurrentCulture;
culture = value; // culture = value;
} // }
} }
} }

4
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs

@ -25,14 +25,12 @@ namespace SharpReportCore {
public class GroupSeperator : SharpReportCore.GroupComparer,IHierarchyData { public class GroupSeperator : SharpReportCore.GroupComparer,IHierarchyData {
private string typeName = "GroupSeperator"; private string typeName = "GroupSeperator";
int groupLevel = 0; int groupLevel;
// GroupSeperator parent = null;
IHierarchicalArray childs ; IHierarchicalArray childs ;
public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel): public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel):
base(owner,listIndex,values) { base(owner,listIndex,values) {
this.groupLevel = groupLevel; this.groupLevel = groupLevel;
// this.parent = parent;
} }

83
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs

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

15
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs

@ -19,9 +19,9 @@ namespace SharpReportCore
bool allowNew = true; bool allowNew = true;
bool allowEdit = true; bool allowEdit = true;
bool allowRemove = true; bool allowRemove = true;
bool supportsSearching = false; bool supportsSearching ;
bool supportsSorting = false; bool supportsSorting ;
bool isSorted = false; bool isSorted;
private ListChangedEventArgs resetEvent = new ListChangedEventArgs(ListChangedType.Reset, -1); private ListChangedEventArgs resetEvent = new ListChangedEventArgs(ListChangedType.Reset, -1);
@ -160,18 +160,27 @@ namespace SharpReportCore
get { get {
return this.supportsSearching; return this.supportsSearching;
} }
set {
this.supportsSearching = value;
}
} }
public bool SupportsSorting { public bool SupportsSorting {
get { get {
return this.supportsSorting; return this.supportsSorting;
} }
set {
this.supportsSorting = value;
}
} }
public bool IsSorted { public bool IsSorted {
get { get {
return this.isSorted; return this.isSorted;
} }
set {
this.isSorted = value;
}
} }
public System.ComponentModel.PropertyDescriptor SortProperty { public System.ComponentModel.PropertyDescriptor SortProperty {

17
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs

@ -12,6 +12,7 @@ using System;
using System.Globalization; using System.Globalization;
using System.ComponentModel; using System.ComponentModel;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using SharpReportCore; using SharpReportCore;
/// <summary> /// <summary>
@ -36,14 +37,14 @@ namespace SharpReportCore {
private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1);
public event ListChangedEventHandler ListChanged; public event EventHandler <ListChangedEventArgs> ListChanged;
public event EventHandler <GroupChangedEventArgs> GroupChanged; public event EventHandler <GroupChangedEventArgs> GroupChanged;
#region Constructor #region Constructor
protected BaseListStrategy(ReportSettings reportSettings) { protected BaseListStrategy(ReportSettings reportSettings) {
this.reportSettings = reportSettings; this.reportSettings = reportSettings;
this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList"); this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList");
} }
#endregion #endregion
@ -65,15 +66,14 @@ namespace SharpReportCore {
#endregion #endregion
protected SharpArrayList IndexList {
public SharpArrayList IndexList {
get { get {
return indexList; return indexList;
} }
set {
indexList = value;
}
} }
public ReportSettings ReportSettings { public ReportSettings ReportSettings {
get { get {
return reportSettings; return reportSettings;
@ -173,6 +173,7 @@ namespace SharpReportCore {
} }
protected virtual void Group() { protected virtual void Group() {
if (this.indexList != null) { if (this.indexList != null) {
this.BuildHierarchicalList (this.indexList); this.BuildHierarchicalList (this.indexList);
this.isGrouped = true; this.isGrouped = true;
@ -180,6 +181,7 @@ namespace SharpReportCore {
} else { } else {
throw new SharpReportException ("BaseListStrategy:Group Sorry, no IndexList"); throw new SharpReportException ("BaseListStrategy:Group Sorry, no IndexList");
} }
} }
@ -296,9 +298,10 @@ namespace SharpReportCore {
} }
public virtual void Fill(IItemRenderer item) { public virtual void Fill(IItemRenderer item) {
} }
#endregion #endregion
} }
} }

18
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs

@ -212,19 +212,22 @@ namespace SharpReportCore {
if (base.ReportSettings.GroupColumnsCollection != null) { if (base.ReportSettings.GroupColumnsCollection != null) {
if (base.ReportSettings.GroupColumnsCollection.Count > 0) { if (base.ReportSettings.GroupColumnsCollection.Count > 0) {
groupedArray = this.BuildGroupIndex (base.ReportSettings.GroupColumnsCollection); groupedArray = this.BuildGroupIndex (base.ReportSettings.GroupColumnsCollection);
System.Console.WriteLine("\t1");
} else { } else {
groupedArray = BuildPlainIndex (base.ReportSettings.GroupColumnsCollection); groupedArray = BuildPlainIndex (base.ReportSettings.GroupColumnsCollection);
} }
} }
base.IndexList.Clear(); base.IndexList.Clear();
base.IndexList.AddRange (InsertGroupRows(groupedArray)); base.IndexList.AddRange (InsertGroupRows(groupedArray));
if (base.IndexList == null){ if (base.IndexList == null){
throw new NotSupportedException("Sortieren für die Liste nicht unterstützt."); throw new NotSupportedException("Sortieren für die Liste nicht unterstützt.");
} }
} catch (Exception) {
} catch (Exception e) {
System.Console.WriteLine("BuildGroup {0}",e.Message);
throw; throw;
} }
} }
@ -236,13 +239,14 @@ namespace SharpReportCore {
} }
try { try {
this.BuildGroup(); this.BuildGroup();
base.Group(); base.Group();
if (this.IsGrouped == false) { if (this.IsGrouped == false) {
throw new SharpReportException("TableStratregy:Group Error in grouping"); throw new SharpReportException("TableStratregy:Group Error in grouping");
} }
} catch (Exception) {
} catch (Exception e) {
System.Console.WriteLine("Group {0}",e.Message);
base.IsGrouped = false; base.IsGrouped = false;
base.IsSorted = false; base.IsSorted = false;
throw; throw;

4
src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs

@ -78,8 +78,8 @@ namespace SharpReportCore{
bool IsGrouped { bool IsGrouped {
get; get;
} }
event ListChangedEventHandler ListChanged; // event ListChangedEventHandler ListChanged;
event EventHandler <ListChangedEventArgs> ListChanged;
/// <summary> /// <summary>
/// Fired each tim the grouping will change, this means theGroupLevel changes up or down /// Fired each tim the grouping will change, this means theGroupLevel changes up or down
/// </summary> /// </summary>

8
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs

@ -166,10 +166,10 @@ namespace SharpReportCore {
} }
protected int RenderSection (BaseSection section,ReportPageEventArgs e) { protected int RenderSection (BaseSection section,ReportPageEventArgs rpea) {
Point drawPoint = new Point(0,0); Point drawPoint = new Point(0,0);
if (section.Visible){ if (section.Visible){
section.Render (e); section.Render (rpea);
foreach (BaseReportItem rItem in section.Items) { foreach (BaseReportItem rItem in section.Items) {
rItem.SuspendLayout(); rItem.SuspendLayout();
@ -185,10 +185,10 @@ namespace SharpReportCore {
rItem.FormatOutput -= new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem); rItem.FormatOutput -= new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem);
rItem.FormatOutput += new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem); rItem.FormatOutput += new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem);
rItem.Render(e); rItem.Render(rpea);
drawPoint.Y = section.SectionOffset + section.Size.Height; drawPoint.Y = section.SectionOffset + section.Size.Height;
e.LocationAfterDraw = new PointF (e.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
rItem.ResumeLayout(); rItem.ResumeLayout();
} }
if ((section.CanGrow == false)&& (section.CanShrink == false)) { if ((section.CanGrow == false)&& (section.CanShrink == false)) {

3
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs

@ -43,6 +43,9 @@ namespace SharpReportCore{
///<param name="item">A ReportDataItem</param> ///<param name="item">A ReportDataItem</param>
/// ///
public string FormatItem (BaseDataItem item) { public string FormatItem (BaseDataItem item) {
if (item == null) {
throw new ArgumentNullException("item");
}
string retValue = String.Empty; string retValue = String.Empty;
switch (item.DataType) { switch (item.DataType) {

10
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs

@ -38,25 +38,25 @@ namespace SharpReportCore {
} }
public virtual void DrawShape (Graphics g,BaseLine baseLine,RectangleF rectangle) { public virtual void DrawShape (Graphics graphics,BaseLine baseLine,RectangleF rectangle) {
} }
public virtual void DrawShape (Graphics g,Pen pen,RectangleF rectangle) { public virtual void DrawShape (Graphics graphics,Pen pen,RectangleF rectangle) {
} }
public virtual void FillShape (Graphics g, Brush brush,RectangleF rectangle) { public virtual void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) {
} }
public virtual void FillShape (Graphics g,AbstractFillPattern fillPattern,RectangleF rectangle) { public virtual void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) {
} }
public virtual GraphicsPath CreatePath (RectangleF rectangle) { public virtual GraphicsPath CreatePath (RectangleF rectangleF) {
return null; return null;
} }
} }

8
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs

@ -43,20 +43,20 @@ namespace SharpReportCore {
this.baseLine = baseLine; this.baseLine = baseLine;
} }
public void DrawBorder (Graphics g, RectangleF rectangle) { public void DrawBorder (Graphics graphics, RectangleF rectangle) {
using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) {
p.DashStyle = baseLine.DashStyle; p.DashStyle = baseLine.DashStyle;
g.DrawRectangle (p,rectangle.Left, graphics.DrawRectangle (p,rectangle.Left,
rectangle.Top, rectangle.Top,
rectangle.Width, rectangle.Width,
rectangle.Height); rectangle.Height);
} }
} }
public void DrawBorder (Graphics g, Rectangle rectangle ) { public void DrawBorder (Graphics graphics, Rectangle rectangle ) {
using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) {
p.DashStyle = baseLine.DashStyle; p.DashStyle = baseLine.DashStyle;
g.DrawRectangle (p,rectangle); graphics.DrawRectangle (p,rectangle);
} }
} }
} }

5
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs

@ -105,7 +105,6 @@ namespace SharpReportCore {
section.Size.Height); section.Size.Height);
DebugRectangle (e,detailRect); DebugRectangle (e,detailRect);
float offset = 0F;
// no loop if there is no data // no loop if there is no data
if (! dataManager.HasMoreData ) { if (! dataManager.HasMoreData ) {
e.PrintPageEventArgs.HasMorePages = false; e.PrintPageEventArgs.HasMorePages = false;
@ -120,8 +119,8 @@ namespace SharpReportCore {
if (dataManager.HasMoreData) { if (dataManager.HasMoreData) {
dataManager.FetchData (base.CurrentSection.Items); dataManager.FetchData (base.CurrentSection.Items);
offset = base.RenderSection (section,e); // offset = base.RenderSection (section,e);
base.RenderSection (section,e);
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap; section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap;
base.FitSectionToItems (base.CurrentSection,e); base.FitSectionToItems (base.CurrentSection,e);

4
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs

@ -38,8 +38,8 @@ namespace SharpReportCore {
} }
public void DrawString(Graphics g,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) { public void DrawString(Graphics graphics,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) {
g.DrawString(text, graphics.DrawString(text,
font, font,
brush, brush,
rectangle, rectangle,

21
src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs

@ -126,9 +126,26 @@ namespace SharpReportCore {
#region IDispoable #region IDispoable
public void Dispose(){ public void Dispose(){
if (this.reportSettings != null) { this.Dispose(true);
this.reportSettings.Dispose(); GC.SuppressFinalize(this);
}
~ReportModel()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.reportSettings != null) {
this.reportSettings.Dispose();
this.reportSettings = null;
}
} }
// Free your own state (unmanaged objects).
// Set large fields to null.
} }
#endregion #endregion
} }

40
src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs

@ -650,32 +650,32 @@ namespace SharpReportCore{
} }
} }
} }
/*
[Browsable(true), Category("Output Settings")]
public System.Drawing.Printing.Margins DefaultMargins {
get {
return defaultMargins;
}
set {
if (defaultMargins != value) {
defaultMargins = value;
PageSettings.Margins = defaultMargins;
this.FirePropertyChanged();
}
}
}
*/
#endregion #endregion
#region IDisposable #region IDisposable
public void Dispose(){ public void Dispose(){
if (this.defaultFont != null) { this.Dispose(true);
this.defaultFont.Dispose(); GC.SuppressFinalize(this);
} }
~ReportSettings()
{
Dispose(false);
} }
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.defaultFont != null) {
this.defaultFont.Dispose();
}
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
}
#endregion #endregion
} }

40
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

@ -57,7 +57,7 @@ namespace SharpReportCore {
private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) { private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) {
if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) { if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) {
if (this.connectionObject == null) { if (this.connectionObject == null) {
if (model.ReportSettings.ConnectionString != "") { if (model.ReportSettings.ConnectionString != "") {
this.connectionObject = new ConnectionObject (model.ReportSettings.ConnectionString,"",""); this.connectionObject = new ConnectionObject (model.ReportSettings.ConnectionString,"","");
} }
@ -91,7 +91,7 @@ namespace SharpReportCore {
} }
void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) { void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) {
if ((sqlParams == null)||(sqlParams.Count == 0)) { if ((sqlParams == null)||(sqlParams.Count == 0)) {
return; return;
@ -100,6 +100,8 @@ namespace SharpReportCore {
model.ReportSettings.SqlParametersCollection.AddRange(sqlParams); model.ReportSettings.SqlParametersCollection.AddRange(sqlParams);
} }
private static void SetCustomSorting (ReportModel model,ColumnCollection sortParams) { private static void SetCustomSorting (ReportModel model,ColumnCollection sortParams) {
if ((sortParams == null)||(sortParams.Count == 0)) { if ((sortParams == null)||(sortParams.Count == 0)) {
return; return;
@ -130,10 +132,7 @@ namespace SharpReportCore {
} }
private DataManager SetupDataContainer (ReportSettings settings) { private DataManager SetupDataContainer (ReportSettings settings) {
System.Console.WriteLine("SetupContainer");
System.Console.WriteLine("after check");
if (settings.ReportType == GlobalEnums.enmReportType.DataReport) { if (settings.ReportType == GlobalEnums.enmReportType.DataReport) {
if (settings.CommandText != null) { if (settings.CommandText != null) {
try { try {
@ -143,7 +142,6 @@ namespace SharpReportCore {
DataManager container = new DataManager(this.connectionObject, DataManager container = new DataManager(this.connectionObject,
settings); settings);
System.Console.WriteLine("\t No of Records to print {0}",container.Count);
if (container.DataBind() == true) { if (container.DataBind() == true) {
return container; return container;
} else { } else {
@ -239,7 +237,7 @@ namespace SharpReportCore {
AbstractRenderer abstr = null; AbstractRenderer abstr = null;
DataManager dataManager = new DataManager (dataTable,model.ReportSettings); DataManager dataManager = new DataManager (dataTable,model.ReportSettings);
System.Console.WriteLine("\tDataManager ok = {0}",(dataManager != null));
if (dataManager != null) { if (dataManager != null) {
dataManager.DataBind(); dataManager.DataBind();
if (dataManager.DataSource != null) { if (dataManager.DataSource != null) {
@ -541,14 +539,32 @@ namespace SharpReportCore {
} }
#endregion #endregion
#region IDisposable #region IDisposable
public void Dispose(){ public void Dispose(){
if (this.connectionObject == null) { this.Dispose(true);
this.connectionObject.Dispose(); GC.SuppressFinalize(this);
} }
if (this.previewControl != null) {
this.previewControl.Dispose(); ~SharpReportEngine(){
Dispose(false);
}
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.connectionObject != null) {
this.connectionObject.Dispose();
}
if (this.previewControl != null) {
this.previewControl.Dispose();
}
} }
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
} }
#endregion #endregion
} }

23
src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs

@ -62,9 +62,10 @@ namespace ReportGenerator{
try { try {
gen.FillReportModel (reportModel); gen.FillReportModel (reportModel);
DoCreate(reportModel); DoCreate(reportModel);
} catch (Exception e) { } catch (Exception) {
MessageService.ShowError (e,e.Message); // MessageService.ShowError (e,e.Message);
return; // return;
throw;
} }
} else { } else {
throw new SharpReportException("Chancel"); throw new SharpReportException("Chancel");
@ -107,8 +108,8 @@ namespace ReportGenerator{
} else { } else {
throw new NullReferenceException ("GeneratePullDataReport"); throw new NullReferenceException ("GeneratePullDataReport");
} }
} catch (Exception e) { } catch (Exception) {
throw e; throw;
} }
} }
@ -125,22 +126,22 @@ namespace ReportGenerator{
} else { } else {
throw new NullReferenceException ("GeneratePullDataReport"); throw new NullReferenceException ("GeneratePullDataReport");
} }
} catch (Exception e) { } catch (Exception) {
throw e; throw;
} }
} }
void GenerateFormSheet (ReportModel model) { private static void GenerateFormSheet (ReportModel model) {
if (model.ReportSettings.DataModel != GlobalEnums.enmPushPullModel.FormSheet) { if (model.ReportSettings.DataModel != GlobalEnums.enmPushPullModel.FormSheet) {
throw new ArgumentException ("Wrong DataModel in GenerateFormSheet"); throw new ArgumentNullException ("model");
} }
try { try {
model.ReportSettings.ReportType = GlobalEnums.enmReportType.FormSheet; model.ReportSettings.ReportType = GlobalEnums.enmReportType.FormSheet;
} catch (Exception e) { } catch (Exception) {
throw e; throw;
} }
} }
} }

55
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs

@ -12,7 +12,7 @@ using System;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Data.OleDb; using System.Data.OleDb;
using System.Windows.Forms; using System.Globalization;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -53,15 +53,33 @@ namespace ReportGenerator {
#region ReportGenerator.IReportGenerator interface implementation #region ReportGenerator.IReportGenerator interface implementation
public virtual void GenerateReport() { public virtual void GenerateReport() {
throw new NotImplementedException("must be overriden"); if (this.reportModel == null) {
throw new NullReferenceException("ReportModel");
}
BuildStandartSections();
manager.CreatePageHeader (reportModel);
manager.CreatePageNumber(reportModel);
} }
#endregion #endregion
/*
protected ColumnCollection AvailableColumnsFromTable (DataTable table) {
//TODO Change these function to using SharpQuery if (table == null) {
protected DataTable GenerateFieldsTable(ReportModel reportModel) { throw new ArgumentNullException("table");
}
ColumnCollection collection = new ColumnCollection();
AbstractColumn abstr;
foreach (DataRow row in table.Rows) {
abstr = new AbstractColumn();
abstr.ColumnName = Convert.ToString(row["ColumnName"],CultureInfo.InvariantCulture);
collection.Add (abstr);
}
return collection;
}
*/
protected DataTable GenerateFieldsTable(ReportModel reportModel) {
if (reportModel == null) { if (reportModel == null) {
throw new ArgumentNullException("reportModel"); throw new ArgumentNullException("reportModel");
} }
@ -71,7 +89,7 @@ namespace ReportGenerator {
OleDbConnection connection = null; OleDbConnection connection = null;
OleDbCommand command = null; OleDbCommand command = null;
try { try {
connection = new OleDbConnection(reportModel.ReportSettings.ConnectionString); connection = new OleDbConnection(reportModel.ReportSettings.ConnectionString);
connection.Open(); connection.Open();
@ -91,7 +109,7 @@ namespace ReportGenerator {
SqlParameter rpPar; SqlParameter rpPar;
for (int i = 0;i < rpc ;i++) { for (int i = 0;i < rpc ;i++) {
rpPar = (SqlParameter)reportModel.ReportSettings.SqlParametersCollection[i]; rpPar = (SqlParameter)reportModel.ReportSettings.SqlParametersCollection[i];
System.Console.WriteLine("{0} {1} {2}",rpPar.ParameterName,rpPar.DataType,rpPar.DefaultValue); // System.Console.WriteLine("{0} {1} {2}",rpPar.ParameterName,rpPar.DataType,rpPar.DefaultValue);
if (rpPar.DataType != System.Data.DbType.Binary) { if (rpPar.DataType != System.Data.DbType.Binary) {
@ -99,7 +117,7 @@ namespace ReportGenerator {
rpPar.DataType); rpPar.DataType);
oleDBPar.Value = rpPar.DefaultValue; oleDBPar.Value = rpPar.DefaultValue;
} else { } else {
System.Console.WriteLine("binary"); // System.Console.WriteLine("binary");
oleDBPar = new OleDbParameter(rpPar.ParameterName, oleDBPar = new OleDbParameter(rpPar.ParameterName,
System.Data.DbType.Binary); System.Data.DbType.Binary);
} }
@ -108,8 +126,8 @@ namespace ReportGenerator {
} }
} }
} catch (Exception e) { } catch (Exception) {
throw e; throw;
} }
OleDbDataReader reader = null; OleDbDataReader reader = null;
DataTable schemaTable = null; DataTable schemaTable = null;
@ -141,6 +159,19 @@ namespace ReportGenerator {
} }
} }
protected void AdjustAll () {
AdjustNames(reportModel);
}
private static void AdjustNames (ReportModel model) {
NameService nameService = new NameService();
foreach (BaseSection section in model.SectionCollection) {
foreach (IItemRenderer item in section.Items) {
item.Name = nameService.CreateName(section.Items,item.Name);
}
}
}
#region Properties #region Properties
public Properties Customizer { public Properties Customizer {

30
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs

@ -7,14 +7,11 @@
// the code is regenerated. // the code is regenerated.
// </autogenerated> // </autogenerated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System;
using System.Data;
using ICSharpCode.Core;
using System; using SharpReportCore;
using System.Data;
using ICSharpCode.Core;
using SharpReportCore;
/// <summary> /// <summary>
/// This class is used to AutoGenerate a (PullData) Report /// This class is used to AutoGenerate a (PullData) Report
/// (Reports, that grap the Data by themselve) /// (Reports, that grap the Data by themselve)
@ -23,7 +20,8 @@
/// created by - Forstmeier Peter /// created by - Forstmeier Peter
/// created on - 07.09.2005 13:23:14 /// created on - 07.09.2005 13:23:14
/// </remarks> /// </remarks>
using System.Windows.Forms;
namespace ReportGenerator { namespace ReportGenerator {
public class GeneratePullDataReport : AbstractReportGenerator { public class GeneratePullDataReport : AbstractReportGenerator {
@ -57,22 +55,18 @@ namespace ReportGenerator {
// just run // just run
tableFields = base.GenerateFieldsTable (base.ReportModel); tableFields = base.GenerateFieldsTable (base.ReportModel);
} }
base.GenerateReport();
BuildStandartSections(); base.Manager.HeaderColumnsFromTable(base.ReportModel.PageHeader,
base.Manager.CreatePageHeader (base.ReportModel);
base.Manager.CreateColumnHeadersFromTable(base.ReportModel,
base.ReportModel.PageHeader,
tableFields); tableFields);
base.Manager.CreateColumnsFromTable (base.ReportModel, base.Manager.DataColumnsFromTable (base.ReportModel,
tableFields); tableFields);
base.Manager.CreatePageNumber(base.ReportModel);
using (TableLayout layout = new TableLayout(base.ReportModel)){ using (TableLayout layout = new TableLayout(base.ReportModel)){
layout.BuildLayout(); layout.BuildLayout();
} }
base.Manager.AdjustNames(base.ReportModel); base.AdjustAll();
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
} }

18
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs

@ -14,7 +14,7 @@ using System.Data;
using ICSharpCode.Core; using ICSharpCode.Core;
using SharpReportCore; using SharpReportCore;
using System.Windows.Forms;
/// <summary> /// <summary>
/// This class is used to generate PushDataReports /// This class is used to generate PushDataReports
/// (Reports, that are feed with an DataSet etc) /// (Reports, that are feed with an DataSet etc)
@ -41,17 +41,21 @@ namespace ReportGenerator {
public override void GenerateReport() { public override void GenerateReport() {
base.ReportModel.ReportSettings.ReportType = GlobalEnums.enmReportType.DataReport; base.ReportModel.ReportSettings.ReportType = GlobalEnums.enmReportType.DataReport;
BuildStandartSections();
base.Manager.CreatePageHeader (base.ReportModel);
ReportItemCollection col = (ReportItemCollection)base.Customizer.Get ("ReportItemCollection"); ReportItemCollection col = (ReportItemCollection)base.Customizer.Get ("ReportItemCollection");
// MessageBox.Show (col.Count.ToString());
base.GenerateReport();
base.Manager.HeaderColumnsFromReportItems (base.ReportModel.PageHeader,col);
base.Manager.DataColumnsFromReportItems (base.ReportModel.DetailSection,col);
base.Manager.CreateHeaderColumns (base.ReportModel.PageHeader,col);
base.Manager.CreateDataColumns (base.ReportModel.DetailSection,col);
base.Manager.CreatePageNumber(base.ReportModel);
using (TableLayout layout = new TableLayout(base.ReportModel)){ using (TableLayout layout = new TableLayout(base.ReportModel)){
layout.BuildLayout(); layout.BuildLayout();
} }
base.Manager.AdjustNames(base.ReportModel); base.AdjustAll();
} }
} }
} }

4
src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs

@ -59,7 +59,9 @@ namespace ReportGenerator {
} }
public ReportModel FillReportModel (ReportModel model) { public ReportModel FillReportModel (ReportModel model) {
if (model == null) {
throw new ArgumentNullException("model");
}
model.ReportSettings.ReportName = this.reportName; model.ReportSettings.ReportName = this.reportName;
model.ReportSettings.FileName = this.path + this.fileName; model.ReportSettings.FileName = this.path + this.fileName;

5
src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs

@ -32,10 +32,13 @@ namespace ReportGenerator {
this.reportModel = reportModel; this.reportModel = reportModel;
} }
protected void FormatSingleEntry (IItemRenderer item, protected void FormatSingleEntry (IItemRenderer item,
int itemWidth, int itemWidth,
Point location, Point location,
Font font) { Font font) {
if (item == null) {
throw new ArgumentNullException("item");
}
item.Size = new Size (itemWidth,item.Size.Height + GlobalValues.EnlargeControl); item.Size = new Size (itemWidth,item.Size.Height + GlobalValues.EnlargeControl);
item.Location = new Point (location.X,location.Y); item.Location = new Point (location.X,location.Y);
item.Font = font; item.Font = font;

6
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs

@ -207,7 +207,7 @@ namespace ReportGenerator
this.txtSqlString.Enabled = true; this.txtSqlString.Enabled = true;
if (this.firstDrag) { if (this.firstDrag) {
this.txtSqlString.Text = ""; this.txtSqlString.Text = String.Empty;
} }
} else { } else {
@ -228,7 +228,7 @@ namespace ReportGenerator
///<param name="SharpQueryNodeColumn">a ColumnNode</param> ///<param name="SharpQueryNodeColumn">a ColumnNode</param>
/// <returns>a valid ColumnName</returns> /// <returns>a valid ColumnName</returns>
/// ///
private string MakeProperColumnName(SharpQueryNodeColumn node) { private static string MakeProperColumnName(SharpQueryNodeColumn node) {
string colName; string colName;
if (node != null) { if (node != null) {
if (node.SchemaClass.NormalizedName.IndexOf("-") > -1 ){ if (node.SchemaClass.NormalizedName.IndexOf("-") > -1 ){
@ -244,7 +244,7 @@ namespace ReportGenerator
} }
// check witch type of node we dragg // check witch type of node we dragg
private enmNodeType CheckCurrentNode (ISharpQueryNode node) { private static enmNodeType CheckCurrentNode (ISharpQueryNode node) {
enmNodeType enm; enmNodeType enm;
if (node == null) { if (node == null) {
enm = enmNodeType.nodeError; enm = enmNodeType.nodeError;

23
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs

@ -8,10 +8,11 @@
*/ */
using System; using System;
using System.Data;
using System.Globalization;
using System.ComponentModel; using System.ComponentModel;
using System.Collections; using System.Collections;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -71,16 +72,16 @@ namespace ReportGenerator
#region ListBox #region ListBox
void FillListBox (string fileName) { void FillListBox (string fileName) {
DataSet ds = new DataSet(); DataSet ds = new DataSet();
ds.Locale = CultureInfo.CurrentCulture;
ds.ReadXml (fileName); ds.ReadXml (fileName);
AutoReport auto = new AutoReport (); using (AutoReport auto = new AutoReport()){
ReportModel model = generator.FillReportModel (new ReportModel()); ReportModel model = generator.FillReportModel (new ReportModel());
colDetail = auto.AutoColumnsFromSchema(model,ds); colDetail = auto.ReportItemsFromSchema(model,ds);
if (colDetail == null) {
throw new NullReferenceException("PushModelpanel:ColDetail");
} else {
foreach (ReportDataItem item in colDetail) { if (colDetail != null) {
this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked); foreach (ReportDataItem item in colDetail) {
this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked);
}
} }
} }
base.EnableNext = true; base.EnableNext = true;
@ -112,7 +113,7 @@ namespace ReportGenerator
itemCol.Add(item); itemCol.Add(item);
} }
} }
//
customizer.Set ("ReportItemCollection",itemCol); customizer.Set ("ReportItemCollection",itemCol);
} }
return true; return true;

14
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs

@ -8,12 +8,14 @@
*/ */
using System; using System;
using System.Globalization;
using System.Data;
using System.Data.OleDb;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Data;
using System.Data.OleDb;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
@ -59,12 +61,12 @@ namespace ReportGenerator{
#region Fill data #region Fill data
private void FillGrid() { private void FillGrid() {
System.Console.WriteLine("FillGrid");
this.grdQuery.DataSource = null; this.grdQuery.DataSource = null;
this.txtSqlString.Text = null; this.txtSqlString.Text = null;
ReportModel model = generator.FillReportModel(new ReportModel()); ReportModel model = generator.FillReportModel(new ReportModel());
resultDataSet = new DataSet(); resultDataSet = new DataSet();
resultDataSet.Locale = CultureInfo.CurrentCulture;
this.txtSqlString.Text = model.ReportSettings.CommandText; this.txtSqlString.Text = model.ReportSettings.CommandText;
if (model.ReportSettings.CommandType == CommandType.StoredProcedure){ if (model.ReportSettings.CommandType == CommandType.StoredProcedure){
@ -110,8 +112,8 @@ namespace ReportGenerator{
try { try {
// Stored Proc without Parameters // Stored Proc without Parameters
resultDataSet = (DataSet) proc.Execute(0,proc.GetSchemaParameters()); resultDataSet = (DataSet) proc.Execute(0,proc.GetSchemaParameters());
} catch (Exception e) { } catch (Exception) {
throw e; throw;
} }
} }
@ -142,7 +144,7 @@ namespace ReportGenerator{
} }
DataSet BuildFromSqlString(ReportSettings settings) { private static DataSet BuildFromSqlString(ReportSettings settings) {
OLEDBConnectionWrapper con = null; OLEDBConnectionWrapper con = null;
DataSet ds = null; DataSet ds = null;
if (settings.CommandText.IndexOf("?") > 0) { if (settings.CommandText.IndexOf("?") > 0) {

Loading…
Cancel
Save