public BlockReasonQuery WithUser(User value = null,
                                         ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                         CollectionOperator @operator  = CollectionOperator.Equal,
                                         CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(br => br.Users.Any(u => u == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(br => br.Users.All(u => u == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(br => br.Users.Any(u => u != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(br => br.Users.All(u => u != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #2
0
        public CategoryQuery WithNews(News value = null,
                                      ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                      CollectionOperator @operator  = CollectionOperator.Equal,
                                      CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(c => c.News.Any(n => n == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(c => c.News.All(n => n == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(c => c.News.Any(n => n != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(c => c.News.All(n => n != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #3
0
        public GroupQuery WithPageId(long?value = null,
                                     ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                     CollectionOperator @operator  = CollectionOperator.Equal,
                                     CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(g => g.Pages.Any(p => p.Id == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(g => g.Pages.All(p => p.Id == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(g => g.Pages.Any(p => p.Id != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(g => g.Pages.All(p => p.Id != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
        public TicketStatusQuery WithTicket(Ticket value = null,
                                            ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                            CollectionOperator @operator  = CollectionOperator.Equal,
                                            CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(ts => ts.Tickets.Any(t => t == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(ts => ts.Tickets.All(t => t == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(ts => ts.Tickets.Any(t => t != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(ts => ts.Tickets.All(t => t != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
        public ResourceKeyQuery WithValue(ResourceValue value           = null,
                                          ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                          CollectionOperator @operator  = CollectionOperator.Equal,
                                          CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(rk => rk.Values.Any(rv => rv == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(rk => rk.Values.All(rv => rv == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(rk => rk.Values.Any(rv => rv != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(rk => rk.Values.All(rv => rv != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
        public RedirectorQuery WithArtist(Artist value = null,
                                          ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                          CollectionOperator @operator  = CollectionOperator.Equal,
                                          CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(r => r.Artists.Any(a => a == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(r => r.Artists.All(a => a == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(r => r.Artists.Any(a => a != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(r => r.Artists.All(a => a != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #7
0
        public PollChoiceQuery WithItem(PollChoiceItem value          = null,
                                        ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                        CollectionOperator @operator  = CollectionOperator.Equal,
                                        CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(pc => pc.Items.Any(pci => pci == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(pc => pc.Items.All(pci => pci == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(pc => pc.Items.Any(pci => pci != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(pc => pc.Items.All(pci => pci != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #8
0
        public MessageTemplateQuery WithBccEmailAddresses(string value = null,
                                                          ArgumentEvaluationMode mode   = ArgumentEvaluationMode.IgnoreNeutral,
                                                          CollectionOperator @operator  = CollectionOperator.Equal,
                                                          CollectionDirection direction = CollectionDirection.Any)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case CollectionOperator.Equal:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(mt => mt.BccEmailAddresses.Any(bea => bea == value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(mt => mt.BccEmailAddresses.All(bea => bea == value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            case CollectionOperator.NotEqual:
                switch (direction)
                {
                case CollectionDirection.Any:
                    Entities = Entities.Where(mt => mt.BccEmailAddresses.Any(bea => bea != value));
                    return(this);

                case CollectionDirection.All:
                    Entities = Entities.Where(mt => mt.BccEmailAddresses.All(bea => bea != value));
                    return(this);

                default:
                    throw new NotSupportedEnumException(direction);
                }

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
        public static ResourceKey GetByKey(this IDbService <ResourceKey, ResourceKeyQuery> service, string key)
        {
            if (Neutrals.Is(key))
            {
                return(null);
            }

            var resourceKey = service.Get(rkq => rkq.WithKey(key));

            return(resourceKey);
        }
Пример #10
0
        public static User GetByEmail(this IDbService <User, UserQuery> service, string email)
        {
            if (Neutrals.Is(email))
            {
                return(null);
            }

            var user = service.Get(uq => uq.WithEmail(email));

            return(user);
        }
Пример #11
0
        public static User GetByUserName(this IDbService <User, UserQuery> service, string userName)
        {
            if (Neutrals.Is(userName))
            {
                return(null);
            }

            var user = service.Get(uq => uq.WithUserName(userName));

            return(user);
        }
Пример #12
0
        public static bool AuthorizeBySystemName(this IDbService <PermissionRecord, PermissionRecordQuery> service, string systemName)
        {
            if (Neutrals.Is(systemName))
            {
                return(false);
            }

            var permissionRecord = service.GetBySystemName(systemName);

            return(Authorize(permissionRecord));
        }
Пример #13
0
        public static NewsletterSubscription GetByEmail(this IDbService <NewsletterSubscription, NewsletterSubscriptionQuery> service, string email)
        {
            if (Neutrals.Is(email))
            {
                return(null);
            }

            var newsletterSubscription = service.Get(nsq => nsq.WithEmail(email));

            return(newsletterSubscription);
        }
Пример #14
0
        public static NewsletterSubscription GetByGuid(this IDbService <NewsletterSubscription, NewsletterSubscriptionQuery> service, Guid guid)
        {
            if (Neutrals.Is(guid))
            {
                return(null);
            }

            var newsletterSubscription = service.Get(nsq => nsq.WithGuid(guid));

            return(newsletterSubscription);
        }
        public static Language GetByCultureCode(this IDbService <Language, LanguageQuery> service, string cultureCode)
        {
            if (Neutrals.Is(cultureCode))
            {
                return(null);
            }

            var language = service.Get(lq => lq.WithCultureCode(cultureCode));

            return(language);
        }
Пример #16
0
        public static Poll GetByPlaceholderKey(this IDbService <Poll, PollQuery> service,
                                               string placeholderKey)
        {
            if (Neutrals.Is(placeholderKey))
            {
                return(null);
            }

            var poll = service.Get(pq => pq.WithPlaceholderKey(placeholderKey));

            return(poll);
        }
Пример #17
0
        public static Order GetByGuid(this IDbService <Order, OrderQuery> service,
                                      Guid guid)
        {
            if (Neutrals.Is(guid))
            {
                return(null);
            }

            var order = service.Get(oq => oq.WithGuid(guid));

            return(order);
        }
        public static Setting GetByKey(this IDbService <Setting, SettingQuery> service,
                                       string key)
        {
            if (Neutrals.Is(key))
            {
                return(null);
            }

            var setting = service.Get(sq => sq.WithKey(key));

            return(setting);
        }
        public static TEntity GetBySystemName <TEntity, TQuery>(this IDbService <TEntity, TQuery> service,
                                                                string systemName) where TEntity : AttributeBase where TQuery : AttributeQueryBase <TEntity, TQuery>
        {
            if (Neutrals.Is(systemName))
            {
                return(null);
            }

            var attribute = service.Get(aq => aq.WithSystemName(systemName));

            return(attribute);
        }
Пример #20
0
        public static Redirector GetByTargetUrl(this IDbService <Redirector, RedirectorQuery> service,
                                                string targetUrl)
        {
            if (Neutrals.Is(targetUrl))
            {
                return(null);
            }

            var redirector = service.Get(rq => rq.WithTargetUrl(targetUrl));

            return(redirector);
        }
Пример #21
0
        public static TransactionRequest GetByComputedHash(this IDbService <TransactionRequest, TransactionRequestQuery> service,
                                                           string computedHash)
        {
            if (Neutrals.Is(computedHash))
            {
                return(null);
            }

            var transactionRequest = service.Get(trq => trq.WithComputedHash(computedHash));

            return(transactionRequest);
        }
Пример #22
0
        public static Redirector GetByShortHash(this IDbService <Redirector, RedirectorQuery> service,
                                                string shortHash)
        {
            if (Neutrals.Is(shortHash))
            {
                return(null);
            }

            var redirector = service.Get(rq => rq.WithShortHash(shortHash));

            return(redirector);
        }
        public QueuedEmailQuery WithSendingTries(int?value = null,
                                                 ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                                 IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(qe => qe.SendingTries == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(qe => qe.SendingTries != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(qe => qe.SendingTries >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(qe => qe.SendingTries > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(qe => qe.SendingTries <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(qe => qe.SendingTries < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #24
0
        public ScheduleTaskQuery WithMaximumRunningSeconds(int?value = null,
                                                           ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                                           IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(st => st.MaximumRunningSeconds == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(st => st.MaximumRunningSeconds != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(st => st.MaximumRunningSeconds >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(st => st.MaximumRunningSeconds > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(st => st.MaximumRunningSeconds <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(st => st.MaximumRunningSeconds < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #25
0
        public PollVotingRecordQuery WithPollId(long?value = null,
                                                ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                                IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(pvr => pvr.SelectedItem.Choice.Poll.Id < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #26
0
        public DownloadQuery WithContentLength(long?value = null,
                                               ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                               IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(d => d.ContentLength == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(d => d.ContentLength != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(d => d.ContentLength >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(d => d.ContentLength > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(d => d.ContentLength <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(d => d.ContentLength < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #27
0
        public EmailAccountQuery WithPort(int?value = null,
                                          ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                          IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(ea => ea.Port == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(ea => ea.Port != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(ea => ea.Port >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(ea => ea.Port > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(ea => ea.Port <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(ea => ea.Port < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #28
0
        public LikeQuery WithLikerId(long?value = null,
                                     ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                     IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(l => l.Liker.Id == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(l => l.Liker.Id != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(l => l.Liker.Id >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(l => l.Liker.Id > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(l => l.Liker.Id <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(l => l.Liker.Id < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #29
0
        public BannedIpQuery WithExpireDateUtc(DateTime?value = null,
                                               ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                               IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(bi => bi.ExpireDateUtc == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(bi => bi.ExpireDateUtc != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(bi => bi.ExpireDateUtc >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(bi => bi.ExpireDateUtc > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(bi => bi.ExpireDateUtc <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(bi => bi.ExpireDateUtc < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
Пример #30
0
        public OrderLineQuery WithPrice(int?value = null,
                                        ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                        IntegralOperator @operator  = IntegralOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case IntegralOperator.Equal:
                Entities = Entities.Where(ol => ol.Price == value);
                return(this);

            case IntegralOperator.NotEqual:
                Entities = Entities.Where(ol => ol.Price != value);
                return(this);

            case IntegralOperator.GreaterThanOrEqual:
                Entities = Entities.Where(ol => ol.Price >= value);
                return(this);

            case IntegralOperator.GreaterThan:
                Entities = Entities.Where(ol => ol.Price > value);
                return(this);

            case IntegralOperator.LessThanOrEqual:
                Entities = Entities.Where(ol => ol.Price <= value);
                return(this);

            case IntegralOperator.LessThan:
                Entities = Entities.Where(ol => ol.Price < value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }