Browse Source

Sample showing Report with IList<T> as DataSource

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5382 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 16 years ago
parent
commit
e47f65dc46
  1. 133
      samples/SharpDevelopReports/src/ReportSamples/ContributorsList.cs
  2. 26
      samples/SharpDevelopReports/src/ReportSamples/JointCopyright.cs
  3. 2
      samples/SharpDevelopReports/src/ReportSamples/MainForm.Designer.cs
  4. 12
      samples/SharpDevelopReports/src/ReportSamples/MainForm.cs
  5. 2
      samples/SharpDevelopReports/src/ReportSamples/ReportSamples.csproj
  6. 79
      samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs
  7. 72
      samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs
  8. 1
      samples/SharpDevelopReports/src/SharpReportSamples/SharpReportSamples.csproj

133
samples/SharpDevelopReports/src/ReportSamples/ContributorsList.cs

@ -1,133 +0,0 @@ @@ -1,133 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Peter Forstmeier" email="peter.forstmeier@t-online.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.Reports.Core;
namespace ReportSamples
{
/// <summary>
/// Description of ContributorsList.
/// </summary>
public class ContributorsList:BaseSample
{
ContributorCollection contributorCollection;
public ContributorsList()
{
}
public override void Run()
{
base.Run();
if (!String.IsNullOrEmpty(base.ReportName)) {
this.contributorCollection = CreateContributorsList();
}
}
private void PushPrinting (object sender,SectionRenderEventArgs e) {
switch (e.CurrentSection) {
case GlobalEnums.ReportSection.ReportHeader:
break;
case GlobalEnums.ReportSection.ReportPageHeader:
break;
case GlobalEnums.ReportSection.ReportDetail:
BaseRowItem ri = e.Section.Items[0] as BaseRowItem;
// if (ri != null) {
// BaseDataItem r = (BaseDataItem)ri.Items.Find("unbound1");
// if (r != null) {
// System.Console.WriteLine("ubound1");
//
// }
// }
break;
case GlobalEnums.ReportSection.ReportPageFooter:
break;
case GlobalEnums.ReportSection.ReportFooter:
break;
default:
break;
}
}
public ContributorCollection ContributorCollection {
get { return contributorCollection; }
}
private ContributorCollection CreateContributorsList () {
ContributorCollection list = new ContributorCollection();
list.Add(new Contributor("Christoph","Wille","Senior Project Wrangler"));
list.Add(new Contributor("Bernhard","Spuida","Senior Project Wrangler"));
list.Add(new Contributor("Daniel","Grunwald","Technical Lead"));
list.Add(new Contributor("Matt","Ward","NUnit"));
list.Add(new Contributor("David","Srbecky","Debugger"));
list.Add(new Contributor("Peter","Forstmeier","SharpDevelop.Reports"));
list.Add(new Contributor("Alexander","Zeitler","SharpDevelop.Reports"));
list.Add(new Contributor("Markus","Palme","Prg."));
list.Add(new Contributor("Georg","Brandl","Prg."));
list.Add(new Contributor("Roman","Taranchenko",""));
list.Add(new Contributor("Denis","Erchoff",""));
list.Add(new Contributor("Ifko","Kovacka",""));
list.Add(new Contributor("Nathan","Allen",""));
list.Add(new Contributor("Dickon","Field","DBTools"));
list.Add(new Contributor("Troy","Simpson","Prg."));
list.Add(new Contributor("David","Alpert","Prg."));
return list;
}
}
public class Contributor {
string last;
string first;
string job;
public Contributor(string last, string first,string job)
{
this.last = last;
this.first = first;
this.job = job;
}
public string Last {
get {
return last;
}
}
public string First {
get {
return first;
}
}
public string Job {
get {
return job;
}
}
}
public class ContributorCollection: List<Contributor>{
}
}

26
samples/SharpDevelopReports/src/ReportSamples/JointCopyright.cs

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Forstmeier
* Datum: 03.05.2007
* Zeit: 09:27
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Windows.Forms;
namespace ReportSamples
{
/// <summary>
/// Description of JointCopyright.
/// </summary>
public class JointCopyright:BaseSample
{
public JointCopyright():base()
{
base.Run();
}
}
}

2
samples/SharpDevelopReports/src/ReportSamples/MainForm.Designer.cs generated

@ -175,7 +175,7 @@ namespace ReportSamples @@ -175,7 +175,7 @@ namespace ReportSamples
this.contributorsListToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.contributorsListToolStripMenuItem.Text = "Contributor\'s List";
this.contributorsListToolStripMenuItem.ToolTipText = "Customized, draw a frame on every second row";
this.contributorsListToolStripMenuItem.Click += new System.EventHandler(this.ContributorsListClick);
// this.contributorsListToolStripMenuItem.Click += new System.EventHandler(this.ContributorsListClick);
//
// customizedToolStripMenuItem
//

12
samples/SharpDevelopReports/src/ReportSamples/MainForm.cs

@ -259,17 +259,7 @@ namespace ReportSamples @@ -259,17 +259,7 @@ namespace ReportSamples
#region standart Contributors
void ContributorsListClick(object sender, EventArgs e)
{
/*
ContributorsList conReport = new ContributorsList();
conReport.Run();
this.engine = conReport.Engine;
this.DisplayContributors(conReport.ReportName,
ReportEngine.LoadReportModel(conReport.ReportName),
conReport.ContributorCollection);
*/
}
/*
void DisplayContributors (string fileName,ReportModel model,IList list)

2
samples/SharpDevelopReports/src/ReportSamples/ReportSamples.csproj

@ -45,11 +45,9 @@ @@ -45,11 +45,9 @@
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="BaseSample.cs" />
<Compile Include="ContributorsList.cs" />
<Compile Include="EmployeesHireDate.cs" />
<Compile Include="EmployeesPushModel.cs" />
<Compile Include="EventLogger.cs" />
<Compile Include="JointCopyright.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>

79
samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Peter Forstmeier
* Datum: 07.01.2010
* Zeit: 19:46
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Collections.Generic;
using ICSharpCode.Reports.Core;
namespace SharpReportSamples
{
/// <summary>
/// Description of ContributorsList.
/// </summary>
public class ContributorsReportData
{
public static ContributorCollection CreateContributorsList () {
ContributorCollection list = new ContributorCollection();
list.Add(new Contributor("Christoph","Wille","Senior Project Wrangler"));
list.Add(new Contributor("Bernhard","Spuida","Senior Project Wrangler"));
list.Add(new Contributor("Daniel","Grunwald","Technical Lead"));
list.Add(new Contributor("Matt","Ward","NUnit"));
list.Add(new Contributor("David","Srbecky","Debugger"));
list.Add(new Contributor("Peter","Forstmeier","SharpDevelop.Reports"));
list.Add(new Contributor("Markus","Palme","Prg."));
list.Add(new Contributor("Georg","Brandl","Prg."));
list.Add(new Contributor("Roman","Taranchenko",""));
list.Add(new Contributor("Denis","Erchoff",""));
list.Add(new Contributor("Ifko","Kovacka",""));
list.Add(new Contributor("Nathan","Allen",""));
list.Add(new Contributor("Troy","Simpson","Prg."));
list.Add(new Contributor("David","Alpert","Prg."));
return list;
}
}
public class Contributor {
string last;
string first;
string job;
public Contributor(string last, string first,string job)
{
this.last = last;
this.first = first;
this.job = job;
}
public string Last {
get {
return last;
}
}
public string First {
get {
return first;
}
}
public string Job {
get {
return job;
}
}
}
public class ContributorCollection: List<Contributor>{
}
}

72
samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs

@ -89,17 +89,74 @@ namespace SharpReportSamples @@ -89,17 +89,74 @@ namespace SharpReportSamples
private void RunStandardReport(string reportName)
{
ReportParameters parameters = ReportEngine.LoadParameters(reportName);
if ((parameters != null)&& (parameters.SqlParameters.Count > 0)){
parameters.SqlParameters[0].ParameterValue = "I'm the Parameter";
string s = Path.GetFileNameWithoutExtension(reportName);
if (s == "ContributorsList" ) {
this.RunContributors(reportName);
} else {
ReportParameters parameters = ReportEngine.LoadParameters(reportName);
if ((parameters != null)&& (parameters.SqlParameters.Count > 0)){
parameters.SqlParameters[0].ParameterValue = "I'm the Parameter";
}
this.previewControl1.SetupAsynchron(reportName,parameters);
}
}
#region Contributors
//
private void RunContributors (string fileName)
{
ReportModel model = ReportEngine.LoadReportModel(fileName);
ReportEngine engine = new ReportEngine();
engine.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
// Both variable declarations are valid
this.previewControl1.SetupAsynchron(reportName,parameters);
ContributorCollection list = ContributorsReportData.CreateContributorsList();
IDataManager dm = DataManager.CreateInstance(list,model.ReportSettings);
// List<Contributor> list = ContributorsReportData.CreateContributorsList();
// IDataManager dm = DataManager.CreateInstance(list,model.ReportSettings);
this.previewControl1.SetupAsynchron(model,dm);
}
// FileAccess: D:\Reporting3.0_branches\SharpDevelop\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Core.dll
// hint : ..\..\..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Core.dl
private void PushPrinting (object sender,SectionRenderEventArgs e) {
switch (e.CurrentSection) {
case GlobalEnums.ReportSection.ReportHeader:
break;
case GlobalEnums.ReportSection.ReportPageHeader:
break;
case GlobalEnums.ReportSection.ReportDetail:
BaseRowItem ri = e.Section.Items[0] as BaseRowItem;
// if (ri != null) {
// BaseDataItem r = (BaseDataItem)ri.Items.Find("unbound1");
// if (r != null) {
// System.Console.WriteLine("ubound1");
//
// }
// }
break;
case GlobalEnums.ReportSection.ReportPageFooter:
break;
case GlobalEnums.ReportSection.ReportFooter:
break;
default:
break;
}
}
#endregion
private void SelectReport ()
@ -108,6 +165,7 @@ namespace SharpReportSamples @@ -108,6 +165,7 @@ namespace SharpReportSamples
if ((selectedNode == null)|| (selectedNode.Tag == null)) {
return;
}
if (!String.IsNullOrEmpty(selectedNode.Tag.ToString())) {
if (selectedNode.Parent == this.pushNode) {
MessageBox.Show("PushModel reports not implemented yet");

1
samples/SharpDevelopReports/src/SharpReportSamples/SharpReportSamples.csproj

@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ContributorsList.cs" />
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>

Loading…
Cancel
Save