Esempio n. 1
0
        public IList <MessageData> Search(CommonSearchNode parameter)
        {
            IQueryable <Message> list = null;

            if (parameter.Pagination.NoPaging == true)
            {
                list = this.db.Database.SqlQuery <Message>(parameter.GetSearchSQL()).AsQueryable();
            }
            else
            {
                list = this.db.Database.SqlQuery <Message>(parameter.GetSearchSQL()).AsQueryable().Skip(parameter.Pagination.Size * (parameter.Pagination.Index - 1)).Take(parameter.Pagination.Size);
            }

            parameter.Pagination.All = Count(parameter);
            if (parameter.Pagination.Size != 0)
            {
                parameter.Pagination.Count = parameter.Pagination.All / parameter.Pagination.Size;
            }
            return(list.ToViewList());
        }
Esempio n. 2
0
        /// <summary>
        /// 复杂条件查询
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public virtual void Search(CommonSearchNode parameter, ref IQueryable <TObject> list)
        {
            //IQueryable<TObject> list = null;
            list = this.db.Database.SqlQuery <TObject>(parameter.GetSearchSQL()).AsQueryable();

            if (parameter.Pagination != null)
            {
                parameter.Pagination.All = Count(parameter);
                if (parameter.Pagination.Size != 0)
                {
                    parameter.Pagination.Count = parameter.Pagination.All / parameter.Pagination.Size;
                }
            }

            // return null;
        }