private void ProcessAttributes(AFElementTemplate templ, AFAttributeTemplates attributes, string prefix)
        {
            foreach (AFAttributeTemplate attr in attributes)
            {
                if (attr == fDataReference.Attribute)
                {
                    continue;
                }

                string attrName = prefix + "|" + attr.Name;

                if (Extensions.IsNumericType(attr.Type))
                {
                    txtAttribute.Items.Add(attrName);
                }

                ProcessAttributes(templ, attr.AttributeTemplates, attrName);
            }
        }
예제 #2
0
        private AFAttributeList LoadParameters()
        {
            if (Attribute == null || Attribute.Element == null)
            {
                throw new ApplicationException("Attribute and/or element is null");
            }

            AFDatabase afDB    = base.Database;
            AFTable    afTable = afDB.Tables[fTableName];

            if (afTable == null)
            {
                throw new ArgumentException("Table not found");
            }
            fDataRows = afTable.Table.Select();

            var paramAttributes = new AFAttributeList();

            if (!string.IsNullOrEmpty(fAttributeName))
            {
                // find Attribute's object by it name from parameters (this attribute contains key values)
                var refAttr = AFAttribute.FindAttribute(fAttributeName, Attribute);
                if (refAttr == null)
                {
                    throw new ApplicationException(string.Format(Resources.ERR_AttributeHasNotBeenFound, fAttributeName));
                }

                if (!Extensions.IsNumericType(refAttr.Type))
                {
                    throw new ApplicationException(string.Format("The attribute `{0}` has no numeric type ", fAttributeName));
                }

                paramAttributes.Add(refAttr);
            }
            else
            {
                throw new ApplicationException("Name of lookup attribute is null or empty");
            }

            return(paramAttributes);
        }