60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.Wx
|
|
{
|
|
public class WX_BALANCEAFTERSALEAUDIT_BL : DbContextRepository<WX_BALANCEAFTERSALEAUDIT>, IWX_BALANCEAFTERSALEAUDIT
|
|
{
|
|
public IList<WX_BALANCEAFTERSALEAUDIT> GetAutitList(decimal uId, DateTime? balanceCode, string status)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var where = PredicateExtensionses.True<WX_BALANCEAFTERSALEAUDIT>();
|
|
if (uId > 0)
|
|
{
|
|
where = where.And(p => p.INNERUSERID == uId);
|
|
}
|
|
if (balanceCode.HasValue)
|
|
{
|
|
where = where.And(p => p.MONTH == balanceCode.Value);
|
|
}
|
|
if (!string.IsNullOrEmpty(status))
|
|
{
|
|
where = where.And(p => p.STATUS == status);
|
|
}
|
|
var list = GetList(where);
|
|
return list.ToList();
|
|
}
|
|
}
|
|
|
|
public void AuditPerformanceAfterSale(decimal PKID, int sta, string remark, decimal auditid, string auditname)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var info = db.WX_BALANCEAFTERSALEAUDIT.FirstOrDefault(p => p.PKID == PKID);
|
|
if (info == null)
|
|
{
|
|
throw new Exception("未找到结算记录!");
|
|
}
|
|
if (info.STATUS == "已确认")
|
|
{
|
|
throw new Exception("已经确认过了!");
|
|
}
|
|
if (sta == 0)
|
|
info.STATUS = "未确认";
|
|
else if (sta == 1)
|
|
info.STATUS = "已确认";
|
|
else info.STATUS = "未知";
|
|
info.REMARK = remark;
|
|
info.AUDITBYUSERID = auditid;
|
|
info.AUDITBYUSERNAME = auditname;
|
|
info.AUDITTIME = System.DateTime.Now;
|
|
db.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|