예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <param name="list"></param>
        /// <param name="reportParameters"></param>
        /// <returns></returns>
        public static IReportCreator CreatePageBuilder(IReportModel reportModel,
                                                       IList list,
                                                       ReportParameters reportParameters)
        {
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            ReportEngine.CheckForParameters(reportModel, reportParameters);
            IDataManager dataMan = DataManager.CreateInstance(list, reportModel.ReportSettings);

            if (dataMan != null)
            {
                Layouter layouter = new Layouter();
                return(DataPageBuilder.CreateInstance(reportModel, dataMan, layouter));
            }
            else
            {
                throw new MissingDataManagerException();
            }
        }
예제 #2
0
        public static IDataManager CreateDataManager(IReportModel reportModel, ReportParameters reportParameters)
        {
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            IDataManager        dataManager      = null;
            ConnectionObject    connectionObject = null;
            IDataAccessStrategy accesStrategy    = null;

            if (reportParameters != null)
            {
                connectionObject = reportParameters.ConnectionObject;
            }

            if (connectionObject != null)
            {
                accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings, connectionObject);
            }
            else
            {
                accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings, null);
            }
            dataManager = DataManager.CreateInstance(reportModel.ReportSettings, accesStrategy);
            if (dataManager == null)
            {
                throw new MissingDataManagerException();
            }
            return(dataManager);
        }
예제 #3
0
        public void PreviewPushDataReport(string fileName, IList list, ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            AbstractRenderer renderer = null;

            try {
                IReportModel model = ValidatePushModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = this.SetupPushDataRenderer(model, list);

                if (renderer != null)
                {
                    PreviewControl.ShowPreview(renderer, 1.5, false);
                }
            } catch (Exception) {
                throw;
            }
        }
예제 #4
0
        /*
         * protected static ColumnCollection CollectFieldsFromModel(ReportModel model){
         *      if (model == null) {
         *              throw new ArgumentNullException("model");
         *      }
         *      ColumnCollection col = new ColumnCollection();
         *
         *      foreach (BaseSection section in model.SectionCollection){
         *              for (int i = 0;i < section.Items.Count ;i ++ ) {
         *                      IReportItem item = section.Items[i];
         *                      BaseDataItem baseItem = item as BaseDataItem;
         *                      if (baseItem != null) {
         *                              col.Add(new AbstractColumn(baseItem.ColumnName));
         *                      }
         *              }
         *      }
         *      return col;
         * }
         */

        /// <summary>
        /// Creates an <see cref="AbstractRenderer"></see>
        /// any Class deriving from this can be
        /// used to get a <see cref="System.Drawing.Printing.PrintDocument"></see>
        /// </summary>
        /// <param name="model"><see cref="ReportModel"></see></param>
        /// <returns></returns>


        protected AbstractRenderer SetupStandardRenderer(IReportModel model, ReportParameters parameters)
        {
            AbstractRenderer abstr = null;

            try {
                switch (model.ReportSettings.ReportType)
                {
                //FormSheets reports
                case GlobalEnums.ReportType.FormSheet:
                    abstr = RendererFactory.Create(model, null);
                    break;

                //Databased reports
                case GlobalEnums.ReportType.DataReport:
                    IDataManager dataMan = DataManagerFactory.CreateDataManager(model, parameters);
                    abstr = RendererFactory.Create(model, dataMan);
                    break;

                default:
                    throw new ReportException("SharpReportmanager:SetupRenderer -> Unknown Reporttype");
                }

                abstr.Rendering       += new EventHandler <SectionRenderEventArgs>(OnSectionPrinting);
                abstr.SectionRendered += new EventHandler <SectionRenderEventArgs>(OnSectionPrinted);
                return(abstr);
            } catch (Exception) {
                throw;
            }
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <param name="dataTable"></param>
        /// <param name="reportParameters"></param>
        /// <returns></returns>

        public static IReportCreator CreatePageBuilder(IReportModel reportModel,
                                                       DataTable dataTable,
                                                       ReportParameters reportParameters)
        {
            Console.WriteLine("ReportEngine:CreatePageBuilder_3");
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            ReportEngine.CheckForParameters(reportModel, reportParameters);
            IDataManager dataMan = DataManager.CreateInstance(dataTable, reportModel.ReportSettings);

            if (dataMan != null)
            {
                return(DataPageBuilder.CreateInstance(reportModel, dataMan));
            }
            else
            {
                throw new MissingDataManagerException();
            }
        }
예제 #6
0
        public void PreviewPushDataReport(string fileName, DataTable dataTable, ReportParameters reportParameters)
        {
            Console.WriteLine("ReportEngine:PreviewPushDataReport_1");
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            AbstractRenderer renderer = null;

            try {
                IReportModel model = ValidatePushModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = this.SetupPushDataRenderer(model, dataTable);
                if (renderer != null)
                {
                    PreviewControl.ShowPreview(renderer, 1.5, false);
                }
            } catch (Exception) {
                throw;
            }
        }
예제 #7
0
		public static IDataManager CreateDataManager (IReportModel reportModel,ReportParameters reportParameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			IDataManager dataManager = null;
			ConnectionObject connectionObject = null;
			IDataAccessStrategy accesStrategy = null;
			if (reportParameters != null) {
				connectionObject = reportParameters.ConnectionObject;
			}
			
//			if (connectionObject != null) {
//				accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings,connectionObject);
//			} else {
//				accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings,null);
//				
//			}
			accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings);
			dataManager = DataManager.CreateInstance(reportModel.ReportSettings,accesStrategy);
			if (dataManager == null) {
				throw new MissingDataManagerException();
			}
			return dataManager;
		}	
예제 #8
0
		public static ConnectionObject BuildConnectionObject (ReportParameters reportParameters)
		{
			if (reportParameters == null) {
				throw new ArgumentNullException("reportParameters");
				                                
			}
			return reportParameters.ConnectionObject;
		}
예제 #9
0
 public static ConnectionObject BuildConnectionObject(ReportParameters reportParameters)
 {
     if (reportParameters == null)
     {
         throw new ArgumentNullException("reportParameters");
     }
     return(reportParameters.ConnectionObject);
 }
예제 #10
0
        /// <summary>
        /// For internal use only
        /// </summary>
        /// <param name="reportModel"></param>
        /// <returns></returns>

        /*
         * internal static IReportCreator CreatePageBuilder (IReportModel reportModel)
         * {
         *      if (reportModel == null) {
         *              throw new ArgumentNullException("reportModel");
         *      }
         *      IDataManager dataMan  = DataManagerFactory.CreateDataManager(reportModel,(ReportParameters)null);
         *      IReportCreator builder = DataPageBuilder.CreateInstance(reportModel, dataMan);
         *      return builder;
         * }
         */

        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <param name="dataSet"></param>
        /// <param name="reportParameter"></param>
        /// <returns></returns>
        public static IReportCreator CreatePageBuilder(IReportModel reportModel,
                                                       DataSet dataSet,
                                                       ReportParameters reportParameter)
        {
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            if (dataSet == null)
            {
                throw new ArgumentNullException("dataSet");
            }
            return(CreatePageBuilder(reportModel, dataSet.Tables[0], reportParameter));
        }
예제 #11
0
		public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list)
		{
			System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
			System.IO.Stream stream = asm.GetManifestResourceStream("ICSharpCode.CodeQuality.Reporting.Overviewreport.srd");
			var model = ReportEngine.LoadReportModel(stream);
			ReportSettings = model.ReportSettings;
			
			var	 r =  from c in list
				select new OverviewViewModel { Node = c};
			
			var p = new ReportParameters();
			p.Parameters.Add(new BasicParameter ("param1",base.FileNames[0]));
			p.Parameters.Add(new BasicParameter ("param2",list.Count.ToString()));
			
			IReportCreator creator = ReportEngine.CreatePageBuilder(model,r.ToList(),p);
			creator.BuildExportList();
			return creator;
		}
예제 #12
0
        ///<summary>
        /// Loads the report, and initialise <see cref="ReportParameters"></see>
        /// Fill the <see cref="AbstractParametersCollection"></see>
        ///  with <see cref="SqlParameters">
        /// this is an easy way to ask the report for desired paramaters</see></summary>
        public static ReportParameters LoadParameters(string fileName)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            ReportModel model = null;

            try {
                model = LoadReportModel(fileName);
                ReportParameters pars = new ReportParameters();
                pars.Parameters.AddRange(model.ReportSettings.ParameterCollection);
                pars.SqlParameters.AddRange(model.ReportSettings.SqlParameters);
                return(pars);
            } catch (Exception) {
                throw;
            }
        }
예제 #13
0
		public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list)
		{
			
			var reportFileName = MakeReportFileName(overviewReport);
			var model = ReportEngine.LoadReportModel(reportFileName);
			ReportSettings = model.ReportSettings;
			
			var	 r =  from c in list
				select new OverviewViewModel { Node = c};
			
			var p = new ReportParameters();
			p.Parameters.Add(new BasicParameter ("param1",base.FileNames[0]));
			p.Parameters.Add(new BasicParameter ("param2",list.Count.ToString()));
			
			IReportCreator creator = ReportEngine.CreatePageBuilder(model,r.ToList(),p);
			creator.BuildExportList();
			return creator;
		}	
예제 #14
0
		public static ConnectionObject PrepareConnectionFromParameters (ReportSettings settings,
		                                                                ReportParameters reportParameters)
		{
			if (settings == null) {
				throw new ArgumentNullException("settings");
			}
			ConnectionObject conObj = null;
			if (reportParameters != null) {
				if (reportParameters.ConnectionObject != null) {
					conObj = reportParameters.ConnectionObject;
				}
			}
			
			if (!String.IsNullOrEmpty(settings.ConnectionString)) {
				conObj = ConnectionObjectFactory.BuildConnectionObject(settings.ConnectionString);
			}
			return conObj;
		}
예제 #15
0
        internal static void CheckForParameters(IReportModel model, ReportParameters reportParameters)
        {
            if (reportParameters != null)
            {
                if (reportParameters.SortColumnCollection.Count > 0)
                {
                    model.ReportSettings.SortColumnsCollection.AddRange(reportParameters.SortColumnCollection);
                }

                if (reportParameters.Parameters.Count > 0)
                {
                    reportParameters.Parameters.ForEach(item => SetReportParam(model, item));
                }

                if (reportParameters.SqlParameters.Count > 0)
                {
                    reportParameters.SqlParameters.ForEach(item => SetSqlParam(model, item));
                }
            }
        }
예제 #16
0
        public void PreviewStandardReport(string fileName, ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            AbstractRenderer renderer = null;

            try {
                ReportModel model = LoadReportModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = SetupStandardRenderer(model, reportParameters);
                if (renderer != null)
                {
                    PreviewControl.ShowPreview(renderer, 1.5, false);
                }
            } catch (Exception) {
                throw;
            }
        }
예제 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="dataTable"></param>
        /// <param name="reportModel"></param>
        public void PrintPushDataReport(string fileName, DataTable dataTable,
                                        ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            AbstractRenderer renderer = null;

            try {
                IReportModel model = ReportEngine.ValidatePushModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = SetupPushDataRenderer(model, dataTable);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }
예제 #18
0
		public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list)
		{
			
			var	 r =  from c in list
				select new OverviewViewModel { Node = c};
			

			Uri uri = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase);
			var fullname = uri.LocalPath;
			var reportFileName = Path.GetDirectoryName(fullname) + Path.DirectorySeparatorChar + "Reporting" + Path.DirectorySeparatorChar + "Report1.srd";
			
			var model = ReportEngine.LoadReportModel(reportFileName);
			var p = new ReportParameters();
			p.Parameters.Add(new BasicParameter ("param1",fileNames[0]));
			
			ReportSettings = model.ReportSettings;

			
			IReportCreator creator = ReportEngine.CreatePageBuilder(model,r.ToList(),p);
			creator.BuildExportList();
			return creator;
		}
예제 #19
0
        internal static void CheckForParameters(IReportModel model, ReportParameters reportParameters)
        {
            if (reportParameters != null)
            {
                if (reportParameters.SortColumnCollection.Count > 0)
                {
                    model.ReportSettings.SortColumnCollection.AddRange(reportParameters.SortColumnCollection);
                }

                if (reportParameters.SqlParameters.Count > 0)
                {
                    foreach (BasicParameter bp in reportParameters.SqlParameters)
                    {
                        BasicParameter p = model.ReportSettings.ParameterCollection.Find(bp.ParameterName);
                        if (p != null)
                        {
                            p.ParameterValue = bp.ParameterValue;
                        }
                    }
                }
            }
        }
예제 #20
0
        /// <summary>
        /// send a Standart (PullModel/FormSheet) Report to printer
        /// </summary>
        /// <param name="fileName">Path to ReportFile</param>
        /// <param name="renderTo">Type of renderer currently only "ToText" is implemented</param>
//		[Obsolete("use PrintStandardReport (fileName,null)")]
//		public void PrintStandardReport (string fileName) {
//			if (String.IsNullOrEmpty(fileName)) {
//				throw new ArgumentNullException("fileName");
//			}
//			PrintStandardReport (fileName,null);
//
//		}
//

        public void PrintStandardReport(string fileName, ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            AbstractRenderer renderer = null;

            try {
                IReportModel model = LoadReportModel(fileName);
//				if (this.connectionObject == null) {
//					this.connectionObject = ReportEngine.PrepareConnectionFromParameters (model.ReportSettings,reportParameters);
//				}
//
                ReportEngine.CheckForParameters(model, reportParameters);
                renderer = SetupStandardRenderer(model, reportParameters);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }
예제 #21
0
        /// <summary>
        /// Use this method for pullData and FormSheet
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="reportParameters">null if no parameters are used</param>
        /// <returns><see cref="BasePager"</returns>
        public static IReportCreator CreatePageBuilder(string fileName,
                                                       ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            IReportModel   reportModel = LoadReportModel(fileName);
            IReportCreator builder     = null;

            if (reportModel.DataModel == GlobalEnums.PushPullModel.FormSheet)
            {
                builder = FormPageBuilder.CreateInstance(reportModel);
            }
            else
            {
                CheckForParameters(reportModel, reportParameters);
                IDataManager dataMan = DataManagerFactory.CreateDataManager(reportModel, reportParameters);
                builder = DataPageBuilder.CreateInstance(reportModel, dataMan);
            }
            return(builder);
        }
예제 #22
0
        public static ConnectionObject PrepareConnectionFromParameters(ReportSettings settings,
                                                                       ReportParameters reportParameters)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            ConnectionObject conObj = null;

            if (reportParameters != null)
            {
                if (reportParameters.ConnectionObject != null)
                {
                    conObj = reportParameters.ConnectionObject;
                }
            }

            if (!String.IsNullOrEmpty(settings.ConnectionString))
            {
                conObj = ConnectionObjectFactory.BuildConnectionObject(settings.ConnectionString);
            }
            return(conObj);
        }
예제 #23
0
		public void PreviewPushDataReport (string fileName,DataTable dataTable,ReportParameters reportParameters)
		{
			Console.WriteLine("ReportEngine:PreviewPushDataReport_1");
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			if (dataTable == null) {
				throw new ArgumentNullException("dataTable");
			}
			AbstractRenderer renderer = null;
			try {
				IReportModel model = ValidatePushModel (fileName);
				CheckForParameters(model,reportParameters);
				renderer = this.SetupPushDataRenderer (model,dataTable);
				if (renderer != null) {
					PreviewControl.ShowPreview(renderer,1.5,false);
				}
			} catch (Exception) {
				throw;
			}
		}
예제 #24
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="reportModel"></param>
		/// <param name="dataTable"></param>
		/// <param name="reportParameters"></param>
		/// <returns></returns>
		
		public static IReportCreator CreatePageBuilder (IReportModel reportModel,
		                                         DataTable dataTable,
		                                         ReportParameters reportParameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataTable == null) {
				throw new ArgumentNullException("dataTable");
			}
			ReportEngine.CheckForParameters(reportModel,reportParameters);
			IDataManager dataMan  = DataManager.CreateInstance(dataTable,reportModel.ReportSettings);
			if (dataMan != null)
			{
				return DataPageBuilder.CreateInstance(reportModel, dataMan);
			} else {
				throw new MissingDataManagerException();
			}
		}
예제 #25
0
		internal static void CheckForParameters (IReportModel model,ReportParameters reportParameters)
		{
			if (reportParameters != null) {
				
				if (reportParameters.SortColumnCollection.Count > 0) {
					model.ReportSettings.SortColumnsCollection.AddRange(reportParameters.SortColumnCollection);
				}
				
				if (reportParameters.Parameters.Count > 0)
				{
					reportParameters.Parameters.ForEach(item => SetReportParam(model,item));
				}
				
				if (reportParameters.SqlParameters.Count > 0)
				{
					reportParameters.SqlParameters.ForEach(item => SetSqlParam(model,item));
				}
			}
		}
예제 #26
0
		internal static void CheckForParameters (IReportModel model,ReportParameters reportParameters)
		{
			if (reportParameters != null) {
				
				if (reportParameters.SortColumnCollection.Count > 0) {
					model.ReportSettings.SortColumnsCollection.AddRange(reportParameters.SortColumnCollection);
				}
				
				if (reportParameters.SqlParameters.Count > 0) {
					foreach (BasicParameter bp in reportParameters.SqlParameters) {
						BasicParameter p = model.ReportSettings.ParameterCollection.Find(bp.ParameterName);
						if (p != null) {
							p.ParameterValue = bp.ParameterValue;
						}
					}
				}
				
			}
		}
예제 #27
0
		/// <summary>
		/// Creates an <see cref="AbstractRenderer"></see>
		/// any Class deriving from this can be
		/// used to get a <see cref="System.Drawing.Printing.PrintDocument"></see>
		/// </summary>
		/// <param name="model"><see cref="ReportModel"></see></param>
		/// <returns></returns>
		
		
		protected AbstractRenderer SetupStandardRenderer (IReportModel model,ReportParameters parameters) {

			AbstractRenderer abstr = null;
			try {
				switch (model.ReportSettings.ReportType) {
						//FormSheets reports
					case GlobalEnums.ReportType.FormSheet:
						abstr = RendererFactory.Create (model,null);
						break;
						//Databased reports
					case GlobalEnums.ReportType.DataReport :
						IDataManager dataMan  = DataManagerFactory.CreateDataManager(model,parameters);
						abstr = RendererFactory.Create (model,dataMan);
						break;
					default:
						throw new ReportException ("SharpReportmanager:SetupRenderer -> Unknown Reporttype");
				}
				
				abstr.Rendering += new EventHandler<SectionRenderEventArgs>(OnSectionPrinting);
				abstr.SectionRendered +=new EventHandler<SectionRenderEventArgs>(OnSectionPrinted);
				return abstr;
			} catch (Exception) {
				throw;
			}
		}
예제 #28
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileName"></param>
		/// <param name="dataTable"></param>
		/// <param name="reportModel"></param>
		public void PrintPushDataReport (string fileName,DataTable dataTable,
		                                 ReportParameters reportParameters)
		{
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			if (dataTable == null) {
				throw new ArgumentNullException("dataTable");
			}
			AbstractRenderer renderer = null;
			try {
				IReportModel model = ReportEngine.ValidatePushModel(fileName);
				CheckForParameters(model,reportParameters);
				renderer = SetupPushDataRenderer (model,dataTable);
				ReportEngine.ReportToPrinter(renderer,model);
				
			} catch (Exception) {
				throw;
			}
		}
예제 #29
0
		public void PreviewStandardReport (string fileName,ReportParameters reportParameters)
		{
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			
			AbstractRenderer renderer = null;
			try {
				ReportModel model = LoadReportModel (fileName);
				CheckForParameters(model,reportParameters);
				renderer = SetupStandardRenderer (model,reportParameters);
				if (renderer != null) {
					PreviewControl.ShowPreview(renderer,1.5,false);
				}
			} catch (Exception) {
				throw;
			}
		}
예제 #30
0
		public void PreviewPushDataReport (string fileName,IList list,ReportParameters reportParameters)
		{
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			if (list == null) {
				throw new ArgumentNullException("list");
			}
			AbstractRenderer renderer = null;
			try {
				IReportModel model = ValidatePushModel(fileName);
				CheckForParameters(model,reportParameters);
				renderer = this.SetupPushDataRenderer (model,list);
				
				if (renderer != null) {
					PreviewControl.ShowPreview(renderer,1.5,false);
				}
				
			} catch (Exception) {
				throw;
			}
		}
예제 #31
0
		/// <summary>
		/// Use this method for pullData and FormSheet
		/// </summary>
		/// <param name="fileName"></param>
		/// <param name="reportParameters">null if no parameters are used</param>
		/// <returns><see cref="BasePager"</returns>
		public static IReportCreator CreatePageBuilder (string fileName,
		                                                ReportParameters reportParameters)
		{
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			
			IReportModel reportModel = LoadReportModel (fileName);
			IReportCreator builder = null;
			Layouter layouter = new Layouter();
			if (reportModel.DataModel == GlobalEnums.PushPullModel.FormSheet) {
				builder = FormPageBuilder.CreateInstance(reportModel,layouter);
			} else {
				CheckForParameters(reportModel,reportParameters);
				IDataManager dataMan  = DataManagerFactory.CreateDataManager(reportModel,reportParameters);
				builder = DataPageBuilder.CreateInstance(reportModel, dataMan,layouter);
			}
			return builder;
		}
예제 #32
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="reportModel"></param>
		/// <param name="dataSet"></param>
		/// <param name="reportParameter"></param>
		/// <returns></returns>
		public static IReportCreator CreatePageBuilder (IReportModel reportModel,
		                                         DataSet dataSet,
		                                         ReportParameters reportParameter)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataSet == null) {
				throw new ArgumentNullException("dataSet");
			}
			return CreatePageBuilder (reportModel,dataSet.Tables[0],reportParameter);
		}
예제 #33
0
		/*
		public static IDataManager CreateDataManager (ReportSettings reportSettings,ConnectionObject connectionObject)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			
			if (connectionObject == null) {
				throw new ArgumentNullException("connectionObject");
			}
			IDataManager dataMan = null;
			
			if (!String.IsNullOrEmpty(connectionObject.Connection.ConnectionString)) {
				SqlDataAccessStrategy sda = new SqlDataAccessStrategy(reportSettings,connectionObject);
				dataMan = DataManager.CreateInstance(reportSettings,sda);
			}
			if (dataMan == null) {
				throw new MissingDataManagerException();
			}
			return dataMan;
		}
		
		
		
		/// <summary>
		/// Return a valid <see cref="Datamanager"></see>
		/// </summary>
		/// <param name="model"></param>
		/// <returns></returns>
		public static IDataManager CreateDataManager (ReportSettings reportSettings) 
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			IDataManager dataMan = null;

			if (!String.IsNullOrEmpty(reportSettings.CommandText)) {
				SqlDataAccessStrategy sda = new SqlDataAccessStrategy(reportSettings,null);
				dataMan = DataManager.CreateInstance(reportSettings,sda);
			}
			
			if (dataMan == null) {
				throw new MissingDataManagerException();
			}
			return dataMan;
		}
		*/
		#endregion
		
		
		#region Parameter Handling
		
		///<summary>
		/// Loads the report, and initialise <see cref="ReportParameters"></see>
		/// Fill the <see cref="AbstractParametersCollection"></see>
		///  with <see cref="SqlParameters">
		/// this is an easy way to ask the report for desired paramaters</see></summary>
		public static ReportParameters LoadParameters (string fileName) {
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			ReportModel model = null;
			try {
				model = LoadReportModel (fileName);
				ReportParameters pars = new ReportParameters();
				pars.ConnectionObject = null;
				
				pars.SqlParameters.AddRange (model.ReportSettings.ParameterCollection);
				return pars;
			} catch (Exception) {
				throw;
			}
		}
예제 #34
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="reportModel"></param>
		/// <param name="list"></param>
		/// <param name="reportParameters"></param>
		/// <returns></returns>
		public static  IReportCreator CreatePageBuilder (IReportModel reportModel,
		                                         IList list,
		                                         ReportParameters reportParameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (list == null) {
				throw new ArgumentNullException("list");
			}
			ReportEngine.CheckForParameters(reportModel,reportParameters);
			IDataManager dataMan  = DataManager.CreateInstance(list,reportModel.ReportSettings);
			if (dataMan != null) {
				Layouter layouter = new Layouter();
				return DataPageBuilder.CreateInstance(reportModel,dataMan,layouter);
			} else {
				throw new MissingDataManagerException();
			}
		}
예제 #35
0
		public void PrintStandardReport (string fileName,ReportParameters reportParameters) {
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			
			AbstractRenderer renderer = null;
			try {
				IReportModel model = LoadReportModel (fileName);
//				if (this.connectionObject == null) {
//					this.connectionObject = ReportEngine.PrepareConnectionFromParameters (model.ReportSettings,reportParameters);
//				}
//				
				ReportEngine.CheckForParameters(model,reportParameters);
				renderer = SetupStandardRenderer (model,reportParameters);
				ReportEngine.ReportToPrinter (renderer,model);
				
			} catch (Exception) {
				throw;
			}
		}