51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.DAL.QH;
|
|
using WX.CRM.IBLL.QH;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.QH
|
|
{
|
|
public class QH_CUSTOMERPOSITIONS_BL : DbContextRepository<QH_CUSTOMERPOSITIONS>, IQH_CUSTOMERPOSITIONS
|
|
{
|
|
QH_CUSTOMERPOSITIONS_DAL qhcp_dal = new QH_CUSTOMERPOSITIONS_DAL();
|
|
public List<QH_CUSTOMERPOSITIONS> GetList(ref Pager pager, string userAccount, string year, string quarter)
|
|
{
|
|
DataTable dt = qhcp_dal.GetList(ref pager, userAccount, year, quarter);
|
|
return dt.ToList<QH_CUSTOMERPOSITIONS>();
|
|
}
|
|
public List<QH_CUSTOMERPOSITIONS> GetList(ref Pager pager, string dept, string exChange, string contractCode, string userAccount, string name)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
IQueryable<QH_CUSTOMERPOSITIONS> queryable = db.QH_CUSTOMERPOSITIONS.AsQueryable();
|
|
if (!string.IsNullOrEmpty(dept))
|
|
{
|
|
queryable = queryable.Where(p => p.DEPT == dept);
|
|
}
|
|
if (!string.IsNullOrEmpty(exChange))
|
|
{
|
|
queryable = queryable.Where(p => p.EXCHANGE == exChange);
|
|
}
|
|
if (!string.IsNullOrEmpty(contractCode))
|
|
{
|
|
queryable = queryable.Where(p => p.CONTRACTCODE == contractCode);
|
|
}
|
|
if (!string.IsNullOrEmpty(userAccount))
|
|
{
|
|
queryable = queryable.Where(p => p.USERACCOUNT.Contains(userAccount));
|
|
}
|
|
if (!string.IsNullOrEmpty(name))
|
|
{
|
|
queryable = queryable.Where(p => p.USERNAME.Contains(name));
|
|
}
|
|
queryable = queryable.OrderByDescending(p => p.CTIME);
|
|
PagerUtil.SetPager(ref queryable, ref pager);
|
|
return queryable.ToList();
|
|
}
|
|
}
|
|
}
|
|
} |