Exemple #1
0
 public void RenderHomePageData(ADB.SA.Reports.Entities.DTO.HomePageContentDTO dto)
 {
     Response.Write(JsonConvert.SerializeObject(dto));
     Response.End();
 }
        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 void RenderHomePageData(ADB.SA.Reports.Entities.DTO.HomePageContentDTO dto)
 {
     throw new NotImplementedException();
 }