51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
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_PRODUCT_BL : DbContextRepository<QH_PRODUCT>, IQH_PRODUCT
|
|
{
|
|
public List<QH_PRODUCT> GetList(ref Pager pager, string productCode, string productName)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
IQueryable<QH_PRODUCT> queryable = db.QH_PRODUCT.AsQueryable();
|
|
if (!string.IsNullOrEmpty(productCode))
|
|
{
|
|
queryable = queryable.Where(p => p.PRODUCTCODE == productCode);
|
|
}
|
|
if (!string.IsNullOrEmpty(productName))
|
|
{
|
|
|
|
queryable = queryable.Where(m => m.PRODUCTNAME.Contains(productName));
|
|
}
|
|
queryable = queryable.OrderByDescending(m => m.CTIME);
|
|
PagerUtil.SetPager<QH_PRODUCT>(ref queryable, ref pager);
|
|
return queryable.ToList();
|
|
}
|
|
}
|
|
//public bool Add(ref ValidationErrors errors, QH_PRODUCT model)
|
|
//{
|
|
// bool result = true;
|
|
// using (var db = new crmContext())
|
|
// {
|
|
// try
|
|
// {
|
|
// db.QH_PRODUCT.Add(model);
|
|
// db.SaveChanges();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// LogHelper.Error(ex.Message);
|
|
// result = false;
|
|
// }
|
|
// }
|
|
// return result;
|
|
//}
|
|
}
|
|
}
|