Esempio n. 1
0
        public SubscriberModel[] GetSubscriberProviders(long subscriberId)
        {
            using (var db = GetDBConnect())
            {
                var subscribers = from signalSubscriber in db.signal_subscribers


                                  join subscription in db.signal_subscriptions
                                  on signalSubscriber.id equals subscription.account_slave_id
                                  into subscriptionNull
                                  from subscription in Enumerable.DefaultIfEmpty(subscriptionNull)

                                  join provider in db.signal_providers
                                  on subscription.account_master_id equals provider.id
                                  into providerNull
                                  from provider in Enumerable.DefaultIfEmpty(providerNull)

                                  where signalSubscriber.id == subscriberId &&
                                  subscription != null &&
                                  (subscription.status == (short)SubscriptionStatus.On || subscription.status == (short)SubscriptionStatus.CloseOnly)

                                  select new SubscriberModel
                {
                    Subscriber   = signalSubscriber,
                    Subscription = subscription,
                    Provider     = provider
                };

                return(subscribers.ToArray());
            }
        }
Esempio n. 2
0
        public ProviderModel[] GetDeliveries(long clientId)
        {
            using (var db = GetDBConnect())
            {
                var providers = from signalProvider in db.signal_providers

                                join subscription in db.signal_subscriptions
                                on signalProvider.id equals subscription.account_master_id
                                into subscriptionNull
                                from subscription in Enumerable.DefaultIfEmpty(subscriptionNull)

                                join subscriber in db.signal_subscribers
                                on subscription.account_slave_id equals subscriber.id
                                into subscriberNull
                                from subscriber in Enumerable.DefaultIfEmpty(subscriberNull)

                                where signalProvider.client_account_id == clientId &&
                                (subscription == null || subscription.status == (short)SubscriptionStatus.On || subscription.status == (short)SubscriptionStatus.CloseOnly) &&
                                !signalProvider.isdeleted

                                select new ProviderModel
                {
                    Provider     = signalProvider,
                    Subscription = subscription,
                    Subscriber   = subscriber
                };

                return(providers.ToArray());
            }
        }
Esempio n. 3
0
    public void BlinqShouldEqualLinqNativeArrayDefaultIfEmpty([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.DefaultIfEmpty(source, 1)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(source.DefaultIfEmpty(1)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Esempio n. 4
0
 public static IEnumerable <TSource> DefaultIfEmpty <TSource>(this IEnumerable <TSource> source, TSource defaultValue) =>
 LinqEnumerable.DefaultIfEmpty(source, defaultValue);
 public static IEnumerable <TSource> DefaultIfEmpty <TSource>(this IEnumerable <TSource> source)
 => Enumerable.DefaultIfEmpty(source);