Пример #1
0
        public virtual decimal?SumValue(CommonSearchNode parameter)
        {
            IQueryable <decimal?> list = null;

            list = this.db.Database.SqlQuery <decimal?>(parameter.GetSumValueSql()).AsQueryable();
            return(list.ToList()[0]);
        }
Пример #2
0
        /// <summary>
        /// 复杂条件查询数量
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public virtual int Count(CommonSearchNode parameter)
        {
            IQueryable <int> list = null;

            list = this.db.Database.SqlQuery <int>(parameter.GetCountSQL()).AsQueryable();

            return(list.ToList()[0]);
        }
Пример #3
0
        public IHttpActionResult Postsearch(CommonSearchNode parameter)
        {
            parameter.ClassName     = "Brand";
            parameter.FrameworkName = "Meter";

            IQueryable <Brand> list = null;

            brandBLL.Search(parameter, ref list);
            var result = list as IQueryable <Brand>;

            return(Ok(new { List = result.ToViewList(), Pagination = parameter.Pagination }));
        }
Пример #4
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;
        }
Пример #5
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());
        }