예제 #1
0
        /// <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);
        }
        private static void RenderIndividualDivs(StringBuilder outerHtml, string key, List <AsIsItemEntity> list, string color)
        {
            outerHtml.AppendFormat(Resources.DivWithClassPropertyFormat,
                                   GlobalStringResource.Presenter_GroupingCss);
            outerHtml.AppendFormat(GlobalStringResource.Presenter_AsIsHeaderFormat,
                                   GlobalStringResource.Presenter_GroupingHeaderCss, key);

            foreach (AsIsItemEntity dto in list)
            {
                string divId = Guid.NewGuid().ToString();

                string boxcolor      = dto.DefinitionDTO.RenderHTML("Symbol Box Color", RenderOption.None);
                string extendedStyle = string.Empty;
                string fontColor     = dto.DefinitionDTO.RenderHTML("Symbol Font Color", RenderOption.None);
                if (!string.IsNullOrEmpty(fontColor))
                {
                    extendedStyle = string.Format(" style=\"color:{0} !important;\" ", fontColor);
                }

                if (dto.DiagramDTO.Count == 1)
                {
                    outerHtml.AppendFormat(GlobalStringResource.Presenter_AsIsDiagramItemsFormat, GlobalStringResource.Presenter_SquareCss, divId, divId, divId, (!string.IsNullOrEmpty(boxcolor)? boxcolor : color), string.Empty);
                    outerHtml.Append(string.Format("<a href=\"Default.aspx?id={0}\" {1}>{2}</a>", dto.DiagramDTO.FirstOrDefault().ID, extendedStyle, dto.DefinitionDTO.Name));
                    outerHtml.Append(Resources.DivEndTag);
                    continue;
                }

                //RoundedCornersImageManager.CreateImage(color);
                //outerHtml.AppendFormat(GlobalStringResource.Presenter_AsIsDiagramItemsFormat2, GlobalStringResource.Presenter_SquareCss, divId, divId, divId, color.Remove(0, 1));

                string additionalProperty = string.Empty;
                if (dto.DiagramDTO.Count == 0)
                {
                    additionalProperty = "cursor:default !important";
                }

                outerHtml.AppendFormat(GlobalStringResource.Presenter_AsIsDiagramItemsFormat, GlobalStringResource.Presenter_SquareCss, divId, divId, divId, (!string.IsNullOrEmpty(boxcolor) ? boxcolor : color), additionalProperty);
                outerHtml.AppendFormat("<p {0}>{1}</p>", extendedStyle, dto.DefinitionDTO.Name);
                outerHtml.Append(Resources.DivEndTag);
                StringBuilder innerHtml = new StringBuilder();
                if (dto.DiagramDTO != null && dto.DiagramDTO.Count > 0)
                {
                    innerHtml.Append(Resources.UlStartTag);
                    foreach (EntityDTO innerDto in dto.DiagramDTO.OrderBy(d => d.Name).ToList())
                    {
                        if (SAModeHelper.IsValidForCurrentMode(innerDto.ID))
                        {
                            innerHtml.AppendFormat(
                                GlobalStringResource.Presenter_AsIsDiagramDetailItemsFormat,
                                innerDto.ID, innerDto.ID, innerDto.Name, innerDto.Name);
                        }
                        //if (GroupFilterHelper.IsValidForShowOnHomepage(innerDto.Type,
                        //    innerDto.ID))
                        //{
                        //    innerHtml.AppendFormat(GlobalStringResource.Presenter_AsIsDiagramDetailItemsFormat, innerDto.ID, innerDto.ID, innerDto.Name, innerDto.Name);
                        //}
                    }
                    innerHtml.Append(Resources.UlEndTag);
                    outerHtml.AppendFormat(GlobalStringResource.Presenter_DivFloatFormat, divId, GlobalStringResource.Presenter_SquareFloatCss, divId, divId, innerHtml.ToString());
                }
            }
            outerHtml.Append(Resources.DivEndTag);
        }