コード例 #1
0
        async Task ExecuteLoadSearchResultsCommand(string term)
        {
            IsBusy = true;

            try
            {
                var results = await SportnetStore.GetSearchResults(term);

                Clubs.Clear();
                Persons.Clear();
                Competitions.Clear();
                Unions.Clear();

                foreach (var item in results)
                {
                    switch (item.Type)
                    {
                    case "person":
                        Persons.Add(item);
                        break;

                    case "club":
                        Clubs.Add(item);
                        break;

                    case "competition":
                        Competitions.Add(item);
                        break;

                    case "union":
                        Unions.Add(item);
                        break;

                    default:
                        break;
                    }
                }

                IsLoaded = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                var log = new ErrorLog()
                {
                    ExceptionType = ex.GetType().ToString(),
                    Status        = ErrorLog.LogStatus.Unread,
                    Message       = ex.Message,
                    ObjectId      = term,
                    Action        = "Searching",
                    Datetime      = DateTime.Now,
                };
                await LogError(log);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds an INTERSECT operator to the query, which returns the intersection of 2 or more datasets
        /// </summary>
        /// <param name="query">The query to compound in this query statement</param>
        /// <returns>Returns this instance of <see cref="SelectQueryBuilder"/></returns>
        public SelectQueryBuilder Intersect(SelectQueryBuilder query)
        {
            var statement = new UnionStatement()
            {
                Type  = UnionType.Intersect,
                Query = query
            };

            Unions.Add(statement);
            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Adds an INTERSECT operator to the query, which returns the intersection of 2 or more datasets
        /// </summary>
        /// <param name="table">The table to intersect</param>
        /// <returns>Returns a new instance of <see cref="SelectQueryBuilder"/> for the union query.</returns>
        public SelectQueryBuilder Intersect(string table)
        {
            var statement = new UnionStatement()
            {
                Type  = UnionType.Intersect,
                Query = new SelectQueryBuilder(Context).From(table)
            };

            Unions.Add(statement);
            return(statement.Query);
        }
コード例 #4
0
        /// <summary>
        /// Adds a UNION ALL clause to the query, which is used to combine the results of two or more
        /// SELECT statements and it does not remove duplicate rows between the various SELECT statements.
        /// </summary>
        /// <param name="query">The query to compound in this query statement</param>
        /// <returns>Returns this instance of <see cref="SelectQueryBuilder"/></returns>
        public SelectQueryBuilder UnionAll(SelectQueryBuilder query)
        {
            var statement = new UnionStatement()
            {
                Type  = UnionType.UnionAll,
                Query = query
            };

            Unions.Add(statement);
            return(this);
        }
コード例 #5
0
        /// <summary>
        /// Union
        /// </summary>
        /// <returns></returns>
        public virtual QueryDTO Union()
        {
            if (OrderBys != null)
            {
                throw new DTOException("使用Union不能使用Order By");
            }
            Union union = new Union();

            union.QueryWhere  = QueryWhere;
            union.QueryHaving = QueryHaving;
            union.Selects     = Selects;
            union.GroupBys    = GroupBys;
            union.OrderBys    = OrderBys;
            union.Joins       = Joins;
            union.DTOtype     = DTOtype;
            Unions.Add(union);
            Selects     = null;
            QueryWhere  = null;
            QueryHaving = null;
            GroupBys    = null;
            OrderBys    = null;
            Joins       = null;
            return(this);
        }
コード例 #6
0
ファイル: SelectQuery.cs プロジェクト: stsrki/linq2db
 public void AddUnion(SelectQuery union, bool isAll)
 {
     Unions.Add(new SqlUnion(union, isAll));
 }
コード例 #7
0
ファイル: Query.cs プロジェクト: FizzcodeSoftware/DbTools
 public Query Union(Query query)
 {
     Unions.Add(query);
     return(this);
 }