public override object BuildDetail(EntityDTO dto) { RoleDetailDTO detail = new RoleDetailDTO(); EntityData data = new EntityData(); EntityDTO description = data.GetRoleDetail(dto.ID); description.ExtractProperties(); detail.Responsibilities = description.RenderHTML(GlobalStringResource.Responsibilities, RenderOption.Break); detail.Description = BuildDescription(dto); detail.ReferencedDocuments = BuildReferencedDocuments(dto); return detail; }
public string BuildDiagramContent(EntityDTO dto) { EntityData data = new EntityData(); FileData files = new FileData(); FileDTO file = files.GetFile(dto.DGXFileName); byte[] imageBytes = file.Data; string path = string.Format("{0}_{1}", file.Date.ToFileTime().ToString(), dto.DGXFileName); int poolCount = data.GetPoolCount(dto.ID); WmfImageManager imageManager = new WmfImageManager(dto, imageBytes, path, dto.Type, poolCount, false); path = imageManager.ProcessImage(); return path.Replace(@"\", @"/"); }
protected virtual string BuildChangeHistory(int id) { string result = string.Empty; EntityData entityData = new EntityData(); List<EntityDTO> changeHistory = entityData.GetChangeHistory(id); ChangeHistoryComparer comparer = new ChangeHistoryComparer(); changeHistory.Sort(comparer); if (changeHistory.Count > 0) { HtmlTable t = new HtmlTable(4, 0, "grid"); //t.AddHeader(GlobalStringResource.ChangeHistory, 4); t.AddHeader(GlobalStringResource.Version); t.AddHeader(GlobalStringResource.Date); t.AddHeader(GlobalStringResource.ReasonforChange); t.AddHeader(GlobalStringResource.AuthorOnly); foreach (EntityDTO related in changeHistory) { related.ExtractProperties(); t.AddCell(related.RenderHTML(GlobalStringResource.Version, RenderOption.Span)); t.AddCell(related.RenderHTML(GlobalStringResource.Date, RenderOption.Span)); t.AddCell(related.RenderHTML(GlobalStringResource.ReasonforChange, RenderOption.Span)); List<EntityDTO> users = entityData.GetRelatedPersons(related.ID); StringBuilder userLinks = new StringBuilder(); if (users.Count > 0) { foreach (EntityDTO user in users) { userLinks.Append(user.RenderAsPopupLink()); userLinks.Append(GlobalStringResource.BreakTag); } } t.AddCell(userLinks.ToString()); } result = t.EndHtmlTable(); } return result; }
public static List<BusinessRule> ConvertToListOfBusinessRule(List<Strategy2020ListItemDTO> list) { EntityData eData = new EntityData(); List<BusinessRule> rules = new List<BusinessRule>(); foreach (var item in list) { EntityDTO dto = eData.GetOneEntity(item.RuleID); dto.ExtractProperties(); BusinessRule p = new BusinessRule() { BusinessRuleID = item.RuleID, BusinessRuleName = (dto == null) ? item.RuleName : string.Format("{0} ({1})", item.RuleName, dto.RenderHTML(GlobalStringResource.Description, ADB.SA.Reports.Entities.Enums.RenderOption.None)), ShortBusinessRuleName = item.RuleName }; rules.Add(p); } return rules; }
/// <summary> /// /// </summary> /// <param name="dto"></param> /// <returns></returns> protected virtual string BuildDiagramImage(EntityDTO dto) { StringBuilder html = new StringBuilder(); EntityData data = new EntityData(); FileData files = new FileData(); FileDTO file = files.GetFile(dto.DGXFileName); byte[] imageBytes = file.Data; string path = string.Format("{0}_{1}", file.Date.ToFileTime().ToString(), dto.DGXFileName); int poolCount = data.GetPoolCount(dto.ID); WmfImageManager imageManager = new WmfImageManager(dto, imageBytes, path, dto.Type, poolCount, false); path = imageManager.ProcessImage(); html.AppendFormat(GlobalStringResource.Presenter_BuildDiagramImage_Tag, path.Replace(@"\", @"/")); html.Append(GlobalStringResource.BreakTag); return html.ToString(); }
public static List<BreadCrumbItemDTO> BuildBreadcrumbContent(EntityDTO currentDTO) { data = new EntityData(); BreadCrumbItemDTO home = new BreadCrumbItemDTO() { Order = 0, Label = "Home", Link = "Default.aspx", }; List<BreadCrumbItemDTO> breadcrumbs = new List<BreadCrumbItemDTO>(); breadcrumbs.Add(home); if (currentDTO != null) { switch (currentDTO.Type) { //Don't show any Breadcrumb on the home page //because it doesn't make any sense case 104: return breadcrumbs; case 142: //if the entity has parent, find it then put it before the selected entity breadcrumbs = CreateBreadcrumbWithSecondLevel(currentDTO, breadcrumbs); break; default: //Home > current selected BreadCrumbItemDTO defaultItem = new BreadCrumbItemDTO() { Order = 1, Label = currentDTO.Name, CssClass = "breadcrumb-active", }; breadcrumbs.Add(defaultItem); break; } } return breadcrumbs.OrderBy(c => c.Order).ToList(); }
private List<RolesAndResponsibilityItem> RolesAndResponsibilities(int id) { List<RolesAndResponsibilityItem> rrs = new List<RolesAndResponsibilityItem>(); EntityData entityData = new EntityData(); List<EntityDTO> rolesAndResponsibilities = entityData.GetRolesAndResponsibilities(id); if (rolesAndResponsibilities.Count > 0) { foreach (EntityDTO dto in rolesAndResponsibilities) { RolesAndResponsibilityItem rr = new RolesAndResponsibilityItem(); dto.ExtractProperties(); EntityDTO descriptionDto = entityData.GetRolesDescription(dto.ID); string description = string.Empty; if (descriptionDto != null) { descriptionDto.ExtractProperties(); description = descriptionDto.RenderHTML(GlobalStringResource.Description, RenderOption.Break); } rr.Role = dto.RenderHTML(GlobalStringResource.Role, RenderOption.None); rr.Responsibilities = description; rrs.Add(rr); } } return rrs; }
private List<ChangeHistoryItem> ChangeHistory(int id) { List<ChangeHistoryItem> items = new List<ChangeHistoryItem>(); EntityData entityData = new EntityData(); List<EntityDTO> changeHistory = entityData.GetChangeHistory(id); ChangeHistoryComparer comparer = new ChangeHistoryComparer(); changeHistory.Sort(comparer); if (changeHistory.Count > 0) { foreach (EntityDTO related in changeHistory) { ChangeHistoryItem ch = new ChangeHistoryItem(); related.ExtractProperties(); ch.Version = related.RenderHTML(GlobalStringResource.Version, RenderOption.Span); ch.Date = related.RenderHTML(GlobalStringResource.Date, RenderOption.Span); ch.Reason = related.RenderHTML(GlobalStringResource.ReasonforChange, RenderOption.Span); List<EntityDTO> users = entityData.GetRelatedPersons(related.ID); StringBuilder userLinks = new StringBuilder(); if (users.Count > 0) { foreach (EntityDTO user in users) { userLinks.Append(user.RenderAsPopupLink()); userLinks.Append(GlobalStringResource.BreakTag); } } ch.Author = userLinks.ToString(); items.Add(ch); } } return items; }
public override object BuildDetail(EntityDTO dto) { BpmnDetailDTO detail = new BpmnDetailDTO(); EntityData data = new EntityData(); detail.Title = dto.Name; EntityDTO parent = data.GetActivityOverviewParent(dto.ID); //TODO: detail.RelatedSubprocess = parent.Name; detail.User = dto.RenderHTML(GlobalStringResource.User, RenderOption.Break); detail.ActivityNature = dto.RenderHTML(GlobalStringResource.ActivityNature, RenderOption.Break); detail.TriggerInput = dto.RenderHTML(GlobalStringResource.TriggerInput, RenderOption.Break); detail.Output = dto.RenderHTML(GlobalStringResource.Output, RenderOption.Break); detail.ActivityStepDescription = dto.RenderHTML(GlobalStringResource.ActivityStepDescription, RenderOption.Break); detail.ActivityNarrative = dto.RenderHTML(GlobalStringResource.ActivityNarrative, RenderOption.Break); List<EntityDTO> variations = data.GetActivityVariations(dto.ID); if (variations.Count > 0) { foreach (EntityDTO variation in variations) { ActivityVariationItem av = new ActivityVariationItem(); variation.ExtractProperties(); av.ActivityVariation = variation.Name; av.Description = variation.RenderHTML(GlobalStringResource.Description, RenderOption.Break); detail.ActivityVariations.Add(av); } } List<EntityDTO> mappings = data.GetSubProcessParagraphs(dto.ID); if (mappings.Count > 0) { foreach (EntityDTO map in mappings) { ParagraphItem p = new ParagraphItem(); map.ExtractProperties(); p.ParagraphName = MappingToolUrlHelper.GenerateValidParagraphLinkMarkup(map.Name); p.ParagraphRef = map.RenderHTMLAsAnchor(GlobalStringResource.ParagraphReference, RenderOption.Span, true); detail.Paragraphs.Add(p); } } List<EntityDTO> useCases = data.GetUseCases(dto.ID); if (useCases.Count > 0) { foreach (EntityDTO useCase in useCases) { UseCaseItem uc = new UseCaseItem(); useCase.ExtractProperties(); uc.UseCaseID = useCase.Name; uc.Description = useCase.RenderHTML(GlobalStringResource.Description, RenderOption.Break); detail.UseCases.Add(uc); } } List<EntityDTO> requiredData = data.GetRequiredData(dto.ID); if (requiredData.Count > 0) { requiredData.Sort((b1, b2) => string.Compare(b1.Name, b2.Name, true)); foreach (EntityDTO document in requiredData) { RequiredDataItem rq = new RequiredDataItem(); document.ExtractProperties(); rq.RequiredData = document.Name; rq.Description = document.RenderHTML(GlobalStringResource.Description, RenderOption.Break); detail.RequiredData.Add(rq); } } List<EntityDTO> sampleReferences = data.GetSampleReference(dto.ID); if (sampleReferences.Count > 0) { foreach (EntityDTO reference in sampleReferences) { SampleReferenceItem sr = new SampleReferenceItem(); reference.ExtractProperties(); sr.SampleReference = reference.Name; sr.Description = reference.RenderHTML(GlobalStringResource.Description, RenderOption.Break); sr.ReferenceLink = reference.RenderHTMLAsAnchor(GlobalStringResource.ReferenceLink, RenderOption.Span, true); detail.SampleReferences.Add(sr); } } return detail; }
protected virtual PdfContentParameter CreateReviewers(EntityDTO dto) { PdfPTable t = CreateTable(4, true); float[] widths = new float[] { 2f, 5f, 1f, 1f }; t.SetWidths(widths); t.AddCell(CreateHeader3(GlobalStringResource.Reviewers, 4)); t.AddCell(CreateHeaderCell(GlobalStringResource.Name)); t.AddCell(CreateHeaderCell(GlobalStringResource.Position)); t.AddCell(CreateHeaderCell(GlobalStringResource.Date)); t.AddCell(CreateHeaderCell(GlobalStringResource.Signature)); EntityData entityData = new EntityData(); //TODO: //What if both have reviewers List<string> reviewers = RemoveBelongsToOrg(dto.GetPropertyList(GlobalStringResource.Reviewers)); List<EntityDTO> reviewerList = entityData.GetReviewersAndApprovers(dto.ID); if (reviewers != null && reviewers.Count > 0) { foreach (string reviewer in reviewers) { EntityDTO rev = reviewerList.Find(x => x.Name == reviewer.Trim()); if (rev == null) { t.AddCell(string.Empty); } else { rev.ExtractProperties(); t.AddCell(new Phrase(rev.RenderHTML("Assigned to", RenderOption.None), FontFactory.GetFont(FontFactory.HELVETICA, 8))); } t.AddCell(new Phrase(reviewer, FontFactory.GetFont(FontFactory.HELVETICA, 8))); t.AddCell(string.Empty); t.AddCell(string.Empty); } } t.AddCell(CreatePaddingCell(4, 15)); return new PdfContentParameter() { Table = t }; }
public SubProcessContentStrategy() { entityData = new EntityData(); }
public GenerateReportPresenter(IGenerateReportView view) { this.view = view; this.entityData = new EntityData(); this.filesData = new FileData(); }
protected virtual string BuildRolesAndResponsibilities(int id) { string result = string.Empty; EntityData entityData = new EntityData(); List<EntityDTO> rolesAndResponsibilities = entityData.GetRolesAndResponsibilities(id); if (rolesAndResponsibilities.Count > 0) { HtmlTable t = new HtmlTable(2, 0, "grid", new int[] { 20, 80 } ); t.AddHeader(GlobalStringResource.Role); t.AddHeader(GlobalStringResource.Responsibilities); foreach (EntityDTO dto in rolesAndResponsibilities) { dto.ExtractProperties(); EntityDTO descriptionDto = entityData.GetRolesDescription(dto.ID); string description = string.Empty; if (descriptionDto != null) { descriptionDto.ExtractProperties(); description = descriptionDto.RenderHTML(GlobalStringResource.Description, RenderOption.Break); } t.AddCell(dto.RenderHTML(GlobalStringResource.Role, RenderOption.None));//(Resources.Role, RenderOption.Paragraph)); t.AddCell(description); } result = t.EndHtmlTable(); } return result; }
public SubProcessReportStrategy() { entityData = new EntityData(); }
private Phrase CreateBusinessRulesRequiredData(string businessRuleKey) { if (string.IsNullOrEmpty(businessRuleKey)) { return new Phrase(new Chunk(string.Empty)); } string[] keys = businessRuleKey.Split( new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries ); EntityData data = new EntityData(); StringBuilder html = new StringBuilder(); foreach (string key in keys) { EntityDTO dto = entityData.GetOneEntity(key.Trim()); if (dto != null) { dto.ExtractProperties(); html.AppendFormat("{0}{1}{2}", key,Environment.NewLine, dto.RenderHTML(GlobalStringResource.Description, RenderOption.NewLine)); } } return new Phrase(new Chunk(html.ToString(), FontFactory.GetFont(GlobalStringResource.Font_Arial, 10))); }
public ProcessReportStrategy() { data = new EntityData(); }
public List<CommentExcelDTO> GetCommentForExcel(string ids) { EntityData eData = new EntityData(); string[] idList = ids.Split(new string[]{ "," }, StringSplitOptions.RemoveEmptyEntries); List<CommentExcelDTO> excelComments = new List<CommentExcelDTO>(); foreach (string id in idList) { CommentExcelDTO commentExcelItem = new CommentExcelDTO(); EntityDTO dto = eData.GetOneEntity(int.Parse(id)); commentExcelItem.ID = dto.ID; commentExcelItem.Name = dto.Name; //TODO: Handle attachments someday commentExcelItem.Comments = GetAllCommentsByDiagramID(dto.ID); excelComments.Add(commentExcelItem); } return excelComments; }
public SearchPresenter(ISearchView view) { this.view = view; entityData = new EntityData(); }
public void RenderDetail(int id) { if (this.cache.GetData("asiscontent") != null) { string cachedContent = CacheHelper.GetFromCacheWithCheck<string>("asiscontent"); this.view.RenderContent(cachedContent); return; } AsIsData asIsData = new AsIsData(); EntityData entityData = new EntityData(); Dictionary<string, List<AsIsItemEntity>> sectionList = asIsData.GetSections(); //StringBuilder html = new StringBuilder(); EntityDTO mainDto = entityData.GetOneEntity(id); List<EntityDTO> symbols = asIsData.GetAllAsIsSymbols(id); foreach (EntityDTO symbol in symbols) { EntityDTO defDto = entityData.GetRelatedDefinition(symbol.ID); //04-07-2013 //Added this check in order to ignore //symbols which doesnt have definition if (defDto == null) { continue; } defDto.ExtractProperties(); string group = defDto.RenderHTML(GlobalStringResource.ProcessModelGroup, RenderOption.None); int itemorder = 0; string order = defDto.RenderHTML("Item Order", RenderOption.None); if (!string.IsNullOrEmpty(order)) { int.TryParse(order, out itemorder); } List<EntityDTO> relatedDiagramDto = entityData.GetChildDiagrams(symbol.ID); if (sectionList.ContainsKey(group)) { sectionList[group].Add( new AsIsItemEntity() { DefinitionDTO = defDto, DiagramDTO = relatedDiagramDto, ItemOrder = itemorder }); } } /* * Arrange the items per group * if the item order is 0 then group the zeroes the arrange them alphabetically * then group the ones with orders then arrange them * clear the original list * append the zeroes first then the ordered */ foreach (KeyValuePair<string, List<AsIsItemEntity>> section in sectionList) { var list = section.Value; var zeroes = list.Where(c => c.ItemOrder == 0) .OrderBy(d=>d.DefinitionDTO.Name).ToList(); var ordered = list.Where(x => x.ItemOrder > 0) .OrderBy(y => y.ItemOrder).ToList(); section.Value.Clear(); section.Value.AddRange(zeroes); section.Value.AddRange(ordered); } //html.Append(BreadcrumbHelper.BuildBreadcrumb(mainDto)); //html.Append(Resources.Split); //html.Append(mainDto.Name); //html.Append(Resources.Split); AsIsDiagramSection diagrams = AsIsDiagramSection.GetConfig(); HomePageContentDTO home = new HomePageContentDTO(); home.DiagramSection = diagrams; home.SectionList = sectionList; home.LeftGroupName = diagrams.LeftGroup.Name; home.LeftGroupCssClass = diagrams.LeftGroup.CssClass; home.RightGroupName = diagrams.RightGroup.Name; home.RightGroupCssClass = diagrams.RightGroup.CssClass; home.CurrentID = id; home.Title = mainDto.Name; if (ShowInformationBox()) { //adds the info box on the homepage //html.AppendFormat("<div id=\"home-info-box\" class=\"infoBox asis-info\"><a onclick=\"SetCookie('hide_home_box','1','30');remove_element('home-info-box');\" class=\"home-close ui-icon ui-icon-closethick\">Close</a>{0}</div>", AppSettingsReader.GetValue("HOME_DESCRIPTION")); home.HomeInformation = AppSettingsReader.GetValue("HOME_DESCRIPTION"); } //RenderOuterDivs(html, diagrams.LeftGroup, sectionList); //RenderOuterDivs(html, diagrams.RightGroup, sectionList); //html.AppendFormat(GlobalStringResource.Presenter_ReportId_HiddenField, id); //CacheHelper.AddToCacheWithCheck("asiscontent", html.ToString()); view.RenderHomePageData(home); }
public DefaultPagePresenter(IDefaultView view) { this.view = view; data = new EntityData(); }
protected virtual PdfContentParameter CreateChangeHistory(EntityDTO dto) { EntityData data = new EntityData(); PdfPTable t = CreateTable(4, true); float[] widths = new float[] { 1f, 2f, 6f, 3f }; t.SetWidths(widths); List<EntityDTO> changehistory = data.GetChangeHistory(dto.ID); ChangeHistoryComparer comparer = new ChangeHistoryComparer(); changehistory.Sort(comparer); t.AddCell(CreateHeader3(GlobalStringResource.DocumentHistoryAndApproval, 4)); t.AddCell(CreatePaddingCell(4, 10)); t.AddCell(CreateHeader3(GlobalStringResource.ChangeHistory, 4)); t.AddCell(CreateHeaderCell(GlobalStringResource.Version)); t.AddCell(CreateHeaderCell(GlobalStringResource.Date)); t.AddCell(CreateHeaderCell(GlobalStringResource.ReasonforChange)); t.AddCell(CreateHeaderCell(GlobalStringResource.AuthorOnly)); if (changehistory.Count > 0) { foreach (EntityDTO related in changehistory) { related.ExtractProperties(); t.AddCell(CreatePlainContentCell(related.RenderHTML(GlobalStringResource.Version, RenderOption.None))); t.AddCell(CreatePlainContentCell(related.RenderHTML(GlobalStringResource.Date, RenderOption.None))); t.AddCell(CreatePlainContentCell(related.RenderHTML(GlobalStringResource.ReasonforChange, RenderOption.NewLine))); t.AddCell(CreatePlainContentCell(related.RenderHTML(GlobalStringResource.AuthorOnly, RenderOption.NewLine))); } } t.AddCell(CreatePaddingCell(4, 15)); return new PdfContentParameter() { Table = t }; }
protected override string BuildDiagramImage(EntityDTO dto) { StringBuilder html = new StringBuilder(); EntityData data = new EntityData(); FileData files = new FileData(); FileDTO file = files.GetFile(dto.DGXFileName); byte[] imageBytes = file.Data; string path = string.Format("{0}_{1}", file.Date.ToFileTime().ToString(), dto.DGXFileName); int poolCount = data.GetPoolCount(dto.ID); WmfImageManager imageManager = new WmfImageManager(dto, imageBytes, path, dto.Type, poolCount, false); path = imageManager.ProcessImage(); html.Append("<div id=\"diagram-line\" class=\"clearfix\">"); html.Append("<div id=\"diagram-line-left\" class=\"infoBox\">To navigate to the related process and sub-process of this diagram, use the menu on the right.<br/>To navigate related informations, select the tabs above.</div>"); if (dto.Type == 111) { html.Append(BuildQuickLinks(dto)); } html.Append("<div style=\"clear: both;\"></div>"); html.Append("</div>"); html.AppendFormat(GlobalStringResource.Presenter_BuildDiagramImage_Tag, path.Replace(@"\", @"/")); html.Append(GlobalStringResource.BreakTag); return html.ToString(); }
/// <summary> /// Gets the child items of the parent. /// </summary> /// <param name="type">type number of the diagram.</param> /// <returns>Key value pair of ID and text of child item.</returns> private Dictionary<int, string> GetSubDiagrams(int type) { EntityData data = new EntityData(); IDataReader reader = db.ExecuteReader(CommandType.Text, string.Format(GlobalStringResource.Data_GetSubDiagramsQuery, type)); Dictionary<int, string> list = new Dictionary<int, string>(); int idIndex = reader.GetOrdinal(GlobalStringResource.ID); int nameIndex = reader.GetOrdinal(GlobalStringResource.Name); while (reader.Read()) { int id = reader.GetInt32(idIndex); string name = reader.GetString(nameIndex); EntityDTO dto = data.GetOneEntity(id); if (SAModeHelper.IsValidForCurrentMode(id)) // && (dto != null && dto.Publish == true)) { list.Add(id, name); } //if(GroupFilterHelper.IsValidForShow(type, id)) //{ // list.Add(id, name); //} } reader.Close(); reader.Dispose(); return list; }
public ProcessStrategy() { entityData = new EntityData(); }
public BpmnDetailCTLStrategy() { entityData = new EntityData(); }
protected string BuildDiagramImageReturningPath(EntityDTO dto) { StringBuilder html = new StringBuilder(); EntityData data = new EntityData(); FileData files = new FileData(); FileDTO file = files.GetFile(dto.DGXFileName); byte[] imageBytes = file.Data; string path = string.Format("{0}_{1}", file.Date.ToFileTime().ToString(), dto.DGXFileName); int poolCount = data.GetPoolCount(dto.ID); WmfImageManager imageManager = new WmfImageManager(dto, imageBytes, path, dto.Type, poolCount, false); path = imageManager.ProcessImage(); return path; }