예제 #1
0
        /// <summary>
        /// 作用:查询
        /// 作者:汪建龙
        /// 编写时间:2017年3月16日20:41:13
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <LandView> Search(LandViewParameter parameter)
        {
            var query = Db.LandViews.AsQueryable();

            if (parameter.ELID.HasValue)
            {
                query = query.Where(e => e.ELID == parameter.ELID.Value);
            }
            if (parameter.SystemData.HasValue)
            {
                query = query.Where(e => e.SystemData == parameter.SystemData.Value);
            }
            if (!string.IsNullOrEmpty(parameter.Name))
            {
                query = query.Where(e => e.Name.ToLower().Contains(parameter.Name.ToLower()));
            }
            if (!string.IsNullOrEmpty(parameter.sName))
            {
                query = query.Where(e => e.sName.ToLower().Contains(parameter.sName.ToLower()));
            }
            if (!string.IsNullOrEmpty(parameter.Number))
            {
                query = query.Where(e => e.Number.ToLower().Contains(parameter.Number.ToLower()));
            }
            if (!string.IsNullOrEmpty(parameter.ContractNumber))
            {
                query = query.Where(e => e.ContractNumber.ToLower().Contains(parameter.ContractNumber.ToLower()));
            }
            if (parameter.Way.HasValue)
            {
                query = query.Where(e => e.Way == parameter.Way.Value);
            }
            query = query.OrderByDescending(e => e.CreateTime).SetPage(parameter.Page);
            return(query.ToList());
        }
        // GET: Land
        public ActionResult Index(
            string name   = null, string sName          = null,
            string number = null, string contractNumber = null,
            SoldWay?way   = null, int page = 1, int rows = 20)
        {
            var parameter = new LandViewParameter
            {
                Name           = name,
                sName          = sName,
                Number         = number,
                ContractNumber = contractNumber,
                Way            = way,
                Page           = new PageParameter(page, rows)
            };
            var list = Core.LandManager.Search(parameter);

            ViewBag.List      = list;
            ViewBag.Parameter = parameter;
            return(View());
        }