public void CheckReportFooter()
        {
            ReportModel m = ReportModel.Create(System.Drawing.GraphicsUnit.Inch);
            BaseSection s = m.ReportFooter;

            Assert.AreEqual(ReportSectionNames.ReportFooter, s.Name);
        }
        public void GeneratePlainReport_1()
        {
            ReportModel model      = ReportModel.Create();
            Properties  customizer = new Properties();

            customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout);
            IReportGenerator generator = new GeneratePlainReport(model, customizer);

            generator.GenerateReport();

            XDocument doc1 = XDocument.Load(new XmlNodeReader(generator.XmlReport));

            XDocument doc2 = new XDocument();

            using (XmlWriter w = doc2.CreateWriter()){
                generator.XmlReport.Save(w);
            }
            XDocument doc3 = ReportGenerationHelper.XmlDocumentToXDocument(generator.XmlReport);

            Assert.IsNotNull(doc1);
            Assert.IsNotNull(doc2);
            Assert.IsNotNull(doc2);

            var sq = from si in doc1.Descendants() select si;

            Console.WriteLine("xxxxx");
            foreach (XElement a in sq)
            {
                Console.WriteLine(a.Name);
            }
        }
Esempio n. 3
0
        private ReportModel CreateModel()
        {
            ReportModel m          = ReportModel.Create();
            Properties  customizer = new Properties();

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

            generator.GenerateReport();

            ReportLoader rl = new ReportLoader();
//			Console.WriteLine (generator.XmlReport.DocumentElement);
            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);
        }
        public void CheckDetailSection()
        {
            ReportModel m = ReportModel.Create(System.Drawing.GraphicsUnit.Inch);
            BaseSection s = m.DetailSection;

            Assert.AreEqual(ReportSectionNames.ReportDetail, s.Name);
        }
Esempio n. 5
0
        public ReportModel CreateAndFillReportModel()
        {
            ReportModel model = ReportModel.Create();

            model.ReportSettings.ReportName = this.ReportName;
            model.ReportSettings.FileName   = this.Path + this.FileName;

            model.ReportSettings.GraphicsUnit = this.GraphicsUnit;
            model.ReportSettings.ReportType   = this.ReportType;

            model.ReportSettings.ConnectionString = this.ConnectionString;
            model.ReportSettings.CommandText      = this.SqlString;
            model.ReportSettings.CommandType      = this.CommandType;
            model.ReportSettings.DataModel        = this.DataModel;

            model.ReportSettings.Landscape = this.Landscape;

            if (Landscape)
            {
                model.ReportSettings.PageSize = new Size(GlobalValues.DefaultPageSize.Height, GlobalValues.DefaultPageSize.Width);
            }
            else
            {
                model.ReportSettings.PageSize = GlobalValues.DefaultPageSize;
            }

            CreateGrouping(model.ReportSettings);

            return(model);
        }
        public void TableLayoutTest()
        {
            AbstractLayout l = LayoutFactory.CreateGenerator(GlobalEnums.ReportLayout.TableLayout,
                                                             ReportModel.Create(),
                                                             new ReportItemCollection());

            Assert.IsAssignableFrom <TableLayout>(l, "Should be 'TableLayout'");
        }
        private XmlDocument CreateXmlFromModel()
        {
            ReportModel model      = ReportModel.Create();
            Properties  customizer = new Properties();

            customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout);
            IReportGenerator generator = new GeneratePlainReport(model, customizer);

            generator.GenerateReport();
            return(generator.XmlReport);
        }
Esempio n. 8
0
        public void Calculate_PageHeader()
        {
            IReportModel model      = ReportModel.Create();
            ISinglePage  singlePage = CreateSinglePage(model, 0);

            singlePage.CalculatePageBounds(model);

            Point expectedLocation = new Point(model.ReportSettings.LeftMargin, model.ReportSettings.TopMargin + singlePage.SectionBounds.ReportHeaderRectangle.Size.Height + 1);

            Assert.That(singlePage.SectionBounds.PageHeaderRectangle.Location, Is.EqualTo(expectedLocation));
        }
        private XmlDocument CreateXmlFromModel()
        {
            ReportModel     model           = ReportModel.Create();
            ReportStructure reportStructure = new ReportStructure()
            {
                ReportLayout = GlobalEnums.ReportLayout.ListLayout
            };
            IReportGenerator generator = new GeneratePlainReport(model, reportStructure);

            generator.GenerateReport();
            return(generator.XmlReport);
        }
        public static ReportModel FormSheetModel()
        {
            ReportStructure rs = new ReportStructure();

            rs.ReportName   = "PlainReport";
            rs.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;
            rs.ReportType   = GlobalEnums.ReportType.FormSheet;
            rs.DataModel    = GlobalEnums.PushPullModel.FormSheet;
            ReportModel m = ReportModel.Create();

            return(rs.CreateAndFillReportModel());
        }
Esempio n. 11
0
        public static ReportDesignerView SetupDesigner()
        {
            ReportModel model      = ReportModel.Create();
            Properties  customizer = new Properties();

            customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout);
            IReportGenerator generator = new GeneratePlainReport(model, customizer);

            generator.GenerateReport();

            OpenedFile file = FileService.CreateUntitledOpenedFile(GlobalValues.PlainFileName, new byte[0]);

            file.SetData(generator.Generated.ToArray());
            return(SetupDesigner(file));
        }
Esempio n. 12
0
        public ReportModel CreateAndFillReportModel()
        {
            ReportModel model = ReportModel.Create();

            model.ReportSettings.ReportName = this.reportName;
            model.ReportSettings.FileName   = this.path + this.fileName;

            model.ReportSettings.GraphicsUnit = this.graphicsUnit;
            model.ReportSettings.ReportType   = this.reportType;

            model.ReportSettings.ConnectionString = this.connectionString;
            model.ReportSettings.CommandText      = this.sqlString;
            model.ReportSettings.CommandType      = this.commandType;
            model.ReportSettings.DataModel        = this.dataModel;
            return(model);
        }
Esempio n. 13
0
        private ReportModel CreateModel()
        {
            ReportModel m = ReportModel.Create();

            ReportStructure reportStructure = new ReportStructure()
            {
                ReportLayout = GlobalEnums.ReportLayout.ListLayout
            };

            IReportGenerator generator = new GenerateFormSheetReport(m, reportStructure);

            generator.GenerateReport();

            ReportLoader loader = new ReportLoader();
            object       root   = loader.Load(generator.XmlReport.DocumentElement);

            ReportModel model = root as ReportModel;

            model.ReportSettings.FileName = GlobalValues.PlainFileName;
            FilePathConverter.AdjustReportName(model);
            return(model);
        }
        private ReportModel LoadObjectFromXmlDocument(XmlElement elem)
        {
            Console.WriteLine("LoadObjectFromXmlDocumen)");
            //ReportSettings
            OpenedFile     file           = (OpenedFile)host.GetService(typeof(OpenedFile));
            BaseItemLoader baseItemLoader = new BaseItemLoader();
            XmlNodeList    n     = elem.FirstChild.ChildNodes;
            XmlElement     rse   = (XmlElement)n[0];
            ReportModel    model = ReportModel.Create();

            // manipulate reportSettings if Filename differs
            this.reportSettings = baseItemLoader.Load(rse) as ReportSettings;
            if (this.reportSettings.FileName.CompareTo(file.FileName) != 0)
            {
                System.Diagnostics.Trace.WriteLine("LoadObjectFromXmlDocument - filename changed");
                this.reportSettings.FileName = file.FileName;
            }

            model.ReportSettings = this.reportSettings;

            host.Container.Add(this.reportSettings);

            //Move to SectionCollection
            XmlNodeList sectionList = elem.LastChild.ChildNodes;

            foreach (XmlNode sectionNode in sectionList)
            {
                try {
                    object      o       = this.Load(sectionNode as XmlElement, null);
                    BaseSection section = o as BaseSection;
                    ConvertAbsolut2RelativePath(section.Controls, this.reportSettings.FileName);
//					ConvertAbsolut2RelativePath(section,this.reportSettings.FileName);
                    host.Container.Add(section);
                } catch (Exception e) {
                    MessageService.ShowException(e);
                }
            }
            return(model);
        }
Esempio n. 15
0
        IReportModel CreateModel()
        {
            Size         defaultSectionSize = new Size(727, 60);
            IReportModel model = ReportModel.Create();

            model.ReportHeader.Size     = defaultSectionSize;
            model.ReportHeader.Location = new Point(50, 50);


            model.PageHeader.Size     = defaultSectionSize;
            model.PageHeader.Location = new Point(50, 125);

            model.DetailSection.Size     = defaultSectionSize;
            model.DetailSection.Location = new Point(50, 200);

            model.PageFooter.Size       = defaultSectionSize;
            model.ReportFooter.Location = new Point(50, 275);

            model.ReportFooter.Size     = defaultSectionSize;
            model.ReportFooter.Location = new Point(50, 350);
            return(model);
        }
Esempio n. 16
0
        public void Calculate_Page_If_Firstpage()
        {
            Size         defSize = new Size(727, 60);
            IReportModel model   = ReportModel.Create();

            model.ReportHeader.Size     = defSize;
            model.ReportHeader.Location = new Point(50, 50);


            model.PageHeader.Size     = defSize;
            model.PageHeader.Location = new Point(50, 125);

            model.DetailSection.Size     = defSize;
            model.DetailSection.Location = new Point(50, 200);

            model.PageFooter.Size       = defSize;
            model.ReportFooter.Location = new Point(50, 275);

            model.ReportFooter.Size     = defSize;
            model.ReportFooter.Location = new Point(50, 350);

            var        s  = new SectionBounds(new ReportSettings(), true);
            SinglePage sp = new SinglePage(s, 0);

            sp.CalculatePageBounds(model);
            Console.WriteLine();
            Console.WriteLine("ReportHeader {0} - {1}", sp.SectionBounds.ReportHeaderRectangle, sp.SectionBounds.ReportHeaderRectangle.Location.Y + sp.SectionBounds.ReportHeaderRectangle.Height);
            Console.WriteLine("PageHeader {0} - {1}", sp.SectionBounds.PageHeaderRectangle, sp.SectionBounds.PageHeaderRectangle.Location.Y + sp.SectionBounds.PageHeaderRectangle.Height);
            Console.WriteLine("DetailSection {0} - {1} ", sp.SectionBounds.DetailSectionRectangle, sp.SectionBounds.DetailSectionRectangle.Location.Y + sp.SectionBounds.DetailSectionRectangle.Height);

            Console.WriteLine("\tDetailStart {0} ", sp.SectionBounds.DetailStart);
            Console.WriteLine("\tDetailEnd {0} ", sp.SectionBounds.DetailEnds);
            Console.WriteLine("\tDetailArea {0} ", sp.SectionBounds.DetailArea);
            Console.WriteLine("PageFooter {0} - {1} ", sp.SectionBounds.PageFooterRectangle, sp.SectionBounds.PageFooterRectangle.Location.Y + sp.SectionBounds.PageFooterRectangle.Height);
            Console.WriteLine("ReportFooter {0} - {1}", sp.SectionBounds.ReportFooterRectangle, sp.SectionBounds.ReportFooterRectangle.Location.Y + sp.SectionBounds.ReportFooterRectangle.Height);
            Console.WriteLine();
        }
Esempio n. 17
0
        public void PlainConstructor()
        {
            ReportModel m = ReportModel.Create();

            Assert.IsNotNull(m, "should be not 'null'");
        }
Esempio n. 18
0
        public void ConstructorWithGraphics()
        {
            ReportModel m = ReportModel.Create(System.Drawing.GraphicsUnit.Millimeter);

            Assert.IsNotNull(m, "should be not 'null'");
        }
 public void tt()
 {
     ReportModel m = ReportModel.Create();
 }
Esempio n. 20
0
        public void ReportSettings()
        {
            ReportModel m = ReportModel.Create();

            Assert.IsNotNull(m.ReportSettings, "ReportSettings should not be 'null'");
        }
Esempio n. 21
0
        public void CheckGraphicsUnit()
        {
            ReportModel m = ReportModel.Create(System.Drawing.GraphicsUnit.Inch);

            Assert.AreEqual(m.ReportSettings.GraphicsUnit, System.Drawing.GraphicsUnit.Inch, "Should be Inch");
        }
Esempio n. 22
0
        public void CheckDataModel()
        {
            ReportModel m = ReportModel.Create(System.Drawing.GraphicsUnit.Inch);

            Assert.AreEqual(GlobalEnums.PushPullModel.FormSheet, m.DataModel);
        }
 public void CreateModel()
 {
     model = ReportModel.Create();
 }