From 6991095c109e1bd25fed8512123f34a59bd5e10d Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Thu, 2 Feb 2006 12:28:40 +0000 Subject: [PATCH] Small changes in ReportGenerator and better handling of IDisposable git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1060 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../SharpReport/SharpReport/AutoReport.cs | 52 ++++--- .../SharpReport/Designer/IDesignable.cs | 3 +- .../SharpReport/Designer/NameService.cs | 7 +- .../SharpReport/Designer/Report.cs | 24 ++-- .../Designer/SectionControls/ReportSection.cs | 6 +- .../ReportSectionControlbase.cs | 10 +- .../SectionChangedEventArgs.cs | 2 - .../Functions/MiscFunctions/PageNumber.cs | 3 +- .../Functions/MiscFunctions/Today.cs | 3 +- .../GraphicBased/ReportCircleItem.cs | 3 +- .../GraphicBased/ReportImageItem.cs | 3 +- .../GraphicBased/ReportLineItem.cs | 3 +- .../GraphicBased/ReportRectangleItem.cs | 3 +- .../ReportItems/TextBased/ReportDataItem.cs | 2 +- .../ReportItems/TextBased/ReportTextItem.cs | 3 +- .../SharpReport/SharpReportManager.cs | 127 +++++++++--------- .../FieldsExplorer/FieldsExplorer.cs | 1 - .../SharpReportAddin/SharpReportView.cs | 60 ++++++--- .../Collections/Collections.cs | 17 ++- .../DataManager/Comparer/GroupSeperator.cs | 4 +- .../DataManager/DataManager.cs | 83 +++++++----- .../ListHandling/SharpArrayList.cs | 15 ++- .../ListStrategy/BaseListStrategy.cs | 17 ++- .../DataManager/ListStrategy/TableStrategy.cs | 18 ++- .../Interfaces/IDataViewStrategy.cs | 4 +- .../Printing/AbstractRenderer.cs | 8 +- .../Printing/Formatter/DefaultFormatter.cs | 3 + .../Printing/Graphics/BaseShape.cs | 10 +- .../Printing/Graphics/Border.cs | 8 +- .../Printing/RenderDataReport.cs | 5 +- .../Printing/Text/TextDrawer.cs | 4 +- .../SharpReportCore/ReportModel.cs | 21 ++- .../SharpReportCore/ReportSettings.cs | 40 +++--- .../SharpReportCore/SharpReportEngine.cs | 40 ++++-- .../SharpReportWizard/GeneratorCommands.cs | 23 ++-- .../Generators/AbstractReportGenerator.cs | 55 ++++++-- .../Generators/GeneratePullDataReport.cs | 30 ++--- .../Generators/GeneratePushDataReport.cs | 18 ++- .../SharpReportWizard/ReportGenerator.cs | 4 +- .../ReportLayouts/AbstractLayout.cs | 5 +- .../WizardPanels/PullModelPanel.cs | 6 +- .../WizardPanels/PushModelPanel.cs | 23 ++-- .../WizardPanels/ResultPanel.cs | 14 +- 43 files changed, 461 insertions(+), 329 deletions(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs b/src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs index cf481303ad..deadcd1600 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs @@ -61,7 +61,7 @@ namespace SharpReport { /// SchemaDefinition Datatable /// Collection of BaseDataItems - public ReportItemCollection AutoColumnsFromTable (ReportModel model,DataTable schemaTable) { + public ReportItemCollection ReportItemsFromTable (ReportModel model,DataTable schemaTable) { ReportItemCollection itemCol = new ReportItemCollection(); for (int i = 0;i < schemaTable.Rows.Count;i++){ @@ -84,7 +84,7 @@ namespace SharpReport { /// DataSet from *.xsd File /// Collection of BaseDataItems - public ReportItemCollection AutoColumnsFromSchema (ReportModel model,DataSet dataSet) { + public ReportItemCollection ReportItemsFromSchema (ReportModel model,DataSet dataSet) { if (dataSet.Tables.Count > 1) { 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"); @@ -126,25 +126,9 @@ namespace SharpReport { throw new ArgumentNullException ("AutoReport:ReportItemCollection"); } } + #endregion - public ReportItemCollection AutoHeaderColumns(ReportItemCollection col) { - 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"); - } - } - + #region HeaderColumns /// /// Build Headerline from a schemaDataTable /// @@ -154,7 +138,7 @@ namespace SharpReport { /// Locate the Columns of Top or an Bottom of the Section /// a Collection of BaseTextItems - public ReportItemCollection AutoHeaderFromTable (ReportModel model,BaseSection section,DataTable schemaTable,bool setOnTop) { + public ReportItemCollection AutoHeaderFromTable (BaseSection section,DataTable schemaTable,bool setOnTop) { ReportItemCollection itemCol = new ReportItemCollection(); for (int i = 0;i < schemaTable.Rows.Count;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 } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs index 9135017536..de09d4baff 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs @@ -41,6 +41,7 @@ namespace SharpReport.Designer{ event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - event SelectedEventHandler Selected; +// event EventHandler GroupChanged; + event EventHandler Selected; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs index 1b57196884..511bf8cceb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs @@ -35,10 +35,11 @@ namespace SharpReport { public string CreateName (ReportItemCollection collection, 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; - while (collection.Find(name + number.ToString()) != null) { + while (collection.Find(name + number.ToString(CultureInfo.InvariantCulture)) != null) { ++number; } @@ -61,7 +62,7 @@ namespace SharpReport { public void ValidateName(ReportItemCollection collection, string name) { if (!IsValidName(collection,name)) { - throw new System.Exception("Invalid name " + name); + throw new SharpReportException("Invalid name " + name); } } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs index 0d558d5fbd..87fe1c690c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs @@ -52,8 +52,8 @@ namespace SharpReport.Designer{ [EditorBrowsable(EditorBrowsableState.Always), Browsable(true)] - public event SelectedEventHandler ObjectSelected; + public event EventHandler ObjectSelected; public event EventHandler SectionChanged; public event ItemDragDropEventHandler DesignViewChanged; @@ -111,18 +111,18 @@ namespace SharpReport.Designer{ sectionCollection.Add(detail); sectionCollection.Add(pageFooter); 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); - pageHeader.ItemSelected += new SelectedEventHandler(this.ItemSelected); - detail.ItemSelected += new SelectedEventHandler(this.ItemSelected); - footer.ItemSelected += new SelectedEventHandler(this.ItemSelected); - pageFooter.ItemSelected += new SelectedEventHandler(this.ItemSelected); + header.Selected += new EventHandler (this.SectionSelected); + pageHeader.Selected += new EventHandler (this.SectionSelected); + detail.Selected += new EventHandler (this.SectionSelected); + footer.Selected += new EventHandler (this.SectionSelected); + pageFooter.Selected += new EventHandler (this.SectionSelected); + + header.ItemSelected += new EventHandler (this.ItemSelected); + pageHeader.ItemSelected += new EventHandler (this.ItemSelected); + detail.ItemSelected += new EventHandler (this.ItemSelected); + footer.ItemSelected += new EventHandler (this.ItemSelected); + pageFooter.ItemSelected += new EventHandler (this.ItemSelected); //This events are from DragDropp visualReportHeader.ReportItemsHandling += new ItemDragDropEventHandler (OnAddReportItem); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs index 940cef4386..b786fe7685 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs @@ -34,9 +34,9 @@ namespace SharpReport{ const string contextMenuPath = "/SharpReport/ContextMenu/Section"; private ReportSectionControlBase visualControl; - public event SelectedEventHandler ItemSelected; - public event SelectedEventHandler Selected; + public event EventHandler ItemSelected; + public event EventHandler Selected; #region Constructors internal ReportSection() : base(){ @@ -247,7 +247,7 @@ namespace SharpReport{ SharpReport.Designer.IDesignable iDesignable = item as SharpReport.Designer.IDesignable; if (iDesignable != null) { if (this.VisualControl != null) { - iDesignable.Selected += new SelectedEventHandler(this.ReportItemSelected); + iDesignable.Selected += new EventHandler (this.ReportItemSelected); this.VisualControl.Body.Controls.Add(iDesignable.VisualControl); iDesignable.VisualControl.BringToFront(); iDesignable.VisualControl.Focus(); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs index 9330af3343..e58b74e0be 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs @@ -36,7 +36,8 @@ namespace SharpReport.Designer{ private int currentY; - public event SelectedEventHandler ItemSelected; + public event EventHandler ItemSelected; + public event ItemDragDropEventHandler ItemDragDrop; public event EventHandler SectionChanged; @@ -66,13 +67,6 @@ namespace SharpReport.Designer{ private void BodyPanelPaint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; 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, this.Body.ClientRectangle, GlobalValues.GridSize, diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs index 4cf99b9e75..1388186215 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs @@ -22,8 +22,6 @@ namespace SharpReport.Designer { /// created on - 20.12.2004 22:06:09 /// - public delegate void SelectedEventHandler(object sender, EventArgs e); - public class SectionChangedEventArgs : System.EventArgs { ReportSection section; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs index 4364b7d6c7..1918d81b2c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs +++ b/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 Selected; + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs index a0a251c470..b7b5a0513d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs @@ -174,8 +174,9 @@ namespace SharpReport.ReportItems.Functions { return visualControl; } } + + public event EventHandler Selected; - public event SelectedEventHandler Selected; #endregion } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs index 8d49eb4cda..cff1e69848 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs @@ -133,7 +133,8 @@ namespace SharpReport.ReportItems{ } } public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; + #endregion } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs index c55e03c2ba..456ab73b85 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs @@ -106,7 +106,8 @@ namespace SharpReport.ReportItems { } public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; + #endregion } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs index 87a88adbc6..a47f10ff12 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs @@ -137,7 +137,8 @@ namespace SharpReport.ReportItems{ public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs index 28ff506e6e..25c69eeda6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs @@ -148,7 +148,8 @@ namespace SharpReport.ReportItems{ } public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs index a0d49f9d75..8eca5d249e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs @@ -183,7 +183,7 @@ namespace SharpReport.ReportItems{ } public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index d463830de8..1e6f26c956 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -168,7 +168,8 @@ namespace SharpReport.ReportItems { } public new event PropertyChangedEventHandler PropertyChanged; - public event SelectedEventHandler Selected; + public event EventHandler Selected; + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs index 9c3a301e5f..3d13406996 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs @@ -37,7 +37,7 @@ namespace SharpReport{ /// /// Description of SharpReportManager. /// - public class SharpReportManager :SharpReportEngine { + public class SharpReportManager :SharpReportEngine,IDisposable { private BaseDesignerControl baseDesignerControl; private ReportModel reportModel; @@ -145,7 +145,9 @@ namespace SharpReport{ #region Standarts for all reports (Headlines etc) /// - /// Create TextItem in PageHeader with Reportmodel.ReportSettings.ReportName + /// Insert a in the PageHeader with + /// the as + /// text /// /// ReportModel public void CreatePageHeader (ReportModel model) { @@ -181,34 +183,24 @@ namespace SharpReport{ pageNumber.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 - #region Create report from Query + #region HeaderColumns /// - /// Builds ColumHeaders for report, we take the ColumnNames as Text Property + /// Builds ColumHeaders for Reports, we take the ColumnNames as Text Property /// /// A valid(filled) reportModel /// The Section to use for headerLines /// SchemaTable witch contains the Column Informations - public void CreateColumnHeadersFromTable (ReportModel model,BaseSection section,DataTable schemaTable) { + public void HeaderColumnsFromTable (BaseSection section,DataTable schemaTable) { if (section == null) { throw new ArgumentException("SharpReportManager:CreateColumnHeadersFromTable
"); } using (AutoReport auto = new AutoReport()){ try { - ReportItemCollection headerCol = auto.AutoHeaderFromTable (model,section,schemaTable,false); + ReportItemCollection headerCol = auto.AutoHeaderFromTable (section,schemaTable,false); AddItemsToSection (section,headerCol); } catch (Exception) { throw; @@ -216,6 +208,31 @@ namespace SharpReport{ } } + /// + /// Create ColumHeaders for Reports + /// + /// A ReportSection whre to build the Hedarlines + ///A + /// containing the basic informations + + 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 + + /// /// Create Columns from SchemaTable /// @@ -223,14 +240,14 @@ namespace SharpReport{ ///DataTable witch contaisn SchemaDefinitions /// - public void CreateColumnsFromTable (ReportModel model,DataTable schemaTable) { + public void DataColumnsFromTable (ReportModel model,DataTable schemaTable) { if ((model == null)||(schemaTable.Rows.Count == 0) ) { throw new ArgumentException ("Invalid Arguments in SharpReportmanager:CreateColumnsFromFile"); } using (AutoReport auto = new AutoReport()){ try { - ReportItemCollection colDetail = auto.AutoColumnsFromTable (model, + ReportItemCollection colDetail = auto.ReportItemsFromTable (model, schemaTable); BaseSection section = model.DetailSection; section.SuspendLayout(); @@ -244,49 +261,8 @@ namespace SharpReport{ #endregion #region Create Reports from .Xsd Files - /* - /// - /// create Header from an .Xsd File - /// - /// a valid ReportModel - /// Section in witch the header should be created - /// File/Path to .Xsd file - 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; - } - } - */ - /// - /// Create the ReportHeader - /// - /// A ReportSection whre to build the Hedarlines - ///A reportItemcollection containing the basic informations - 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; - } - } - } + /// /// Create the DataColumns /// @@ -294,7 +270,7 @@ namespace SharpReport{ /// /// DataItems ///A reportItemcollection containing the basic informations - public void CreateDataColumns (BaseSection section,ReportItemCollection collection) { + public void DataColumnsFromReportItems (BaseSection section,ReportItemCollection collection) { using (AutoReport auto = new AutoReport()){ try { ReportItemCollection colDetail = auto.AutoDataColumns (collection); @@ -488,6 +464,35 @@ namespace SharpReport{ } #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 } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs index 27865a0ada..b44172edec 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs @@ -553,7 +553,6 @@ namespace SharpReportAddin { public FieldsExplorer() { - WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange; LabelEdit = true; diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs index c712337d33..146dc90825 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs @@ -32,7 +32,7 @@ namespace SharpReportAddin{ /// /// Description of the view content /// - public class SharpReportView : AbstractViewContent,IPrintable + public class SharpReportView : AbstractViewContent,IPrintable,IDisposable { private SharpReportManager reportManager = null; @@ -57,6 +57,11 @@ namespace SharpReportAddin{ BuildToolBarItems(); PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.Refresh(); + //Activate the FieldsExplorer - Pad + PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FieldsExplorer)); + if (pad != null) { + pad.CreatePad(); + } } catch (Exception e) { MessageService.ShowError(e,e.Message); throw e; @@ -83,7 +88,6 @@ namespace SharpReportAddin{ } } - #endregion @@ -189,7 +193,7 @@ namespace SharpReportAddin{ ctrl.ReportControl.AutoScroll = true; ctrl.Dock = DockStyle.Fill; - ctrl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected); + ctrl.ReportControl.ObjectSelected +=new EventHandler (OnObjectSelected); ctrl.ReportControl.DesignViewChanged += new ItemDragDropEventHandler (OnItemDragDrop); ctrl.DesignerDirty += new System.ComponentModel.PropertyChangedEventHandler (OnPropertyChanged); @@ -495,12 +499,12 @@ namespace SharpReportAddin{ /// A valid Filename public override void Load(string fileName){ try { - designerControl.ReportControl.ObjectSelected -= new SelectedEventHandler (OnObjectSelected); + designerControl.ReportControl.ObjectSelected -= new EventHandler (OnObjectSelected); reportManager.LoadFromFile (fileName); base.FileName = fileName; designerControl.ReportModel.ReportSettings.FileName = fileName; - designerControl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected); + designerControl.ReportControl.ObjectSelected += new EventHandler (OnObjectSelected); PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.Refresh(); this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection; @@ -511,20 +515,7 @@ namespace SharpReportAddin{ } } - /// - /// Cleans up all used resources - /// - 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 @@ -546,7 +537,38 @@ namespace SharpReportAddin{ #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 } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs index 412b228cf1..d246a138aa 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs @@ -77,7 +77,8 @@ namespace SharpReportCore{ public IItemRenderer Find (string itemName) { for (int i = 0;i < this.Count ; 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; } } @@ -129,7 +130,6 @@ namespace SharpReportCore{ return col; } } - return null; } @@ -143,7 +143,6 @@ namespace SharpReportCore{ public ColumnCollection(){ culture = CultureInfo.CurrentCulture; - } @@ -165,12 +164,12 @@ namespace SharpReportCore{ public CultureInfo Culture { get { return culture; } - set - { - if (value == null) - value = CultureInfo.CurrentCulture; - culture = value; - } +// set +// { +// if (value == null) +// value = CultureInfo.CurrentCulture; +// culture = value; +// } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs index b9ba41f091..dd71c34d35 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs @@ -25,14 +25,12 @@ namespace SharpReportCore { public class GroupSeperator : SharpReportCore.GroupComparer,IHierarchyData { private string typeName = "GroupSeperator"; - int groupLevel = 0; -// GroupSeperator parent = null; + int groupLevel; IHierarchicalArray childs ; public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel): base(owner,listIndex,values) { this.groupLevel = groupLevel; -// this.parent = parent; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs index 4eecaf1491..57aef35032 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs @@ -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. // //------------------------------------------------------------------------------ @@ -14,8 +14,6 @@ using System.Collections; using System.ComponentModel; using System.Globalization; -//using SharpReportCore; - /// /// This Class is used as a wrapper around Databinding /// @@ -23,10 +21,11 @@ using System.Globalization; /// created by - Forstmeier Peter /// created on - 16.10.2005 14:49:43 /// -namespace SharpReportCore { +namespace SharpReportCore { - public class DataManager : IDataContainer,IEnumerator,IDisposable { + public class DataManager : IDataContainer,IEnumerator,IDisposable { + /* /// /// Operand to use when filtering... /// @@ -36,6 +35,8 @@ namespace SharpReportCore { Includes, NotIncludes, } + */ + int currentRow = -1; ReportSettings reportSettings; @@ -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 ListChanged; public event EventHandler GroupChanged; /// @@ -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 (NotifyListChanged); } catch (Exception) { throw; } @@ -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 (NotifyListChanged); } catch (Exception) { throw ; } - } public DataManager(DataSet dataSource, ReportSettings reportSettings) @@ -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 (NotifyListChanged); } catch (Exception ) { throw ; } @@ -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 (NotifyListChanged); } catch (Exception) { throw; } @@ -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 { } 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 { 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 { 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 { } - 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 { 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 { return hierarchicalList; } } - */ + */ #region SharpReportCore.IDataContainer interface implementation @@ -391,11 +402,9 @@ namespace SharpReportCore { this.dataViewStrategy.Bind(); this.dataViewStrategy.GroupChanged += new EventHandler (NotifyGroupChange); CheckReportColumns(); -// this.NotifyListChanged (this,this.resetList); return true; } - //ToDo Remove this public void Skip() { this.dataViewStrategy.CurrentRow ++; } @@ -406,7 +415,7 @@ namespace SharpReportCore { foreach (IItemRenderer item in collection) { this.dataViewStrategy.Fill(item); } - } catch (Exception) { + } catch (Exception) { } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs index e609dfd0f5..dced462312 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs @@ -19,9 +19,9 @@ namespace SharpReportCore bool allowNew = true; bool allowEdit = true; bool allowRemove = true; - bool supportsSearching = false; - bool supportsSorting = false; - bool isSorted = false; + bool supportsSearching ; + bool supportsSorting ; + bool isSorted; private ListChangedEventArgs resetEvent = new ListChangedEventArgs(ListChangedType.Reset, -1); @@ -160,18 +160,27 @@ namespace SharpReportCore get { return this.supportsSearching; } + set { + this.supportsSearching = value; + } } public bool SupportsSorting { get { return this.supportsSorting; } + set { + this.supportsSorting = value; + } } public bool IsSorted { get { return this.isSorted; } + set { + this.isSorted = value; + } } public System.ComponentModel.PropertyDescriptor SortProperty { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs index f0215fb32e..0210c1f82b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs @@ -12,6 +12,7 @@ using System; using System.Globalization; using System.ComponentModel; using System.Collections; +using System.Collections.Generic; using SharpReportCore; /// @@ -36,14 +37,14 @@ namespace SharpReportCore { private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); - public event ListChangedEventHandler ListChanged; + public event EventHandler ListChanged; public event EventHandler GroupChanged; #region Constructor protected BaseListStrategy(ReportSettings reportSettings) { this.reportSettings = reportSettings; - this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList"); + this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList"); } #endregion @@ -65,15 +66,14 @@ namespace SharpReportCore { #endregion - protected SharpArrayList IndexList { + + public SharpArrayList IndexList { get { return indexList; } - set { - indexList = value; - } } + public ReportSettings ReportSettings { get { return reportSettings; @@ -173,6 +173,7 @@ namespace SharpReportCore { } protected virtual void Group() { + if (this.indexList != null) { this.BuildHierarchicalList (this.indexList); this.isGrouped = true; @@ -180,6 +181,7 @@ namespace SharpReportCore { } else { throw new SharpReportException ("BaseListStrategy:Group Sorry, no IndexList"); } + } @@ -296,9 +298,10 @@ namespace SharpReportCore { } public virtual void Fill(IItemRenderer item) { - } #endregion } + + } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs index 728c6d450b..627e93d79d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs @@ -212,19 +212,22 @@ namespace SharpReportCore { if (base.ReportSettings.GroupColumnsCollection != null) { if (base.ReportSettings.GroupColumnsCollection.Count > 0) { groupedArray = this.BuildGroupIndex (base.ReportSettings.GroupColumnsCollection); - + System.Console.WriteLine("\t1"); } else { groupedArray = BuildPlainIndex (base.ReportSettings.GroupColumnsCollection); } } - base.IndexList.Clear(); + base.IndexList.Clear(); base.IndexList.AddRange (InsertGroupRows(groupedArray)); if (base.IndexList == null){ throw new NotSupportedException("Sortieren für die Liste nicht unterstützt."); } - } catch (Exception) { + + + } catch (Exception e) { + System.Console.WriteLine("BuildGroup {0}",e.Message); throw; } } @@ -236,13 +239,14 @@ namespace SharpReportCore { } try { - this.BuildGroup(); - base.Group(); - + this.BuildGroup(); + base.Group(); if (this.IsGrouped == false) { throw new SharpReportException("TableStratregy:Group Error in grouping"); } - } catch (Exception) { + + } catch (Exception e) { + System.Console.WriteLine("Group {0}",e.Message); base.IsGrouped = false; base.IsSorted = false; throw; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs index 72560af8e9..4dbeaead55 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs @@ -78,8 +78,8 @@ namespace SharpReportCore{ bool IsGrouped { get; } - event ListChangedEventHandler ListChanged; - +// event ListChangedEventHandler ListChanged; + event EventHandler ListChanged; /// /// Fired each tim the grouping will change, this means theGroupLevel changes up or down /// diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index c5b5053fee..cce58491b8 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/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); if (section.Visible){ - section.Render (e); + section.Render (rpea); foreach (BaseReportItem rItem in section.Items) { rItem.SuspendLayout(); @@ -185,10 +185,10 @@ namespace SharpReportCore { rItem.FormatOutput -= new EventHandler (FormatBaseReportItem); rItem.FormatOutput += new EventHandler (FormatBaseReportItem); - rItem.Render(e); + rItem.Render(rpea); 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(); } if ((section.CanGrow == false)&& (section.CanShrink == false)) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs index dc9e6509a8..75bb60710c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs @@ -43,6 +43,9 @@ namespace SharpReportCore{ ///A ReportDataItem /// public string FormatItem (BaseDataItem item) { + if (item == null) { + throw new ArgumentNullException("item"); + } string retValue = String.Empty; switch (item.DataType) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs index ee41a41958..d4df64c061 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs +++ b/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; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs index 0300e15605..6ac7c8a443 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs @@ -43,20 +43,20 @@ namespace SharpReportCore { 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)) { p.DashStyle = baseLine.DashStyle; - g.DrawRectangle (p,rectangle.Left, + graphics.DrawRectangle (p,rectangle.Left, rectangle.Top, rectangle.Width, 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)) { p.DashStyle = baseLine.DashStyle; - g.DrawRectangle (p,rectangle); + graphics.DrawRectangle (p,rectangle); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index 53a09e2697..e06a1b78f7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -105,7 +105,6 @@ namespace SharpReportCore { section.Size.Height); DebugRectangle (e,detailRect); - float offset = 0F; // no loop if there is no data if (! dataManager.HasMoreData ) { e.PrintPageEventArgs.HasMorePages = false; @@ -120,8 +119,8 @@ namespace SharpReportCore { if (dataManager.HasMoreData) { 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; base.FitSectionToItems (base.CurrentSection,e); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs index 4daecc9d3e..56eab54358 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs +++ b/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) { - g.DrawString(text, + public void DrawString(Graphics graphics,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) { + graphics.DrawString(text, font, brush, rectangle, diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs index 82253ad00d..e04525f42f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs @@ -126,9 +126,26 @@ namespace SharpReportCore { #region IDispoable public void Dispose(){ - if (this.reportSettings != null) { - this.reportSettings.Dispose(); + this.Dispose(true); + 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 } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs index bb1a072150..1a9d20c831 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs +++ b/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 #region IDisposable public void Dispose(){ - if (this.defaultFont != null) { - this.defaultFont.Dispose(); - } + this.Dispose(true); + 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 } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index 4ad49caf41..0183732e89 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -57,7 +57,7 @@ namespace SharpReportCore { private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) { if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) { if (this.connectionObject == null) { - + if (model.ReportSettings.ConnectionString != "") { this.connectionObject = new ConnectionObject (model.ReportSettings.ConnectionString,"",""); } @@ -91,7 +91,7 @@ namespace SharpReportCore { } - + void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) { if ((sqlParams == null)||(sqlParams.Count == 0)) { return; @@ -100,6 +100,8 @@ namespace SharpReportCore { model.ReportSettings.SqlParametersCollection.AddRange(sqlParams); } + + private static void SetCustomSorting (ReportModel model,ColumnCollection sortParams) { if ((sortParams == null)||(sortParams.Count == 0)) { return; @@ -130,10 +132,7 @@ namespace SharpReportCore { } private DataManager SetupDataContainer (ReportSettings settings) { - System.Console.WriteLine("SetupContainer"); - - System.Console.WriteLine("after check"); if (settings.ReportType == GlobalEnums.enmReportType.DataReport) { if (settings.CommandText != null) { try { @@ -143,7 +142,6 @@ namespace SharpReportCore { DataManager container = new DataManager(this.connectionObject, settings); - System.Console.WriteLine("\t No of Records to print {0}",container.Count); if (container.DataBind() == true) { return container; } else { @@ -239,7 +237,7 @@ namespace SharpReportCore { AbstractRenderer abstr = null; DataManager dataManager = new DataManager (dataTable,model.ReportSettings); - System.Console.WriteLine("\tDataManager ok = {0}",(dataManager != null)); + if (dataManager != null) { dataManager.DataBind(); if (dataManager.DataSource != null) { @@ -541,14 +539,32 @@ namespace SharpReportCore { } #endregion + #region IDisposable + public void Dispose(){ - if (this.connectionObject == null) { - this.connectionObject.Dispose(); - } - if (this.previewControl != null) { - this.previewControl.Dispose(); + this.Dispose(true); + GC.SuppressFinalize(this); + } + + ~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 } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs index 257de50def..546417f211 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs @@ -62,9 +62,10 @@ namespace ReportGenerator{ try { gen.FillReportModel (reportModel); DoCreate(reportModel); - } catch (Exception e) { - MessageService.ShowError (e,e.Message); - return; + } catch (Exception) { +// MessageService.ShowError (e,e.Message); +// return; + throw; } } else { throw new SharpReportException("Chancel"); @@ -107,8 +108,8 @@ namespace ReportGenerator{ } else { throw new NullReferenceException ("GeneratePullDataReport"); } - } catch (Exception e) { - throw e; + } catch (Exception) { + throw; } } @@ -125,22 +126,22 @@ namespace ReportGenerator{ } else { throw new NullReferenceException ("GeneratePullDataReport"); } - } catch (Exception e) { - throw e; + } catch (Exception) { + throw; } } - void GenerateFormSheet (ReportModel model) { + private static void GenerateFormSheet (ReportModel model) { if (model.ReportSettings.DataModel != GlobalEnums.enmPushPullModel.FormSheet) { - throw new ArgumentException ("Wrong DataModel in GenerateFormSheet"); + throw new ArgumentNullException ("model"); } try { model.ReportSettings.ReportType = GlobalEnums.enmReportType.FormSheet; - } catch (Exception e) { - throw e; + } catch (Exception) { + throw; } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs index 1c14501412..ece547a60b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs @@ -12,7 +12,7 @@ using System; using System.Drawing; using System.Data; using System.Data.OleDb; -using System.Windows.Forms; +using System.Globalization; using ICSharpCode.Core; @@ -53,15 +53,33 @@ namespace ReportGenerator { #region ReportGenerator.IReportGenerator interface implementation 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 - - - - //TODO Change these function to using SharpQuery - protected DataTable GenerateFieldsTable(ReportModel reportModel) { + /* + protected ColumnCollection AvailableColumnsFromTable (DataTable table) { + + if (table == null) { + 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) { throw new ArgumentNullException("reportModel"); } @@ -71,7 +89,7 @@ namespace ReportGenerator { OleDbConnection connection = null; OleDbCommand command = null; try { - + connection = new OleDbConnection(reportModel.ReportSettings.ConnectionString); connection.Open(); @@ -91,7 +109,7 @@ namespace ReportGenerator { SqlParameter rpPar; for (int i = 0;i < rpc ;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) { @@ -99,7 +117,7 @@ namespace ReportGenerator { rpPar.DataType); oleDBPar.Value = rpPar.DefaultValue; } else { - System.Console.WriteLine("binary"); +// System.Console.WriteLine("binary"); oleDBPar = new OleDbParameter(rpPar.ParameterName, System.Data.DbType.Binary); } @@ -108,8 +126,8 @@ namespace ReportGenerator { } } - } catch (Exception e) { - throw e; + } catch (Exception) { + throw; } OleDbDataReader reader = 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 public Properties Customizer { diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs index b2ae126fe4..fdddaa6b78 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs @@ -7,14 +7,11 @@ // the code is regenerated. // //------------------------------------------------------------------------------ +using System; +using System.Data; - - using System; - using System.Data; - - using ICSharpCode.Core; - - using SharpReportCore; +using ICSharpCode.Core; +using SharpReportCore; /// /// This class is used to AutoGenerate a (PullData) Report /// (Reports, that grap the Data by themselve) @@ -23,7 +20,8 @@ /// created by - Forstmeier Peter /// created on - 07.09.2005 13:23:14 /// - +using System.Windows.Forms; + namespace ReportGenerator { public class GeneratePullDataReport : AbstractReportGenerator { @@ -57,22 +55,18 @@ namespace ReportGenerator { // just run tableFields = base.GenerateFieldsTable (base.ReportModel); } - - BuildStandartSections(); - base.Manager.CreatePageHeader (base.ReportModel); - - base.Manager.CreateColumnHeadersFromTable(base.ReportModel, - base.ReportModel.PageHeader, + base.GenerateReport(); + base.Manager.HeaderColumnsFromTable(base.ReportModel.PageHeader, tableFields); - - base.Manager.CreateColumnsFromTable (base.ReportModel, + + base.Manager.DataColumnsFromTable (base.ReportModel, tableFields); - base.Manager.CreatePageNumber(base.ReportModel); + using (TableLayout layout = new TableLayout(base.ReportModel)){ layout.BuildLayout(); } - base.Manager.AdjustNames(base.ReportModel); + base.AdjustAll(); } catch (Exception e) { throw e; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs index 6efa9bbd56..fad7df27e7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs @@ -14,7 +14,7 @@ using System.Data; using ICSharpCode.Core; using SharpReportCore; - +using System.Windows.Forms; /// /// This class is used to generate PushDataReports /// (Reports, that are feed with an DataSet etc) @@ -41,17 +41,21 @@ namespace ReportGenerator { public override void GenerateReport() { base.ReportModel.ReportSettings.ReportType = GlobalEnums.enmReportType.DataReport; - BuildStandartSections(); - base.Manager.CreatePageHeader (base.ReportModel); + 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)){ layout.BuildLayout(); } - base.Manager.AdjustNames(base.ReportModel); + base.AdjustAll(); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs index f207956483..69737f4355 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs @@ -59,7 +59,9 @@ namespace ReportGenerator { } public ReportModel FillReportModel (ReportModel model) { - + if (model == null) { + throw new ArgumentNullException("model"); + } model.ReportSettings.ReportName = this.reportName; model.ReportSettings.FileName = this.path + this.fileName; diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs index e1cece14d7..42c6ca68c4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs @@ -32,10 +32,13 @@ namespace ReportGenerator { this.reportModel = reportModel; } - protected void FormatSingleEntry (IItemRenderer item, + protected void FormatSingleEntry (IItemRenderer item, int itemWidth, Point location, Font font) { + if (item == null) { + throw new ArgumentNullException("item"); + } item.Size = new Size (itemWidth,item.Size.Height + GlobalValues.EnlargeControl); item.Location = new Point (location.X,location.Y); item.Font = font; diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs index f47746ee9c..370fef0c85 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs @@ -207,7 +207,7 @@ namespace ReportGenerator this.txtSqlString.Enabled = true; if (this.firstDrag) { - this.txtSqlString.Text = ""; + this.txtSqlString.Text = String.Empty; } } else { @@ -228,7 +228,7 @@ namespace ReportGenerator ///a ColumnNode /// a valid ColumnName /// - private string MakeProperColumnName(SharpQueryNodeColumn node) { + private static string MakeProperColumnName(SharpQueryNodeColumn node) { string colName; if (node != null) { if (node.SchemaClass.NormalizedName.IndexOf("-") > -1 ){ @@ -244,7 +244,7 @@ namespace ReportGenerator } // check witch type of node we dragg - private enmNodeType CheckCurrentNode (ISharpQueryNode node) { + private static enmNodeType CheckCurrentNode (ISharpQueryNode node) { enmNodeType enm; if (node == null) { enm = enmNodeType.nodeError; diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs index 0b87cf66aa..c515b303fa 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs @@ -8,10 +8,11 @@ */ using System; - +using System.Data; +using System.Globalization; using System.ComponentModel; using System.Collections; -using System.Data; + using System.Windows.Forms; using ICSharpCode.Core; @@ -71,16 +72,16 @@ namespace ReportGenerator #region ListBox void FillListBox (string fileName) { DataSet ds = new DataSet(); + ds.Locale = CultureInfo.CurrentCulture; ds.ReadXml (fileName); - AutoReport auto = new AutoReport (); - ReportModel model = generator.FillReportModel (new ReportModel()); - colDetail = auto.AutoColumnsFromSchema(model,ds); - if (colDetail == null) { - throw new NullReferenceException("PushModelpanel:ColDetail"); - } else { + using (AutoReport auto = new AutoReport()){ + ReportModel model = generator.FillReportModel (new ReportModel()); + colDetail = auto.ReportItemsFromSchema(model,ds); - foreach (ReportDataItem item in colDetail) { - this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked); + if (colDetail != null) { + foreach (ReportDataItem item in colDetail) { + this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked); + } } } base.EnableNext = true; @@ -112,7 +113,7 @@ namespace ReportGenerator itemCol.Add(item); } } - // + customizer.Set ("ReportItemCollection",itemCol); } return true; diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs index 19eeafbf7f..d35c816181 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs @@ -8,12 +8,14 @@ */ using System; +using System.Globalization; +using System.Data; +using System.Data.OleDb; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Xml; -using System.Data; -using System.Data.OleDb; + using ICSharpCode.Core; using ICSharpCode.SharpDevelop; @@ -59,12 +61,12 @@ namespace ReportGenerator{ #region Fill data private void FillGrid() { - System.Console.WriteLine("FillGrid"); this.grdQuery.DataSource = null; this.txtSqlString.Text = null; ReportModel model = generator.FillReportModel(new ReportModel()); resultDataSet = new DataSet(); + resultDataSet.Locale = CultureInfo.CurrentCulture; this.txtSqlString.Text = model.ReportSettings.CommandText; if (model.ReportSettings.CommandType == CommandType.StoredProcedure){ @@ -110,8 +112,8 @@ namespace ReportGenerator{ try { // Stored Proc without Parameters resultDataSet = (DataSet) proc.Execute(0,proc.GetSchemaParameters()); - } catch (Exception e) { - throw e; + } catch (Exception) { + throw; } } @@ -142,7 +144,7 @@ namespace ReportGenerator{ } - DataSet BuildFromSqlString(ReportSettings settings) { + private static DataSet BuildFromSqlString(ReportSettings settings) { OLEDBConnectionWrapper con = null; DataSet ds = null; if (settings.CommandText.IndexOf("?") > 0) {