protected virtual IEnumerable <GraphNode> DoGetSubscribers(GDID gEmitterNode, long start, int count)
        {
            var qryVol = Queries.FindSubscriberVolumes <SubscriberVolumeRow>(gEmitterNode);
            IEnumerable <SubscriberVolumeRow> volumes = ForNode(gEmitterNode).LoadEnumerable(qryVol);
            var sum = 0;
            SubscriberVolumeRow volume = null;
            var i = 0;

            foreach (var vol in volumes)
            {
                if (sum <= start && start <= sum + SocialConsts.GetVolumeMaxCountForPosition(i++))
                {
                    volume = vol;
                    break;
                }
                sum += vol.Count;
            }
            if (volume == null)
            {
                yield break;
            }
            var _start      = start - sum;
            var qry         = Queries.FindSubscribers <SubscriberRow>(volume.G_SubscriberVolume, _start, count);
            var subscribers = ForNode(volume.G_SubscriberVolume).LoadEnumerable(qry);

            foreach (var subscriber in subscribers)
            {
                yield return(DoGetNode(subscriber.G_Subscriber));
            }
        }
Exemple #2
0
        protected virtual SubscriberRow FindSubscriber(out SubscriberVolumeRow minCntVol)
        {
            minCntVol = null;
            IEnumerable <SubscriberVolumeRow> volumes = GetSubscriberVolumes();
            SubscriberRow result = null;
            var           i      = 0;

            foreach (var volume in volumes)
            {
                var qry = Queries.FindSubscriber <SubscriberRow>(volume, G_Subscriber);
                if (result == null)
                {
                    result = ForNode(volume.G_SubscriberVolume).LoadRow(qry);
                }
                if ((volume.Count < SocialConsts.GetVolumeMaxCountForPosition(i++)) && (minCntVol == null || minCntVol.Count > volume.Count))
                {
                    minCntVol = volume;
                }
            }
            return(result);
        }