Ejemplo n.º 1
0
            public new static NestedSiteMapEntity[] GetEntities(string EntityType)
            {
                Dictionary <int, NestedSiteMapEntity> _list = new Dictionary <int, NestedSiteMapEntity>();

                SqlCommand getCommand = getEntitySQL(EntityType);
                Action <System.Data.IDataReader> readEntities = rd =>
                {
                    while (rd.Read())
                    {
                        NestedSiteMapEntity entity = new NestedSiteMapEntity();
                        entity.EntityID       = rd.FieldInt("ID");
                        entity.Name           = XmlCommon.GetLocaleEntry(rd.Field("Name"), Customer.Current.LocaleSetting, false);
                        entity.SEName         = rd.Field("SEName");
                        entity.ParentEntityID = rd.FieldInt("ParentID");
                        entity.EntityType     = EntityType;
                        entity.GetProducts();
                        _list.Add(entity.EntityID, entity);
                    }
                };

                DB.UseDataReader(getCommand, readEntities);


                return(OrganizeEntities(_list).ToArray());
            }
Ejemplo n.º 2
0
        private void writeEntity(String group)
        {
            SiteMapEntity[] entities;
            if (group.ToLowerInvariant() != "topic")
            {
                entities = NestedSiteMapEntity.GetEntities(group);
            }
            else
            {
                entities = SiteMapEntity.GetTopics(group);
            }
            if (entities.Length == 0)
            {
                return;
            }
            XmlElement   cat = mapDoc.CreateElement("node");
            XmlAttribute txt = mapDoc.CreateAttribute("Text");

            txt.Value = getHeader(group);
            cat.Attributes.Append(txt);
            this.SiteMapRoot.AppendChild(cat);

            if (group.Equals("topic", StringComparison.OrdinalIgnoreCase))
            {
                foreach (SiteMapEntity ent in entities)
                {
                    cat.AppendChild(ent.ToSiteMapTopicNode(mapDoc));
                }
            }
            else
            {
                foreach (SiteMapEntity ent in entities)
                {
                    cat.AppendChild(ent.ToSiteMapNode(mapDoc));
                }
            }
        }
Ejemplo n.º 3
0
 public NestedSiteMapEntity()
 {
     Children = new NestedSiteMapEntity[] { };
     Products = new SiteMapProduct[] { };
 }