diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs index 75baccb612..9c3a301e5f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs @@ -73,38 +73,35 @@ namespace SharpReport{ /// private ColumnCollection ReadColumnCollection() { - - DataManager dataManager = null; - if (baseDesignerControl == null) { - return new ColumnCollection(); - } - //FormSheet report = no available Fileds - if (baseDesignerControl.ReportModel.ReportSettings.ReportType == GlobalEnums.enmReportType.FormSheet) { - return new ColumnCollection(); - } - - if (baseDesignerControl.ReportModel.DataModel.Equals(GlobalEnums.enmPushPullModel.PushData)) { - return new ColumnCollection(); - } - // PullData, query the Datasource and ask for the available Fields - if (base.ConnectionObject == null) { - base.ConnectionObject = this.BuildConnectionObject(baseDesignerControl.ReportModel.ReportSettings); - } - if (this.baseDesignerControl.ReportModel.DataModel.Equals(GlobalEnums.enmPushPullModel.PullData)){ - - using (dataManager = new DataManager(base.ConnectionObject, - baseDesignerControl.ReportModel.ReportSettings)) { - dataManager.DataBind(); - return dataManager.AvailableFields; - } - } - - //Pushdata, we walk thru all sections and collect the ReportDataItems - if (this.baseDesignerControl.ReportModel.DataModel == GlobalEnums.enmPushPullModel.PushData) { - return base.CollectFieldsFromModel(this.baseDesignerControl.ReportModel); + ColumnCollection columnCollecion = new ColumnCollection(); + switch (baseDesignerControl.ReportModel.DataModel) { + case GlobalEnums.enmPushPullModel.FormSheet: + //Plain FormSheet we do nothing for the moment + break; + case GlobalEnums.enmPushPullModel.PushData: + //PushData + columnCollecion = base.CollectFieldsFromModel(this.baseDesignerControl.ReportModel); + break; + case GlobalEnums.enmPushPullModel.PullData: + // PullData, query the Datasource and ask for the available Fields + if (base.ConnectionObject == null) { + base.ConnectionObject = this.BuildConnectionObject(baseDesignerControl.ReportModel.ReportSettings); + } + + if (this.baseDesignerControl.ReportModel.DataModel.Equals(GlobalEnums.enmPushPullModel.PullData)){ + + using (DataManager dataManager = new DataManager(base.ConnectionObject, + baseDesignerControl.ReportModel.ReportSettings)) { + dataManager.DataBind(); + columnCollecion = dataManager.AvailableFields; + } + } + break; + default: + break; } - throw new ArgumentOutOfRangeException("SharpReportManager:ReadColumnCollection"); + return columnCollecion; } @@ -114,7 +111,10 @@ namespace SharpReport{ private void AddItemsToSection (BaseSection section,ReportItemCollection collection) { if ((section == null)|| (collection == null) ) { - throw new ArgumentNullException ("Sharpreportmanager:AddItemsToSection"); + throw new ArgumentNullException ("section"); + } + if (collection == null) { + throw new ArgumentNullException("collection"); } // if there are already items in the section, // the we have to append the Items, means whe have to enlarge the section diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ViewCommands.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ViewCommands.cs index e0802df26e..2b9529f554 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ViewCommands.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ViewCommands.cs @@ -29,27 +29,7 @@ namespace SharpReportAddin.Commands{ } else { MessageService.ShowError(ResourceService.GetString("Sharpreport.Error.NoPrinter")); } - } } } - - /// - /// Let the update or fill - /// the - /// - - public class SetFieldsExplorer : AbstractSharpReportCommand{ - public SetFieldsExplorer() { - - } - public override void Run() { - try { - base.View.UpdateFieldsExplorer(); - } catch (Exception) { - throw; - } - } - - } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs index 5ff97c99e5..a34a1a3d7e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs @@ -8,7 +8,6 @@ // //------------------------------------------------------------------------------ - using System; using System.ComponentModel; using System.Windows.Forms; diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs index 3eefc10bd1..27865a0ada 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs @@ -46,26 +46,11 @@ namespace SharpReportAddin { private TreeNode nodeFunction; private TreeNode nodeParams; - private ReportSettings reportSettings; - private bool isFilled = false; + private ReportModel reportModel; + private bool isFilled ; #region Publics - public void Fill (ReportSettings reportSettings) { - - if (reportSettings == null) { - throw new ArgumentException("FieldsExplorer:Fill 'ReportSettings'"); - } - this.reportSettings = reportSettings; - this.Nodes.Clear(); - InitImageList(); - BuildNodes(); - this.FillTree(); - this.ExpandAll(); - isFilled = true; - } - - /// /// Clear the selected Section /// @@ -83,7 +68,6 @@ namespace SharpReportAddin { /// Remove the selected Node from Sorting or Grouping Collection /// public void ClearSelectedNode() { - System.Console.WriteLine("ClearSelectedNode"); if (this.SelectedNode != null) { TreeNode parent = this.SelectedNode.Parent; this.SelectedNode.Remove(); @@ -96,7 +80,6 @@ namespace SharpReportAddin { /// Toggle the SortDirection /// public void ToogleSortDirection () { - System.Console.WriteLine("Toggle SortDirection"); if (this.SelectedNode is ColumnsTreeNode) { ColumnsTreeNode cn = (ColumnsTreeNode)this.SelectedNode; if (cn.SortDirection == ListSortDirection.Ascending) { @@ -148,7 +131,6 @@ namespace SharpReportAddin { void TreeViewDragDrop (object sender,DragEventArgs e) { - System.Console.WriteLine("DragDrop"); if(e.Data.GetDataPresent("SharpReportAddin.ColumnsTreeNode", false)){ Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); @@ -168,12 +150,22 @@ namespace SharpReportAddin { CheckNode (dest); node.Nodes.Add(dest); NotifyReportView(); + this.OnViewSaving(this,EventArgs.Empty); } } } } + private void Fill () { + this.Nodes.Clear(); + InitImageList(); + BuildNodes(); + this.FillTree(); + this.ExpandAll(); + isFilled = true; + } + private bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) { if (sec.Nodes.Count > 0) { for (int i = 0;i < sec.Nodes.Count ;i++ ) { @@ -228,7 +220,6 @@ namespace SharpReportAddin { private void NotifyReportView() { if (this.isFilled) { if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) { - System.Console.WriteLine("NotifyReportView"); WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsDirty = true; } } @@ -240,13 +231,29 @@ namespace SharpReportAddin { if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null || WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent == null) { return; } - - if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) { - WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving -= new EventHandler (OnViewSaving); - WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving += new EventHandler (OnViewSaving); + WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving -= OnViewSaving; + WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving += OnViewSaving; + + PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FieldsExplorer)); + + SharpReportView v = + WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent + as SharpReportView; + + if (v != null) { + this.reportModel = v.ReportManager.BaseDesignControl.ReportModel; + if (this.reportModel != null) { + this.Fill(); + WorkbenchSingleton.Workbench.ShowPad(pad); + pad.BringPadToFront(); + } + + } else { + WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad(pad); } - } catch (Exception) { + } catch (Exception er) { + System.Console.WriteLine("\t{0}",er.Message); } } @@ -263,13 +270,13 @@ namespace SharpReportAddin { #region Build TreeControl private void UpdateSorting () { - this.reportSettings.SortColumnCollection.Clear(); + this.reportModel.ReportSettings.SortColumnCollection.Clear(); if (this.nodeSorting.Nodes.Count > 0) { SortColumn sc; AbstractColumn af; for (int i = 0;i < this.nodeSorting.Nodes.Count ;i++ ) { ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeSorting.Nodes[i]; - af = reportSettings.AvailableFieldsCollection.Find(cn.Text); + af = this.reportModel.ReportSettings.AvailableFieldsCollection.Find(cn.Text); if (af != null) { sc = new SortColumn (cn.Text, cn.SortDirection, @@ -279,35 +286,35 @@ namespace SharpReportAddin { cn.SortDirection, typeof(System.String)); } - reportSettings.SortColumnCollection.Add(sc); + this.reportModel.ReportSettings.SortColumnCollection.Add(sc); } } } private void UpdateGrouping () { - reportSettings.GroupColumnsCollection.Clear(); + this.reportModel.ReportSettings.GroupColumnsCollection.Clear(); if (this.nodeGrouping.Nodes.Count > 0) { GroupColumn gc; for (int i = 0;i < this.nodeGrouping.Nodes.Count ;i++ ) { ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeGrouping.Nodes[i]; gc = new GroupColumn (cn.Text,i,cn.SortDirection); - reportSettings.GroupColumnsCollection.Add(gc); + this.reportModel.ReportSettings.GroupColumnsCollection.Add(gc); } } } void SetAvailableFields () { try { - int avCount = reportSettings.AvailableFieldsCollection.Count; + int avCount = this.reportModel.ReportSettings.AvailableFieldsCollection.Count; for (int i = 0;i < avCount ;i++ ) { - AbstractColumn af = reportSettings.AvailableFieldsCollection[i]; + AbstractColumn af = this.reportModel.ReportSettings.AvailableFieldsCollection[i]; ColumnsTreeNode n = new ColumnsTreeNode(af.ColumnName); n.Tag = this.nodeAvailableFields; //we don't like ContextMenu here n.ContextmenuAddinTreePath = ""; - switch (this.reportSettings.CommandType) { + switch (this.reportModel.ReportSettings.CommandType) { case CommandType.Text:{ n.ImageIndex = 6; n.SelectedImageIndex = 6; @@ -336,8 +343,8 @@ namespace SharpReportAddin { void SetSortFields(){ try { ColumnsTreeNode node; - int scCount = reportSettings.SortColumnCollection.Count; - foreach (SortColumn sc in reportSettings.SortColumnCollection) { + int scCount = this.reportModel.ReportSettings.SortColumnCollection.Count; + foreach (SortColumn sc in this.reportModel.ReportSettings.SortColumnCollection) { node = new ColumnsTreeNode(sc.ColumnName,sc.SortDirection); if (node.SortDirection == ListSortDirection.Ascending) { node.ImageIndex = 4; @@ -355,9 +362,9 @@ namespace SharpReportAddin { void SetGroupFields(){ try { ColumnsTreeNode node; - int gcCount = reportSettings.GroupColumnsCollection.Count; + int gcCount = this.reportModel.ReportSettings.GroupColumnsCollection.Count; for (int i = 0;i < gcCount ;i++ ) { - GroupColumn gc = (GroupColumn)reportSettings.GroupColumnsCollection[i]; + GroupColumn gc = (GroupColumn)this.reportModel.ReportSettings.GroupColumnsCollection[i]; node = new ColumnsTreeNode(gc.ColumnName); if (node.SortDirection == ListSortDirection.Ascending) { node.ImageIndex = 4; @@ -373,43 +380,43 @@ namespace SharpReportAddin { } } - /* - void SetParamFields (SharpReportManager reportManager){ - try { - ColumnsTreeNode node; - int parCount = reportManager.SqlParametersCollection.Count; + void SetParamFields (){ + + ColumnsTreeNode node; + int parCount = this.reportModel.ReportSettings.SqlParametersCollection.Count; + if (parCount > 0) { for (int i = 0;i < parCount ;i++ ) { - SqlParameter par = (SqlParameter)reportManager.SqlParametersCollection[i]; + SqlParameter par = (SqlParameter)this.reportModel.ReportSettings.SqlParametersCollection[i]; node = new ColumnsTreeNode(par.ParameterName); node.Tag = par; node.SelectedImageIndex = 9; node.ImageIndex = 9; this.nodeParams.Nodes.Add (node); } - } catch (Exception) { - - } + } } - */ + void SetFunctions(){ - try { - - } catch (Exception) { - + ColumnsTreeNode node; + foreach (ReportSection section in this.reportModel.SectionCollection) { + foreach (BaseReportObject item in section.Items) { + BaseFunction func = item as BaseFunction; + if (func != null) { + node = new ColumnsTreeNode(func.Name); + this.nodeFunction.Nodes.Add(func.FriendlyName); + } + } } } + private void FillTree () { - if (this.reportSettings != null) { - BeginUpdate(); - SetAvailableFields(); - SetGroupFields(); - SetSortFields(); -// SetParamFields (); -// SetFunctions(); - EndUpdate(); - } else { - throw new SharpReportException("FiekldsExplorer:FillTree() No valid ReportSettings"); - } + this.BeginUpdate(); + SetAvailableFields(); + SetGroupFields(); + SetSortFields(); + SetParamFields (); + SetFunctions(); + this.EndUpdate(); } private const int folderClosed = 0; @@ -546,18 +553,19 @@ namespace SharpReportAddin { public FieldsExplorer() { - WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(OnWindowChange); + WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange; + LabelEdit = true; AllowDrop = true; HideSelection = false; Dock = DockStyle.Fill; Scrollable = true; LabelEdit = false; - MouseDown += new System.Windows.Forms.MouseEventHandler(this.TreeMouseDown); - this.ItemDrag += new ItemDragEventHandler (TreeViewItemDrag); - this.DragDrop += new DragEventHandler (TreeViewDragDrop); - this.DragOver += new DragEventHandler (TreeViewDragOver); + this.MouseDown += TreeMouseDown; + this.ItemDrag += TreeViewItemDrag; + this.DragDrop += TreeViewDragDrop; + this.DragOver += TreeViewDragOver; contentPanel.Controls.Add(this); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs index 63f5f21bbb..6abbb88389 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs @@ -8,14 +8,11 @@ // //------------------------------------------------------------------------------ - using System; using System.Windows.Forms; -//using SharpReportAddin; - /// -/// This Node represents th sections in the FieldsExplorer +/// This Node represents a sections in the FieldsExplorer /// like AvailableFields, Sorting etc. /// /// diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.addin b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.addin index 3d488bd813..ca687b1deb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.addin +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.addin @@ -33,12 +33,11 @@ - diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs index 2f31d728eb..b00fb989f3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs @@ -21,6 +21,8 @@ using System; using System.IO; using System.Windows.Forms; +using ICSharpCode.Core; + using SharpReportCore; /// /// Displaybinding for SharpReport @@ -42,7 +44,6 @@ namespace SharpReportAddin { cmd.Run(); view.FileName = view.DesignerControl.ReportModel.ReportSettings.FileName; view.UpdateView(true); - view.UpdateFieldsExplorer(); view.Selected(); return view; } catch (SharpReportException) { @@ -75,9 +76,9 @@ namespace SharpReportAddin { if (GlobalValues.IsValidPrinter() == true) { SharpReportView view = new SharpReportView(); try { + StatusBarService.SetMessage (String.Format("File : {0}",fileName)); view.Load (fileName); view.UpdateView (false); - view.UpdateFieldsExplorer(); view.Selected(); return view; } catch (Exception) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs index 6bebbc4064..c712337d33 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs @@ -55,8 +55,6 @@ namespace SharpReportAddin{ panel.AutoScroll = true; CreateTabControl(); BuildToolBarItems(); - base.UntitledName = GlobalValues.SharpReportPlainFileName; - base.FileName = GlobalValues.SharpReportPlainFileName; PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.Refresh(); } catch (Exception e) { @@ -306,10 +304,17 @@ namespace SharpReportAddin{ private void OnTabPageChanged (object sender, EventArgs e) { - string name = Path.GetFileName (base.FileName); - base.TitleName = name + "[" + tabControl.SelectedTab.Text + "]"; - System.Console.WriteLine(""); - System.Console.WriteLine("!! OnTabPageChange !!"); + + string name; + if (String.IsNullOrEmpty(base.FileName)) { + base.UntitledName = GlobalValues.SharpReportPlainFileName; + base.TitleName = GlobalValues.SharpReportPlainFileName; + base.FileName = GlobalValues.SharpReportPlainFileName; + name = base.TitleName; + } else { + name = Path.GetFileName (base.FileName); + } + base.TitleName = String.Format("{0} [{1}]",name,this.tabControl.SelectedTab.Text); switch (tabControl.SelectedIndex) { case 0 : break; @@ -329,24 +334,18 @@ namespace SharpReportAddin{ //Something was dropped on the designer private void OnItemDragDrop (object sender,ItemDragDropEventArgs e) { - System.Console.WriteLine("View:DragDrop"); base.IsDirty = true; - SharpReportAddin.Commands.SetFieldsExplorer uf = new SharpReportAddin.Commands.SetFieldsExplorer(); - uf.Run(); } public void OnPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e) { - System.Console.WriteLine("View:PorpChange"); base.IsDirty = true; } private void OnSettingsChanged (object sender,EventArgs e) { - System.Console.WriteLine("View.SettingsChange"); base.IsDirty = true; } private void OnModelFileNameChanged (object sender,EventArgs e) { - System.Console.WriteLine("View:filenamechange"); base.FileName = designerControl.ReportModel.ReportSettings.FileName; base.IsDirty = true; this.OnFileNameChanged(e); @@ -355,6 +354,12 @@ namespace SharpReportAddin{ private void OnObjectSelected (object sender,EventArgs e) { if (designerControl.ReportControl.SelectedObject != null) { +// BaseReportObject bro = designerControl.ReportControl.SelectedObject as BaseReportObject; +// +// if (bro != null) { +// string s = "{" + bro.Name + "}"; +// StatusBarService.SetMessage(s); +// } PropertyPad.Grid.SelectedObject = designerControl.ReportControl.SelectedObject; } } @@ -396,7 +401,6 @@ namespace SharpReportAddin{ /// /// If true, set the DirtyFlag and Fire the PropertyChanged Event public void UpdateView(bool setViewDirty) { - System.Console.WriteLine("UpdateView with {0}",setViewDirty); this.tabControl.SelectedIndex = 0; this.OnTabPageChanged(this,EventArgs.Empty); SetOnPropertyChangedEvents(); @@ -405,26 +409,6 @@ namespace SharpReportAddin{ } } - /// - /// We have to tell the FieldsdsExplorer that we have loaded or created a new report - /// - /// - public void UpdateFieldsExplorer() { - try { - Type type = typeof(FieldsExplorer); - SharpReportAddin.FieldsExplorer fe = (SharpReportAddin.FieldsExplorer)WorkbenchSingleton.Workbench.GetPad(type).PadContent; - - if (fe != null) { - this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection; - fe.Fill(designerControl.ReportModel.ReportSettings); - } else { - MessageService.ShowError ("SharpReportView:SetFieldExplorer Unable to create FieldsExplorer"); - } - - } catch (Exception e) { - MessageService.ShowError (e); - } - } #endregion @@ -489,16 +473,6 @@ namespace SharpReportAddin{ } } - public override void Deselected(){ - base.Deselected(); - System.Console.WriteLine("Deselected"); - } - - public override void Selected(){ - base.Selected(); - System.Console.WriteLine("Selected"); - } - public override void Save() { this.Save (designerControl.ReportModel.ReportSettings.FileName); @@ -522,12 +496,15 @@ namespace SharpReportAddin{ public override void Load(string fileName){ try { designerControl.ReportControl.ObjectSelected -= new SelectedEventHandler (OnObjectSelected); + reportManager.LoadFromFile (fileName); base.FileName = fileName; designerControl.ReportModel.ReportSettings.FileName = fileName; designerControl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected); PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings; PropertyPad.Grid.Refresh(); + this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection; + } catch (Exception e) { MessageService.ShowError(e.Message); throw ; @@ -555,8 +532,6 @@ namespace SharpReportAddin{ #region ICSharpCode.SharpDevelop.Gui.IPrintable interface implementation public System.Drawing.Printing.PrintDocument PrintDocument { get { - System.Console.WriteLine(""); - System.Console.WriteLine("!! PrintDocument !!"); AbstractRenderer renderer; if (this.designerControl.ReportModel.DataModel == GlobalEnums.enmPushPullModel.PushData) { renderer = reportManager.GetRendererForPushDataReports(this.designerControl.ReportModel, diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs index 190bd091f3..d28b890645 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs @@ -17,20 +17,28 @@ namespace SharpReportCore { /// BaseClass for all Functions /// /// - /// created by - Forstmeier Helmut + /// created by - Forstmeier Peter /// created on - 05.09.2005 22:25:18 /// public class BaseFunction : SharpReportCore.BaseTextItem { - -// private string formatString = String.Empty; + string friendlyName; - public BaseFunction():base() { } + public BaseFunction(string friendlyName) + { + this.friendlyName = friendlyName; + } #region properties + public virtual string FriendlyName { + get { + return friendlyName; + } + } + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs index 5d44d6de0e..72652b4127 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs @@ -34,8 +34,9 @@ namespace SharpReportCore { protected SizeF MeasureReportItem (SharpReportCore.ReportPageEventArgs rpea,IItemRenderer item) { if (item == null) { - throw new ArgumentException(this.Name); + throw new ArgumentNullException("item","BaseGraphicItem"); } + return new SizeF (item.Size.Width,item.Size.Height); } @@ -68,7 +69,6 @@ namespace SharpReportCore { } set { dashStyle = value; -// base.NotifyPropertyChanged("FormatString",true); base.NotifyPropertyChanged("FormatString"); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index b8c8512b7d..3c1c699305 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -34,6 +34,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea","BasetextItem:Render"); + } base.Render(rpea); RectangleF rect = PrepareRectangle (rpea,this.Text); PrintTheStuff (rpea,this.Text,rect); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs index fb9b8502b5..8036e866bc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs @@ -10,27 +10,30 @@ using System; +using System.Globalization; using System.ComponentModel; using System.Drawing; - /// - /// BaseClass for PageNumbers - /// - /// - /// created by - Forstmeier Peter - /// created on - 12.09.2005 22:34:54 - /// +/// +/// BaseClass for PageNumbers +/// +/// +/// created by - Forstmeier Peter +/// created on - 12.09.2005 22:34:54 +/// + namespace SharpReportCore { public class BasePageNumber : BaseFunction { + static string fnName = "PageNumber"; - public BasePageNumber():base() { + public BasePageNumber():base(fnName) { } public override void Render(ReportPageEventArgs e) { base.Render(e); - string formattedString = base.FireFormatOutput(e.PageNumber.ToString(), + string formattedString = base.FireFormatOutput(e.PageNumber.ToString(CultureInfo.InvariantCulture), base.FormatString,""); @@ -42,7 +45,7 @@ namespace SharpReportCore { fmt.Alignment = StringAlignment.Far; fmt.LineAlignment = StringAlignment.Near; - e.PrintPageEventArgs.Graphics.DrawString(e.PageNumber.ToString(), + e.PrintPageEventArgs.Graphics.DrawString(e.PageNumber.ToString(CultureInfo.InvariantCulture), this.Font, Brushes.Black, rect, @@ -52,9 +55,16 @@ namespace SharpReportCore { } public override string ToString() { - return "BasePageNumber"; + return "PageNumber"; + } + + public override string FriendlyName { + get { + return base.FriendlyName; + } } + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs index 547497083b..5346fa926a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs @@ -20,8 +20,9 @@ using System.Globalization; namespace SharpReportCore { public class BaseToday : BaseFunction { - - public BaseToday() { + static string fnName = "Date"; + public BaseToday():base(fnName) { + } public override void Render(ReportPageEventArgs e) { @@ -50,7 +51,7 @@ namespace SharpReportCore { } public override string ToString() { - return "BaseToday"; + return "Today"; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs index 27611b2bbb..5b12618f7c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs @@ -11,7 +11,7 @@ using System; using System.Drawing; /// -/// TODO - Add class summary +///This class drwas a Circle /// /// /// created by - Forstmeier Peter diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs index 3cdf356038..eab504dcb0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs @@ -9,6 +9,7 @@ //------------------------------------------------------------------------------ using System; +using System.Globalization; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; @@ -42,7 +43,8 @@ namespace SharpReportCore { this.image = null; this.image = Image.FromFile (fName); if (image == null) { - string str = String.Format("Unable to Load {0}",fName); + string str = String.Format(CultureInfo.InvariantCulture, + "Unable to Load {0}",fName); throw new ApplicationException(str); } } catch (Exception) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 1b393b80fe..e87a7bddff 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -16,7 +16,7 @@ using System.ComponentModel; using System.Drawing; /// -/// TODO - Add class summary +/// This class draws a Rectangle /// /// /// created by - Forstmeier Peter diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs index b6f28b06ab..a047f14c97 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs @@ -87,7 +87,7 @@ namespace SharpReportCore { this.graphicsUnit = GraphicsUnit.Millimeter; } - private string MakePoperFilename (string file) { + private static string MakePoperFilename (string file) { if (file.EndsWith (GlobalValues.SharpReportExtension)) { return file; @@ -112,13 +112,13 @@ namespace SharpReportCore { } #region Properties - protected string DefaultReportName { + protected static string DefaultReportName { get { return defaultReportName; } } - protected string DefaultFileName { + protected static string DefaultFileName { get { return GlobalValues.SharpReportPlainFileName; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Dialogs/PreviewControl.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Dialogs/PreviewControl.cs index 14169e1209..1e2ede7cac 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Dialogs/PreviewControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Dialogs/PreviewControl.cs @@ -33,11 +33,14 @@ namespace SharpReportCore{ } public void ShowPreview (AbstractRenderer renderer,double zoomFaktor,bool standAlone) { + if (renderer == null) { + throw new ArgumentNullException("renderer"); + } if (renderer.Cancel == false) { if (standAlone) { - this.ShowPreviewWithUserControl (renderer,1.5); + this.ShowPreviewWithUserControl (renderer,zoomFaktor); } else { - ShowPreviewWithDialog(renderer,1.5); + ShowPreviewWithDialog(renderer,zoomFaktor); } } } @@ -46,20 +49,6 @@ namespace SharpReportCore{ System.Drawing.Printing.PrintDocument doc = renderer.ReportDocument; - /* - System.Drawing.Printing.PrintDocument doc = - new System.Drawing.Printing.PrintDocument(); - - doc.BeginPrint += - new PrintEventHandler (renderer.ReportDocument.ReportDocumentBeginPrint); - doc.PrintPage += - new System.Drawing.Printing.PrintPageEventHandler(renderer.ReportDocument.ReportDocumentPrintPage); - doc.EndPrint += - new PrintEventHandler (renderer.ReportDocument.ReportDocumentEndPrint); - doc.QueryPageSettings += - new QueryPageSettingsEventHandler (renderer.ReportDocument.ReportDocumentQueryPage); - System.Console.WriteLine("\t All events are set"); - */ printPreviewControl1.Document = null; printPreviewControl1.Document = doc; @@ -69,7 +58,7 @@ namespace SharpReportCore{ } private void ShowPreviewWithDialog (AbstractRenderer renderer,double zoomFaktor) { - System.Console.WriteLine("PaintArea:WithDialog"); + System.Drawing.Printing.PrintDocument doc = renderer.ReportDocument; previewDlg.Document = doc; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 024b51161e..c5b5053fee 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -21,6 +21,7 @@ using System; +using System.Globalization; using System.Windows.Forms; using System.Drawing; using System.Drawing.Printing; @@ -89,7 +90,7 @@ namespace SharpReportCore { int to = rpea.PrintPageEventArgs.MarginBounds.Height ; if (rpea.PageNumber ==1) { - to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportHeader)].Size.Height; + to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportHeader,CultureInfo.InvariantCulture)].Size.Height; } to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader)].Size.Height; @@ -111,7 +112,7 @@ namespace SharpReportCore { /// /// protected Rectangle DetailRectangle (ReportPageEventArgs e) { - sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail); + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail,CultureInfo.InvariantCulture); Rectangle rect = new Rectangle (e.PrintPageEventArgs.MarginBounds.Left, CurrentSection.SectionOffset , @@ -130,7 +131,7 @@ namespace SharpReportCore { float offset = 0; BaseSection section = null; if (e.PageNumber == 1) { - sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportHeader); + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportHeader,CultureInfo.InvariantCulture); section = CurrentSection; section.SectionOffset = reportSettings.DefaultMargins.Top; @@ -150,7 +151,7 @@ namespace SharpReportCore { protected PointF DrawPageheader (PointF startat,ReportPageEventArgs e) { float offset = 0F; BaseSection section = null; - sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader); + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader,CultureInfo.InvariantCulture); section = CurrentSection; if (e.PageNumber == 1) { @@ -168,8 +169,6 @@ namespace SharpReportCore { protected int RenderSection (BaseSection section,ReportPageEventArgs e) { Point drawPoint = new Point(0,0); if (section.Visible){ - -// section.Render (reportSettings,e); section.Render (e); foreach (BaseReportItem rItem in section.Items) { @@ -306,7 +305,7 @@ namespace SharpReportCore { } protected virtual void BeginPrintPage (object sender,ReportPageEventArgs e) { - SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader); + SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader,CultureInfo.InvariantCulture); } protected virtual void PrintBodyStart (object sender,ReportPageEventArgs e) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs index 1c4d8f1b3b..dc9e6509a8 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs @@ -18,19 +18,19 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Peter Forstmeier (Peter.Forstmeier@t-online.de) +using System; +using System.Globalization; +//using System.Windows.Forms; +/// +/// This Class handles the formatting of Output Values depending on there +/// Type and DbValue +/// +/// +/// created by - Forstmeier Peter +/// created on - 30.03.2005 09:14:20 +/// namespace SharpReportCore{ - using System; - using System.Globalization; - using System.Windows.Forms; - /// - /// This Class handles the formatting of Output Values depending on there - /// Type and DbValue - /// - /// - /// created by - Forstmeier Peter - /// created on - 30.03.2005 09:14:20 - /// public class DefaultFormatter : AbstractFormatter { @@ -44,35 +44,31 @@ namespace SharpReportCore{ /// public string FormatItem (BaseDataItem item) { string retValue = String.Empty; - try { - switch (item.DataType) { + + switch (item.DataType) { - case "System.DateTime" : - retValue = DateValues(item.DbValue,item.FormatString); - break; - - case "System.Int16": - retValue = IntegerValues ("16",item.DbValue,item.FormatString); - break; - - case "System.Int32" : - retValue = IntegerValues ("32",item.DbValue,item.FormatString); - break; - case "System.Decimal": - retValue = DecimalValues (item.DbValue,item.FormatString); - break; + case "System.DateTime" : + retValue = DateValues(item.DbValue,item.FormatString); + break; + + case "System.Int16": + retValue = IntegerValues ("16",item.DbValue,item.FormatString); + break; + + case "System.Int32" : + retValue = IntegerValues ("32",item.DbValue,item.FormatString); + break; + case "System.Decimal": + retValue = DecimalValues (item.DbValue,item.FormatString); + break; - case "System.Boolean": - retValue = BoolValue (item.DbValue,item.FormatString); - break; - default: - retValue = item.DbValue; - break; - } - } catch (Exception) { - throw ; + case "System.Boolean": + retValue = BoolValue (item.DbValue,item.FormatString); + break; + default: + retValue = item.DbValue; + break; } - return retValue; } @@ -83,12 +79,11 @@ namespace SharpReportCore{ if (base.CheckValue (toFormat)) { try { bool b = bool.Parse (toFormat); -// bool b = Convert.ToBoolean(toFormat,CultureInfo.CurrentCulture); str = b.ToString (CultureInfo.CurrentCulture); - } catch (Exception e) { - string s = String.Format("\tBool Value < {0} > {1}",toFormat,e.Message); - System.Console.WriteLine("\t\t{0}",s); + } catch (System.FormatException) { +// string s = String.Format("\tBool Value < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t\t{0}",s); } } } else { @@ -108,28 +103,25 @@ namespace SharpReportCore{ number = Int16.Parse (toFormat, System.Globalization.NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat); -// number = Convert.ToInt16 (toFormat,NumberFormatInfo.CurrentInfo); break; case "32" : number = Int32.Parse (toFormat, System.Globalization.NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat); - -// number = Convert.ToInt32 (toFormat,NumberFormatInfo.CurrentInfo); break; default: throw new ArgumentException("DefaultFormater:IntegerValues Unknown intType "); } - str = number.ToString (format); + str = number.ToString (format,CultureInfo.CurrentCulture); - } catch (Exception e) { - string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); - System.Console.WriteLine("\t{0}",s); + } catch (System.FormatException) { +// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t{0}",s); } return str; } else { - str = (0.0M).ToString(); + str = (0.0M).ToString(CultureInfo.CurrentCulture); } } else { @@ -147,17 +139,15 @@ namespace SharpReportCore{ decimal dec = Decimal.Parse(toFormat, System.Globalization.NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat); + str = dec.ToString (format,CultureInfo.CurrentCulture); -// decimal dec = Convert.ToDecimal (toFormat,NumberFormatInfo.InvariantInfo); - str = dec.ToString (format); - - } catch (Exception e) { - string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); - System.Console.WriteLine("\t{0}",s); + } catch (System.FormatException) { +// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t{0}",s); } return str; } else { - str = (0.0M).ToString(); + str = (0.0M).ToString(CultureInfo.CurrentCulture); } } else { @@ -176,9 +166,9 @@ namespace SharpReportCore{ DateTimeFormatInfo.CurrentInfo); return str.Trim(); - } catch (Exception e) { - string s = String.Format("< {0} > {1}",toFormat,e.Message); - System.Console.WriteLine("\t\tDateValue {0}",s); + } catch (System.FormatException) { +// string s = String.Format("< {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t\tDateValue {0}",s); } } else { return toFormat.Trim(); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index 4a2ae2704b..4ad49caf41 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -20,10 +20,10 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; -using System.Drawing.Printing; -using System.Windows.Forms; using System.Data; using System.Data.OleDb; +using System.Drawing.Printing; +using System.Windows.Forms; using SharpReportCore; @@ -55,10 +55,9 @@ namespace SharpReportCore { #region ParameterHandling private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) { - System.Console.WriteLine("Engine"); if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) { if (this.connectionObject == null) { - System.Console.WriteLine("\t look for ConStr"); + if (model.ReportSettings.ConnectionString != "") { this.connectionObject = new ConnectionObject (model.ReportSettings.ConnectionString,"",""); } @@ -67,7 +66,6 @@ namespace SharpReportCore { this.connectionObject = reportParameters.ConnectionObject; } - if (this.connectionObject.Connection != null) { return true; } else { @@ -93,9 +91,7 @@ namespace SharpReportCore { } - - - + void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) { if ((sqlParams == null)||(sqlParams.Count == 0)) { return; @@ -104,7 +100,7 @@ namespace SharpReportCore { model.ReportSettings.SqlParametersCollection.AddRange(sqlParams); } - void SetCustomSorting (ReportModel model,ColumnCollection sortParams) { + private static void SetCustomSorting (ReportModel model,ColumnCollection sortParams) { if ((sortParams == null)||(sortParams.Count == 0)) { return; } @@ -125,7 +121,7 @@ namespace SharpReportCore { #endregion #region Setup for print/preview - private bool CheckForPushModel (ReportModel model) { + private static bool CheckForPushModel (ReportModel model) { if (model.ReportSettings.DataModel == GlobalEnums.enmPushPullModel.PushData) { return true; } else { @@ -159,7 +155,7 @@ namespace SharpReportCore { } catch (System.Data.OleDb.OleDbException e) { - MessageBox.Show (e.Message,"SharpReportEngine:SetupDataContainer"); + throw e; } catch (Exception) { throw; @@ -171,19 +167,18 @@ namespace SharpReportCore { protected ColumnCollection CollectFieldsFromModel(ReportModel model){ - ColumnCollection col = new ColumnCollection(); if (model == null) { - return col; + throw new ArgumentNullException("model"); } + ColumnCollection col = new ColumnCollection(); + foreach (BaseSection section in model.SectionCollection){ for (int i = 0;i < section.Items.Count ;i ++ ) { IItemRenderer item = section.Items[i]; BaseDataItem baseItem = item as BaseDataItem; if (baseItem != null) { col.Add(new AbstractColumn(baseItem.ColumnName)); - } - } } return col; @@ -234,7 +229,6 @@ namespace SharpReportCore { protected SharpReportCore.AbstractRenderer SetupPushDataRenderer (ReportModel model, DataTable dataTable) { - System.Console.WriteLine("SetupPushDataRenderer with {0}",dataTable.Rows.Count); if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.DataReport) { throw new ArgumentException("SetupPushDataRenderer "); @@ -352,26 +346,20 @@ namespace SharpReportCore { } ReportModel model = null; AbstractRenderer renderer = null; -// PrintDocument doc = null; try { model = ModelFromFile (fileName); - if (!this.CheckForPushModel(model)) { + if (!CheckForPushModel(model)) { throw new SharpReportException ("PrintPushdataReport: No valid ReportModel"); } - renderer = SetupPushDataRenderer (model,dataTable); + renderer = this.SetupPushDataRenderer (model,dataTable); if (renderer != null) { PreviewControl.ShowPreview(renderer,1.5,false); } -// if (renderer.Cancel == false) { -// doc = renderer.ReportDocument; -// PreviewControl.ShowPreviewWithDialog (renderer,1.5); -// } } catch (Exception) { } - } #endregion @@ -454,7 +442,7 @@ namespace SharpReportCore { AbstractRenderer renderer = null; try { model = ModelFromFile (fileName); - if (!this.CheckForPushModel(model)) { + if (!CheckForPushModel(model)) { throw new SharpReportException ("PrintPushdataReport: No valid ReportModel"); } @@ -475,21 +463,21 @@ namespace SharpReportCore { /// public void PrintPushDataReport (string fileName,DataTable dataTable) { if (fileName.Length == 0) { - throw new ArgumentException("PreviewPushDataReport FileName"); + throw new ArgumentNullException("fileName"); } if (dataTable == null) { - throw new ArgumentNullException("PreviewPushDataReport DataTable"); + throw new ArgumentNullException("dataTable"); } ReportModel model = null; AbstractRenderer renderer = null; try { model = ModelFromFile (fileName); - if (!this.CheckForPushModel(model)) { + if (!CheckForPushModel(model)) { throw new SharpReportException ("PrintPushdataReport: No valid ReportModel"); } - renderer = SetupPushDataRenderer (model,dataTable); + renderer = this.SetupPushDataRenderer (model,dataTable); this.ReportToPrinter(renderer,model); } catch (Exception) { @@ -512,7 +500,7 @@ namespace SharpReportCore { protected ReportModel ModelFromFile (string fileName) { if (fileName.Length == 0) { - throw new ArgumentException("ModelfromFile:FileName"); + throw new ArgumentNullException("fileName"); } try {