Пример #1
0
        public IQueryable <客戶聯絡人> Query(QueryContactModel model)
        {
            var data = this.All();

            if (model.CompanyId.HasValue)
            {
                data = data.Where(p => p.客戶Id == model.CompanyId);
            }

            if (!string.IsNullOrEmpty(model.CompanyName))
            {
                data = data.Where(p => p.客戶資料.客戶名稱.Contains(model.CompanyName));
            }
            if (!string.IsNullOrEmpty(model.ContactName))
            {
                data = data.Where(p => p.姓名.Contains(model.ContactName));
            }

            if (!string.IsNullOrEmpty(model.JobTitle))
            {
                data = data.Where(p => p.職稱 == model.JobTitle);
            }

            if (!string.IsNullOrEmpty(model.sort))
            {
                data = data.OrderBy(model.sort + " " + model.sidx);
            }
            else
            {
                data = data.OrderBy(p => p.Id);
            }

            return(data.AsQueryable());
        }
Пример #2
0
        public IPagedList <客戶聯絡人> Query(QueryContactModel model, int DefaultPage)
        {
            var data = this.Query(model);

            return(data.ToPagedList(model.Page ?? DefaultPage, model.PageSite ?? DefaultPage));
        }