62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
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_CAPITALDETAIL_BL : DbContextRepository<QH_CAPITALDETAIL>, IQH_CAPITALDETAIL
|
|
{
|
|
public List<QH_CAPITALDETAIL> GetList(ref Pager pager, string useraccount)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var query = db.QH_CAPITALDETAIL.AsQueryable();
|
|
if (!string.IsNullOrEmpty(useraccount))
|
|
{
|
|
query = query.Where(m => m.USERACCOUNT == useraccount);
|
|
}
|
|
query = query.OrderByDescending(m => m.RQ);
|
|
PagerUtil.SetPager(ref query, ref pager);
|
|
return query.ToList();
|
|
}
|
|
}
|
|
|
|
public List<QH_CAPITALDETAIL> GetList(ref Pager pager, string userAccount, string name, string resId, DateTime? starttime, DateTime? endtime)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
IQueryable<QH_CAPITALDETAIL> queryable = db.QH_CAPITALDETAIL.AsQueryable();
|
|
if (!string.IsNullOrEmpty(userAccount))
|
|
{
|
|
queryable = queryable.Where(p => p.USERACCOUNT == userAccount);
|
|
}
|
|
if (!string.IsNullOrEmpty(name))
|
|
{
|
|
queryable = queryable.Where(p => p.USERNAME.Contains(name));
|
|
}
|
|
if (!string.IsNullOrEmpty(resId))
|
|
{
|
|
queryable = queryable.Where(p => p.RESID == resId);
|
|
}
|
|
if (starttime.HasValue)
|
|
{
|
|
queryable = queryable.Where(p => p.RQ >= starttime);
|
|
}
|
|
if (endtime.HasValue)
|
|
{
|
|
endtime = endtime.Value.AddDays(1);
|
|
queryable = queryable.Where(p => p.RQ < endtime);
|
|
}
|
|
queryable = queryable.OrderByDescending(p => p.RQ);
|
|
PagerUtil.SetPager(ref queryable, ref pager);
|
|
return queryable.ToList();
|
|
}
|
|
}
|
|
}
|
|
} |