コード例 #1
0
        private void FillinSubItems(EndToEndDTO current, List<EntityDTO> subItems)
        {
            //current.AssociatedEventDTO = dto;
            current.SubItems = new List<EndToEndDTO>();

            foreach (var item in subItems)
            {
                current.SubItems.Add(new EndToEndDTO()
                {
                    AssociatedEventDTO = item,
                    FromDiagramDTO = null,
                    ToDiagramDTO = null

                });
            }
        }
コード例 #2
0
        private void ExtractToAndFrom(EndToEndDTO current, List<EntityDTO> relatedDtos)
        {
            if (current.AssociatedEventDTO != null)
            {
                string[] fullname = current.AssociatedEventDTO.Name.ToUpper().Split(new string[] { "TO" }, StringSplitOptions.RemoveEmptyEntries);

                if (fullname.Length != 2)
                {
                    throw new Exception("The name must correspond to have to and from.");
                }

                string from = fullname[0].Trim().Remove(fullname[0].Length - 4);
                current.FromDiagramDTO = relatedDtos.Where(c => c.Name.StartsWith(from)).FirstOrDefault();

                string to = fullname[1].Trim().Remove(fullname[1].Length - 4);
                current.ToDiagramDTO = relatedDtos.Where(c => c.Name.StartsWith(to)).FirstOrDefault();

            }
        }
コード例 #3
0
        /// <summary>
        /// This method creates the first and starting point Data object
        /// </summary>
        /// <param name="id"></param>
        /// <param name="subItems"></param>
        /// <returns></returns>
        private EndToEndDTO CreateMainDTO(int id, List<EntityDTO> subItems)
        {
            //Get the actual sub process
            EntityDTO actualSubProcess = eData.GetOneEntity(id);

            EndToEndDTO ee = new EndToEndDTO();
            //assign the AssociatedEventDTO
            ee.AssociatedEventDTO = actualSubProcess;
            ee.SubItems = new List<EndToEndDTO>();

            //WHY DO THIS???
            ancestors.Add(actualSubProcess);

            //Add all the sub items to the
            //subitems in the EndToEndDTO instance
            foreach (var item in subItems)
            {
                ee.SubItems.Add(new EndToEndDTO()
                    {
                        AssociatedEventDTO = item,
                        FromDiagramDTO = null,
                        ToDiagramDTO = null

                    });
            }
            //Sort items
            ee.SubItems.Sort((x, y) => x.AssociatedEventDTO.Name.CompareTo(y.AssociatedEventDTO.Name));
            return ee;
        }
コード例 #4
0
        private void BuildSubItems(EndToEndDTO current)
        {
            int eventId = current.AssociatedEventDTO.ID;
            List<EntityDTO> diagramDto = spData.GetRelatedDiagram(eventId);
            ExtractToAndFrom(current, diagramDto);

            if (current.ToDiagramDTO != null && !ancestors.Exists(c => c.ID == current.ToDiagramDTO.ID))
            {
                ancestors.Add(current.ToDiagramDTO);
            }
            else
            {
                return;
            }

            //if (ancestors.Exists(c => c.ID == current.ToDiagramDTO.ID))
            //{
            //    return;
            //}

            var events = spData.GetAllSucceedingEvent(current.ToDiagramDTO.ID);
            FillinSubItems(current, events);
            if (events.Count > 0)
            {
                foreach (var item in current.SubItems)
                {
                    //if (item.ToDiagramDTO == null || item.FromDiagramDTO == null) continue;

                    //if (!ancestors.Exists(c => c.ID == item.ToDiagramDTO.ID))
                    //{
                        BuildSubItems(item);
                    //}
                }
                //var events = spData.GetAllSucceedingEvent(id);
            }
            else
            {
                return;
            }
        }
コード例 #5
0
        private void BuildSeries(StringBuilder html, EndToEndDTO current)
        {
            //html.Append("<table>");
            foreach (var item in current.SubItems)
            {
                //html.Append("<tr><td>");
                //html.Append("<div class='sequence'>");
                html.Append("<table>");
                item.ToDiagramDTO.ExtractProperties();
                html.Append("<tr><td>");
                html.AppendFormat("<h3>{0}</h3>{1}", item.ToDiagramDTO.Name, string.Empty); //BuildDiagramImage(item.ToDiagramDTO));
                html.Append("</td>");
                //html.Append("</div>");
                if (item.SubItems.Count == 0)
                {
                    //html.Append("<hr/>");
                    //html.Append("<br/>");
                    html.Append("</tr>");
                    html.Append("</table>");
                }
                //html.Append("</td></tr>");

                BuildSeries(html, item);
                html.Append("</table>");
            }
        }
コード例 #6
0
        private void BuildSequence(StringBuilder html, EndToEndDTO current)
        {
            if (current.SubItems == null || current.SubItems.Count == 0) return;

            foreach (var item in current.SubItems)
            {
                if (item.ToDiagramDTO == null) continue;
                html.Append("<table border='1'>");
                html.Append("<tr>");
                html.Append("<td valign='top'>");
                item.ToDiagramDTO.ExtractProperties();
                html.AppendFormat("<h3>{0}</h3>{1}", item.ToDiagramDTO.Name, this.showimage ? BuildDiagramImage(item.ToDiagramDTO) : string.Empty);
                html.Append("</td>");
                html.Append("<td valign='top'>");
                BuildSequence(html, item);
                html.Append("</td>");
                html.Append("</tr>");
                html.Append("</table>");
            }
        }