71 lines
2.7 KiB
C#
71 lines
2.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.BLL;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.Model.Entity;
|
|
using WX.CRM.Model.MAP;
|
|
|
|
namespace AY.CRM.BLL.Wx
|
|
{
|
|
public class WX_MANUALADDWEIXINFRIEND_BL : DbContextRepository<WX_MANUALADDWEIXINFRIEND>, IWX_MANUALADDWEIXINFRIEND
|
|
{
|
|
public RES_CUSTOMER IsOfflineRes(string resId, List<decimal> resTypeIdList)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var query = db.RES_CUSTOMER.AsQueryable();
|
|
if (!string.IsNullOrEmpty(resId))
|
|
{
|
|
query = query.Where(m => m.RESID == resId);
|
|
}
|
|
if (resTypeIdList != null && resTypeIdList.Count > 0)
|
|
{
|
|
var activityList = db.RES_ACTIVITY.AsQueryable().Where(m => resTypeIdList.Contains(m.RESTYPEID)).ToList();
|
|
if (activityList != null)
|
|
{
|
|
var restagList = activityList.Select(m => m.RESOURCETAG).ToList();
|
|
if (restagList != null)
|
|
{
|
|
query = query.Where(m => restagList.Contains(m.CUSTOMERFROM));
|
|
}
|
|
}
|
|
|
|
}
|
|
return query.FirstOrDefault();
|
|
}
|
|
}
|
|
|
|
public List<WX_MANUALADDWEIXINFRIEND_Extend> GetList(ref Pager pager, decimal innerUserId, string workAlias)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var query = db.WX_MANUALADDWEIXINFRIEND.AsQueryable();
|
|
if (innerUserId > 0)
|
|
{
|
|
query = query.Where(m => m.INNERUSERID == innerUserId);
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(workAlias))
|
|
{
|
|
query = query.Where(m => m.WORKALIAS == workAlias);
|
|
}
|
|
var returnQuery = from a in query
|
|
join b in db.WX_WORKACCOUNT on a.WORKALIAS equals b.ALIAS into jiontemp
|
|
from b in jiontemp.DefaultIfEmpty()
|
|
select new WX_MANUALADDWEIXINFRIEND_Extend
|
|
{
|
|
wx_ManualAddWeiXinFriend = a,
|
|
WorkAccountUserId = b.INNERUSERID
|
|
};
|
|
returnQuery = returnQuery.OrderByDescending(m => m.wx_ManualAddWeiXinFriend.CTIME);
|
|
PagerUtil.SetPager<WX_MANUALADDWEIXINFRIEND_Extend>(ref returnQuery, ref pager);
|
|
var list = returnQuery.ToList();
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|