ComplianceServer/oldcode/BLL/QH/QH_CUSTOMER_SALEUSER_LOG_BL.cs

46 lines
1.7 KiB
C#

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<QH_CUSTOMER_SALEUSER_LOG>, IQH_CUSTOMER_SALEUSER_LOG
{
public List<QH_CUSTOMER_SALEUSER_LOG> GetList(ref Pager pager, string userAccount, decimal? olduserId, decimal? newuserId, DateTime? starttime, DateTime? endtime)
{
using (var db = new crmContext())
{
IQueryable<QH_CUSTOMER_SALEUSER_LOG> 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();
}
}
}
}