using System; using System.Collections.Generic; using System.Linq; using WX.CRM.BLL.Util; using WX.CRM.Common; using WX.CRM.IBLL.QH; using WX.CRM.Model.Entity; namespace WX.CRM.BLL.QH { public class QH_CUSTOMER_SALEUSER_LOG_BL : DbContextRepository, IQH_CUSTOMER_SALEUSER_LOG { public List GetList(ref Pager pager, string userAccount, decimal? olduserId, decimal? newuserId, DateTime? starttime, DateTime? endtime) { using (var db = new crmContext()) { IQueryable queryable = db.QH_CUSTOMER_SALEUSER_LOG.AsQueryable(); if (!string.IsNullOrEmpty(userAccount)) { queryable = queryable.Where(p => p.USERACCOUNT == userAccount); } if (olduserId.HasValue) { queryable = queryable.Where(p => p.OLDEID == olduserId); } if (newuserId.HasValue) { queryable = queryable.Where(p => p.NEWEID == newuserId); } if (starttime.HasValue) { queryable = queryable.Where(p => p.STARTDATE >= starttime); } if (endtime.HasValue) { endtime = endtime.Value.AddDays(1); queryable = queryable.Where(p => p.STARTDATE < endtime); } queryable = queryable.OrderByDescending(p => p.CTIME); PagerUtil.SetPager(ref queryable, ref pager); return queryable.ToList(); } } } }