59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.BLL.Base;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Soft;
|
|
|
|
namespace WX.CRM.BLL.Soft
|
|
{
|
|
public class SOFT_ALLOCATERESLOG_BL : ISOFT_ALLOCATERESLOG, ISOFT_ALLOCATERESLOG_Q
|
|
{
|
|
public bool CreateList(ref ValidationErrors errors, List<WX.CRM.Model.Entity.SOFT_ALLOCATERESLOG> models)
|
|
{
|
|
try
|
|
{
|
|
using (WX.CRM.Model.Entity.crmContext db = new WX.CRM.Model.Entity.crmContext())
|
|
{
|
|
|
|
foreach (var entity in models)
|
|
{
|
|
entity.PKID = new SEQUENCES_BL().Seq_base_get();
|
|
db.SOFT_ALLOCATERESLOG.Add(entity);
|
|
}
|
|
|
|
bool result = db.SaveChanges().GetResult(); ;
|
|
return result;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public List<WX.CRM.Model.Entity.SOFT_ALLOCATERESLOG> GetSOFT_ALLOCATERESLOG(ref Pager pg, string username, decimal olduserid, decimal newuserid, decimal opuserid, DateTime? ctime, DateTime? etime)
|
|
{
|
|
using (WX.CRM.Model.Entity.crmContext db = new WX.CRM.Model.Entity.crmContext())
|
|
{
|
|
var list = db.SOFT_ALLOCATERESLOG.AsQueryable();
|
|
if (!string.IsNullOrWhiteSpace(username))
|
|
list = list.Where(p => p.SOFTNAME == username);
|
|
if (olduserid > 1)
|
|
list = list.Where(p => p.ORGSALESID == olduserid);
|
|
if (newuserid > 1)
|
|
list = list.Where(p => p.NEWSALESID == newuserid);
|
|
if (opuserid > 1)
|
|
list = list.Where(p => p.OPUSERID == opuserid);
|
|
if (ctime.HasValue && etime.HasValue)
|
|
list = list.Where(p => p.OPTIME >= ctime && p.OPTIME <= etime);
|
|
list = list.OrderByDescending(p => p.OPTIME);
|
|
PagerUtil.SetPager<WX.CRM.Model.Entity.SOFT_ALLOCATERESLOG>(ref list, ref pg);
|
|
return list.ToList();
|
|
}
|
|
}
|
|
}
|
|
}
|