public static ReportModel CreateModel (string reportName)
		{
			
			ReportStructure structure = CreateReportStructure(reportName);
			
			AvailableFieldsCollection abstractColumns = new AvailableFieldsCollection();
			AbstractColumn a1 = new AbstractColumn("Field1",typeof(System.String));
			structure.AvailableFieldsCollection.Add(a1);
			
			ICSharpCode.Reports.Core.BaseDataItem bri = new ICSharpCode.Reports.Core.BaseDataItem();
			bri.Name ="Field1";
			structure.ReportItemCollection.Add(bri);
			
			ReportModel m = structure.CreateAndFillReportModel();
			ICSharpCode.Core.Properties customizer = new ICSharpCode.Core.Properties();
			
			customizer.Set("Generator", structure);
			customizer.Set("ReportLayout",GlobalEnums.ReportLayout.ListLayout);
			IReportGenerator generator = new GeneratePushDataReport(m,customizer);
			generator.GenerateReport();
			
			ReportLoader rl = new ReportLoader();
			object root = rl.Load(generator.XmlReport.DocumentElement);
			ReportModel model = root as ReportModel;
			if (model != null) {
				model.ReportSettings.FileName = GlobalValues.PlainFileName;
				FilePathConverter.AdjustReportName(model);
			} else {
				throw new InvalidReportModelException();
			}
			return model;
		}
Ejemplo n.º 2
0
        public ICSharpCode.Core.Properties ToProperties()
        {
            var p = new ICSharpCode.Core.Properties();

            p.Set("Files", lastfile.ToArray());
            p.Set("Projects", lastproject.ToArray());
            return(p);
        }
        public static ReportModel CreateModel(string reportName, bool createGrouping)
        {
            ReportStructure structure = CreateReportStructure(reportName);

            AvailableFieldsCollection abstractColumns = new AvailableFieldsCollection();
            AbstractColumn            a1 = new AbstractColumn("Field1", typeof(System.String));

            structure.AvailableFieldsCollection.Add(a1);

            ICSharpCode.Reports.Core.BaseDataItem bri = new ICSharpCode.Reports.Core.BaseDataItem();
            bri.Name = "Field1";
            structure.ReportItemCollection.Add(bri);

            if (createGrouping)
            {
                structure.Grouping = "group";
            }

            ReportModel m = structure.CreateAndFillReportModel();

            ICSharpCode.Core.Properties customizer = new ICSharpCode.Core.Properties();

            customizer.Set("Generator", structure);
            customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout);
            IReportGenerator generator = new GeneratePushDataReport(m, customizer);

            generator.GenerateReport();

            ReportLoader rl    = new ReportLoader();
            object       root  = rl.Load(generator.XmlReport.DocumentElement);
            ReportModel  model = root as ReportModel;

            if (model != null)
            {
                model.ReportSettings.FileName = GlobalValues.PlainFileName;
                FilePathConverter.AdjustReportName(model);
            }
            else
            {
                throw new InvalidReportModelException();
            }
            return(model);
        }