예제 #1
0
        protected override SqlQuerySourceAttribute AddAttribute(string attrDefName)
        {
            string alias;
            SqlQuerySourceAttribute attribute;

            if (attrDefName.Length > 0 && attrDefName[0] == '&')
            {
                var ident = SystemIdentConverter.Convert(attrDefName);
                alias     = GetAttributeAlias(attrDefName);
                attribute = new SqlQueryDocSourceAttribute(ident, alias);
            }
            else
            {
                var attrDef = FindAttributeDef(attrDefName);
                if (attrDef == null)
                {
                    throw new ApplicationException(String.Format("Атрибут \"{0}\" не найден!", attrDefName));
                }
                alias     = GetAttributeAlias(attrDefName);
                attribute = new SqlQueryDocSourceAttribute(attrDef, alias);
            }
            AttributeAliases.Add(alias.ToUpper());

            Attributes.Add(attribute);

            return(attribute);
        }
예제 #2
0
        protected string GetAttributeAlias(string alias)
        {
            if (AttributeAliases == null)
            {
                AttributeAliases = new List <string>();
            }

            if (!String.IsNullOrEmpty(alias))
            {
                int i = 0;
                alias = alias.Replace(" ", "_");
                alias = alias.Replace("&", "");

                if (String.Equals(alias, "Id", StringComparison.OrdinalIgnoreCase) || AttributeAliases.Contains(alias.ToUpper()))
                {
                    do
                    {
                        i++;
                        alias = alias + i;
                    } while (AttributeAliases.Contains(alias.ToUpper()));
                }
            }
            else
            {
                do
                {
                    AttributeAliasNo++;
                    alias = "attr" + AttributeAliasNo;
                } while (AttributeAliases.Contains(alias.ToUpper()));
            }
            return(alias);
        }
예제 #3
0
        protected override SqlQuerySourceAttribute AddAttribute(SystemIdent attrIdent)
        {
            var alias = GetAttributeAlias(SystemIdentConverter.Convert(attrIdent));
            SqlQuerySourceAttribute attribute = new SqlQueryDocSourceAttribute(attrIdent, alias);

            AttributeAliases.Add(alias.ToUpper());

            Attributes.Add(attribute);

            return(attribute);
        }
예제 #4
0
        protected override SqlQuerySourceAttribute AddAttribute(string attrDefName)
        {
            var subAttribute = SubQuery.GetAttribute(attrDefName);

            var alias = GetAttributeAlias(String.IsNullOrEmpty(subAttribute.Alias) ? subAttribute.AliasName : subAttribute.Alias); //subAttribute.AliasName);

            if (!String.IsNullOrEmpty(AliasName))
            {
                alias = AliasName + "_" + alias;
            }
            AttributeAliases.Add(alias.ToUpper());
            var attribute = new SqlQuerySubSourceAttribute(subAttribute, alias);

            Attributes.Add(attribute);

            return(attribute);
        }
예제 #5
0
        protected override SqlQuerySourceAttribute AddAttribute(Guid attrDefId)
        {
            var attrDef = FindAttributeDef(attrDefId);

            if (attrDef == null)
            {
                throw new ApplicationException(String.Format("Атрибут \"{0}\" не найден!", attrDefId));
            }

            var alias = GetAttributeAlias(attrDef.Name);

            AttributeAliases.Add(alias.ToUpper());
            var attribute = new SqlQueryDocSourceAttribute(attrDef, alias);

            Attributes.Add(attribute);

            return(attribute);
        }
예제 #6
0
 /// <summary>
 /// Sets an alias for an attribute.
 /// </summary>
 /// <param name="name">the iText tagname</param>
 /// <param name="alias">the custom tagname</param>
 public override void AddAlias(string name, string alias)
 {
     AttributeAliases.Add(alias.ToLower(CultureInfo.InvariantCulture), name);
 }
 /// <summary>
 /// Sets an alias for an attribute.
 /// </summary>
 /// <param name="name">the iText tagname</param>
 /// <param name="alias">the custom tagname</param>
 public override void AddAlias(string name, string alias) => AttributeAliases.Add(alias.ToLowerInvariant(), name);