/// <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 string BuildDiagramContent(int id, float percentage) { EntityData data = new EntityData(); EntityDTO dto = data.GetOneEntity(id); dto.ExtractProperties(); 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.ProcessImageWithPercentage(percentage); return path.Replace(@"\", @"/"); }
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; }
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); }
/// <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 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 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; }