Exemplo n.º 1
0
        public IEnumerable <long> GetChildren(long parent, ParentModes mode, long qualifier)
        {
            List <long> children = new List <long>();

            using (VistaDBConnection conn = new VistaDBConnection(this.db))
            {
                VistaDBCommand cmd;
                cmd = new VistaDBCommand("select id from InnerRelations where nParentId=@parentId", conn);
                cmd.Parameters.AddWithValue("@parentId", parent);
                if (qualifier != 0)
                {
                    cmd.CommandText += " and qualifierId=@qualifierId";
                    cmd.Parameters.AddWithValue("@qualifierId", qualifier);
                }

                if (mode == ParentModes.normative || mode == ParentModes.both)
                {
                    using (VistaDBDataReader rd = cmd.ExecuteReader())
                    {
                        while (rd.Read())
                        {
                            children.Add(rd.GetInt64(0));
                        }
                    }
                }

                if (mode == ParentModes.associative || mode == ParentModes.both)
                {
                    cmd.CommandText = cmd.CommandText.Replace("nParentId", "aParentId");
                    using (VistaDBDataReader rd = cmd.ExecuteReader())
                    {
                        while (rd.Read())
                        {
                            children.Add(rd.GetInt64(0));
                        }
                    }
                }
            }

            return(children);
        }
Exemplo n.º 2
0
 public bool DeepEquals(DestinyActivityModeDefinition other)
 {
     return(other != null &&
            ActivityModeCategory == other.ActivityModeCategory &&
            ActivityModeMappings.DeepEqualsReadOnlyDictionaryWithDefinitionKeyAndSimpleValue(other.ActivityModeMappings) &&
            Display == other.Display &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            FriendlyName == other.FriendlyName &&
            IsAggregateMode == other.IsAggregateMode &&
            IsTeamBased == other.IsTeamBased &&
            ModeType == other.ModeType &&
            Order == other.Order &&
            ParentModes.DeepEqualsReadOnlyCollections(other.ParentModes) &&
            PgcrImage == other.PgcrImage &&
            SupportsFeedFiltering == other.SupportsFeedFiltering &&
            Tier == other.Tier &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemplo n.º 3
0
        public IEnumerable <long> GetChildren(long parent, ParentModes mode, long qualifier)
        {
            List <long> children = new List <long>();

            // select all normative children
            if (mode == ParentModes.normative || mode == ParentModes.both)
            {
                Dictionary <long, long> nChildren;
                if (this.parentIndex.TryGetValue(parent, out nChildren))
                {
                    children.AddRange(nChildren.Values);
                }
            }

            // select all associative children
            if (mode == ParentModes.associative || mode == ParentModes.both)
            {
                List <long> aChildren;
                if (this.aParentIndex.TryGetValue(parent, out aChildren))
                {
                    children.AddRange(aChildren);
                }
            }

            // delete all children from the selection not matching the qualifier
            if (qualifier > 0)
            {
                for (int i = children.Count - 1; i >= 0; i--)
                {
                    if (this.relations[(int)children[i]].qualifier != qualifier)
                    {
                        children.RemoveAt(i);
                    }
                }
            }

            return(children);
        }
Exemplo n.º 4
0
 public IEnumerable <long> GetChildren(long parent, ParentModes mode)
 {
     return(this.GetChildren(parent, mode, 0));
 }