public void GenerateReport(int id)
        {
            EntityDTO dto = entityData.GetOneEntity(id);

            dto.ExtractProperties();

            FileDTO file = filesData.GetFile(dto.DGXFileName);

            byte[] diagram = file.Data;
            //Save the raw .wmf file
            int poolCount = entityData.GetPoolCount(dto.ID);


            this.imageManager = new WmfImageManager(dto, diagram, dto.DGXFileName, dto.Type, poolCount, true);

            string resizedDiagram = imageManager.SaveAndResizeImage(diagram, dto.DGXFileName, dto.Type,
                                                                    poolCount, true);

            string[] images = new string[] { PathResolver.MapPath(resizedDiagram) };

            if (poolCount > 1 && dto.Type == 142)
            {
                //slice the wmf
                SubProcessSlicer slicer = new SubProcessSlicer(resizedDiagram);
                images = slicer.Slice();
            }

            List <PdfContentParameter> contents = ReportBuilder.BuildReport(dto);

            byte[] pdfBytes = PDFBuilder.CreatePDF(contents, images, dto.Type);
            this.view.RenderReport(pdfBytes);
        }
        public void LoadSampleData(int id, bool showImage)
        {
            this.showimage = showImage;
            //BC-040-000 Approve Document
            //int id = 106571;

            //CE-010-000 Define Consulting Need
            //int id = 170160;

            //IS-121-000 Develop / Revise / Cancel Mission Plan
            //int id = 160843;

            //SM-010-000 Raise/Change/Cancel Service Request
            //int id = 194205;

            //RC-010-000 Initiate/Raise Change Request
            //int id = 188719;

            //Get all the "succeeding" event type
            //from the sub process
            var         events = spData.GetAllSucceedingEvent(id);
            EndToEndDTO main   = CreateMainDTO(id, events);

            //This builds the remaining sub item
            //till there is no more succeeding
            //to handle
            foreach (var item in main.SubItems)
            {
                BuildSubItems(item);
            }

            StringBuilder html = new StringBuilder();

            html.Append("<table border='1' cellpadding='8'>");
            html.Append("<tr>");
            main.AssociatedEventDTO.ExtractProperties();

            //Slicing
            string imagePath = BuildDiagramImageReturningPath(main.AssociatedEventDTO);

            SubProcessSlicer slicer = new SubProcessSlicer(imagePath);

            string[] sliced = slicer.Slice();

            StringBuilder sb = new StringBuilder();

            foreach (var item in sliced)
            {
                string vPath = ExtractVirtualPath(item);
                sb.AppendFormat("<td valign='top'><div class=\"diagram-image-holder\"><img id=\"diagram\" class=\"diagram\" src={0} /></div></td>", vPath);
            }

            html.AppendFormat("<td  valign='top'><h3>{0}</h3></td>{1}", main.AssociatedEventDTO.Name, this.showimage ?  sb.ToString() : string.Empty);
            html.Append("<td>");

            BuildSequence(html, main);

            html.Append("</td>");
            html.Append("</tr>");
            html.Append("</table>");

            this.view.RenderFullCycle(html.ToString());
        }