Click here to Skip to main content
15,891,136 members
Articles / Programming Languages / C#

EasiReports

Rate me:
Please Sign up or sign in to vote.
4.87/5 (64 votes)
13 Feb 2006CPOL6 min read 481.1K   9.7K   219  
A library to add reports to your application.
using System;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Diagnostics;

using EasiReports.Report;

using Common;

namespace EasiReports.Algorithms
{
	/// <summary>
	/// Summary description for AlgorithmsMemoryAssembly.
	/// </summary>
	[ Serializable ]
	internal abstract class AlgorithmsMemoryAssembly : MemoryAssembly, ISerializable
	{
		public AlgorithmsMemoryAssembly( MemoryLanguage language, string displayName ) : base( language, displayName )
		{
			AddAssemblyReference( ".\\EasiReports.dll" );
		}

		public AlgorithmsMemoryAssembly( AlgorithmsMemoryAssembly o ) : base( o )
		{
//			AddAssemblyReference( "EasiReports.dll" );
		}

//-----------------------------------------------------------------------------
// Serialization

		// Save
		/// <summary>Populates a SerializationInfo with the data needed to serialize the target object.</summary>
		/// <param name="info">The SerializationInfo to populate with data.</param>
		/// <param name="context">The destination for this serialization.</param>
		/// <remarks>
		/// <p>This method is called during serialization.</p>
		/// <p>Do not call this method directly.</p>
		/// </remarks>
		[ SecurityPermission( SecurityAction.Demand, SerializationFormatter = true ) ]
		public override void GetObjectData( SerializationInfo info, StreamingContext context )
		{
			SerializationHelper.WriteLine( "AlgorithmsMemoryAssemblyVersion" );

			base.GetObjectData( info, context );

			try
			{
				info.AddValue( "AlgorithmsMemoryAssemblyVersion" , 2     );
			}
			catch ( SerializationException e )
			{
				MessageBox.Show( e.ToString() );
			}
		}

		// Load
		/// <summary>Initializes a new instance of the class during deserialization.</summary>
		/// <param name="info">The SerializationInfo populated with data.</param>
		/// <param name="context">The source for this serialization.</param>
		/// <remarks>
		/// <p>This method is called during deserialization.</p>
		/// <p>Do not call this method directly.</p>
		/// </remarks>
		protected AlgorithmsMemoryAssembly( SerializationInfo info, StreamingContext context ) : base( info, context )
		{
			try
			{
				int iVersion = 0;

				if ( SerializationHelper.IsPresent( info, "AlgorithmsMemoryAssemblyVersion" ) )
					iVersion = info.GetInt32( "AlgorithmsMemoryAssemblyVersion" );

				if ( iVersion < 2 )
				{
					AddAssemblyReference( ".\\EasiReports.dll" );
				}
			}
			catch ( SerializationException e )
			{
				MessageBox.Show( e.ToString() );
			}
		}

//-----------------------------------------------------------------------------
// 

		protected static string InsertCode( ref string sCode, int iLocation, string sNew )
		{
//			while ( sCode[ iLocation ] != '\n' && iLocation > 0 ) iLocation--;
//			if ( iLocation > 0 ) iLocation++;
//
//			StringBuilder sb = new StringBuilder( sCode );
//			sb.Insert( iLocation, sNew );
//			sCode = sb.ToString();

			return sNew;
		}

//-----------------------------------------------------------------------------

//		public string Name( string method )
//		{
//			return Table + "." + method;
//		}

//		public abstract string Table { get; }

//		public abstract string Class { get; }

//		public abstract string TwoLetterLanguage { get; }

//		public abstract Language Language { get; }

//-----------------------------------------------------------------------------

		public abstract string InsertAlgorithmData                ( ref string sCode, int iLocation, string sResultType, string sAlgorithmName );
		public abstract string InsertAlgorithmFormatSection       ( ref string sCode, int iLocation, string sAlgorithmName );
		public abstract string InsertAlgorithmFormatControl       ( ref string sCode, int iLocation, string sAlgorithmName );
		public abstract string InsertAlgorithmOnSetDataSource     ( ref string sCode, int iLocation );
		public abstract string InsertAlgorithmOnQueryPageSettings ( ref string sCode, int iLocation );
		public abstract string InsertAlgorithmOnBeginPrint        ( ref string sCode, int iLocation );
		public abstract string InsertAlgorithmOnEndPrint          ( ref string sCode, int iLocation );
		
		public abstract string InsertVariableData                 ( ref string sCode, int iLocation, Type resultType, string sVariableName, string name );
		public abstract string InsertVariableAggregate            ( ref string sCode, int iLocation, Type resultType, string sVariableName, string name, AggregateFunction eAggregate, int iLevel );

//-----------------------------------------------------------------------------

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
I discovered C# and .NET 1.0 Beta 1 in late 2000 and loved them immediately.
I have been writing software professionally in C# ever since

In real life, I have spent 3 years travelling abroad,
I have held a UK Private Pilots Licence for 20 years,
and I am a PADI Divemaster.

I now live near idyllic Bournemouth in England.

I can work 'virtually' anywhere!

Comments and Discussions