Esempio n. 1
0
        private void ProcessAttributeValues(Sku dbItem, Item resultItem)
        {
            var attVals = (from ei in dbItem.EntityInfos
                           from ed in ei.EntityDatas
                           let attributeName = ed.Attribute.AttributeName
                                               let attributeGroup =
                               ed.Attribute.AttributeGroups.Where(ag => ag.Group.Name.StartsWith("Search_"))
                               .Select(ag => ag.Group.Name.Substring(7))
                               .FirstOrDefault() ?? attributeName
                               where ed.Active
                               select
                               new ItemAttributeValue
            {
                Name = attributeName,
                Group = attributeGroup,
                Value = ed.Value + (ed.Uom != null ? " " + ed.Uom : string.Empty)
            }).ToArray();

            resultItem.AttributeValue = attVals;
            var nodeId = dbItem.Taxonomy.ID;

            foreach (var av in attVals)
            {
                var key = GetLovKey(nodeId, av.Name, av.Value);
                if (_lovs.ContainsKey(key))
                {
                    return;
                }

                var attVal = AttVal.FromValues(nodeId, av.Name, av.Group, av.Value);
                _lovs[key] = attVal;
            }
        }
Esempio n. 2
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.getAttributeNode">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Attr getAttributeNode(System.String name)
        {
            if (this.adaptee == null)
            {
                return(null);
            }

            AttVal att = this.adaptee.attributes;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                att = att.next;
            }
            if (att != null)
            {
                return(att.Adapter);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.removeAttribute">
        /// </seealso>
        public virtual void  removeAttribute(System.String name)
        {
            if (this.adaptee == null)
            {
                return;
            }

            AttVal att = this.adaptee.attributes;
            AttVal pre = null;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                pre = att;
                att = att.next;
            }
            if (att != null)
            {
                if (pre == null)
                {
                    this.adaptee.attributes = att.next;
                }
                else
                {
                    pre.next = att.next;
                }
            }
        }
Esempio n. 4
0
        /* --------------------- DOM ---------------------------- */

        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.getAttribute">
        /// </seealso>
        public virtual System.String getAttribute(System.String name)
        {
            if (this.adaptee == null)
            {
                return(null);
            }

            AttVal att = this.adaptee.attributes;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                att = att.next;
            }
            if (att != null)
            {
                return(att.value_Renamed);
            }
            else
            {
                return("");
            }
        }
Esempio n. 5
0
        private void ProcessLovs(SchemaInfo schemaInfo)
        {
            var nodeId         = schemaInfo.TaxonomyID;
            var attributeName  = schemaInfo.Attribute.AttributeName;
            var attributeGroup =
                schemaInfo.Attribute.AttributeGroups.Where(ag => ag.Group.Name.StartsWith("Search_"))
                .Select(ag => ag.Group.Name.Substring(7))
                .FirstOrDefault() ?? attributeName;

            var lovMetaDatas = from lov in schemaInfo.ListOfValues
                               where lov.Active
                               let enrichmentImage = new EnrichmentFileResourceType {
                Filename = lov.EnrichmentImage
            }
            let enrichment =
                new Enrichment {
                EnrichmentCopy = lov.EnrichmentCopy, EnrichmentPrimaryImage = enrichmentImage
            }
            select
            new
            {
                NodeId         = nodeId,
                AttributeName  = attributeName,
                AttributeGroup = attributeGroup,
                lov.Value,
                Enrichment = enrichment,
                lov.DisplayOrder
            };

            foreach (var lov in lovMetaDatas)
            {
                var key = GetLovKey(lov.NodeId, lov.AttributeName, lov.Value);
                if (!_lovs.ContainsKey(key))
                {
                    _lovs[key] = AttVal.FromValues(lov.NodeId, lov.AttributeName, lov.AttributeGroup, lov.Value);
                }

                var attVal = _lovs[key];
                attVal.Enrichment = lov.Enrichment;

                if (lov.DisplayOrder != null)
                {
                    attVal.SortableValue = string.Format("{0:000}-{1}", lov.DisplayOrder, lov.Value);
                }
            }

            var lovsToSave = _lovs.Where(l => l.Key.StartsWith(GetLovKey(nodeId, attributeName, string.Empty))).ToList();

            foreach (var lov in lovsToSave)
            {
                lov.Value.SerializeObject(GetSaveFilePath("AttVal", Guid.NewGuid().ToString()));
                AttVal val;
                _lovs.TryRemove(lov.Key, out val);
            }
        }
Esempio n. 6
0
 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
     if (attval.Val == null)
     {
         Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
     }
     else if (lexer.Options.FixBackslash)
     {
         attval.Val = attval.Val.Replace('\\', '/');
     }
 }
Esempio n. 7
0
 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
     if (attval.Val == null)
     {
         Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
     }
     else if (lexer.Options.FixBackslash)
     {
         attval.Val = attval.Val.Replace('\\', '/');
     }
 }
Esempio n. 8
0
        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal type = node.GetAttrByName("type");

            node.CheckUniqueAttributes(lexer);

            if (type == null)
            {
                Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                node.AddAttribute("type", "text/css");
            }
        }
Esempio n. 9
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Document.createAttribute">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Attr createAttribute(System.String name)
        {
            AttVal av = new AttVal(null, null, (int)'"', name, null);

            if (av != null)
            {
                av.dict = AttributeTable.DefaultAttributeTable.findAttribute(av);
                return((Comzept.Genesis.Tidy.Dom.Attr)av.Adapter);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 10
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.setAttributeNode">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Attr setAttributeNode(Comzept.Genesis.Tidy.Dom.Attr newAttr)
        {
            if (newAttr == null)
            {
                return(null);
            }
            if (!(newAttr is DOMAttrImpl))
            {
                throw new DOMExceptionImpl(DOMException.WRONG_DOCUMENT_ERR, "newAttr not instanceof DOMAttrImpl");
            }

            DOMAttrImpl newatt = (DOMAttrImpl)newAttr;

            System.String name = newatt.avAdaptee.attribute;
            Comzept.Genesis.Tidy.Dom.Attr result = null;

            AttVal att = this.adaptee.attributes;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                att = att.next;
            }
            if (att != null)
            {
                result      = att.Adapter;
                att.adapter = newAttr;
            }
            else
            {
                if (this.adaptee.attributes == null)
                {
                    this.adaptee.attributes = newatt.avAdaptee;
                }
                else
                {
                    newatt.avAdaptee.next   = this.adaptee.attributes;
                    this.adaptee.attributes = newatt.avAdaptee;
                }
            }
            return(result);
        }
        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal rel = node.GetAttrByName("rel");

            node.CheckUniqueAttributes(lexer);

            if (rel != null && rel.Val != null && rel.Val.Equals("stylesheet"))
            {
                AttVal type = node.GetAttrByName("type");

                if (type == null)
                {
                    Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                    node.AddAttribute("type", "text/css");
                }
            }
        }
Esempio n. 12
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.NamedNodeMap.getNamedItem">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Node getNamedItem(System.String name)
        {
            AttVal att = this.first;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                att = att.next;
            }
            if (att != null)
            {
                return(att.Adapter);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 13
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.removeAttributeNode">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Attr removeAttributeNode(Comzept.Genesis.Tidy.Dom.Attr oldAttr)
        {
            if (oldAttr == null)
            {
                return(null);
            }

            Comzept.Genesis.Tidy.Dom.Attr result = null;
            AttVal att = this.adaptee.attributes;
            AttVal pre = null;

            while (att != null)
            {
                if (att.Adapter == oldAttr)
                {
                    break;
                }
                pre = att;
                att = att.next;
            }
            if (att != null)
            {
                if (pre == null)
                {
                    this.adaptee.attributes = att.next;
                }
                else
                {
                    pre.next = att.next;
                }
                result = oldAttr;
            }
            else
            {
                throw new DOMExceptionImpl(DOMException.NOT_FOUND_ERR, "oldAttr not found");
            }
            return(result);
        }
Esempio n. 14
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.NamedNodeMap.item">
        /// </seealso>
        public virtual Comzept.Genesis.Tidy.Dom.Node item(int index)
        {
            int    i   = 0;
            AttVal att = this.first;

            while (att != null)
            {
                if (i >= index)
                {
                    break;
                }
                i++;
                att = att.next;
            }
            if (att != null)
            {
                return(att.Adapter);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 15
0
        /// <seealso cref="Comzept.Genesis.Tidy.Dom.Element.setAttribute">
        /// </seealso>
        public virtual void  setAttribute(System.String name, System.String value_Renamed)
        {
            if (this.adaptee == null)
            {
                return;
            }

            AttVal att = this.adaptee.attributes;

            while (att != null)
            {
                if (att.attribute.Equals(name))
                {
                    break;
                }
                att = att.next;
            }
            if (att != null)
            {
                att.value_Renamed = value_Renamed;
            }
            else
            {
                att      = new AttVal(null, null, (int)'"', name, value_Renamed);
                att.dict = AttributeTable.DefaultAttributeTable.findAttribute(att);
                if (this.adaptee.attributes == null)
                {
                    this.adaptee.attributes = att;
                }
                else
                {
                    att.next = this.adaptee.attributes;
                    this.adaptee.attributes = att;
                }
            }
        }
Esempio n. 16
0
 protected internal DOMAttrMapImpl(AttVal first)
 {
     this.first = first;
 }
Esempio n. 17
0
 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
 }
Esempio n. 18
0
 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
 }
Esempio n. 19
0
 protected internal DOMAttrImpl(AttVal adaptee) : base(null)
 {         // must override all methods of DOMNodeImpl
     this.avAdaptee = adaptee;
 }