51 lines
1.8 KiB
C#
51 lines
1.8 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.Csvr;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.Csvr
|
|
{
|
|
public class CSVR_UNITECUSTOMERAPPLYDETAIL_BL : ICSVR_UNITECUSTOMERAPPLYDETAIL, ICSVR_UNITECUSTOMERAPPLYDETAIL_Q
|
|
{
|
|
public bool Creata_UnitCustomerApplyDetail(ref ValidationErrors errors, List<CustomerRelation> lists, decimal uniteID)
|
|
{
|
|
try
|
|
{
|
|
using (crmContext db = new crmContext())
|
|
{
|
|
foreach (CustomerRelation cr in lists)
|
|
{
|
|
CSVR_UNITECUSTOMERAPPLYDETAIL detailModel = new CSVR_UNITECUSTOMERAPPLYDETAIL
|
|
{
|
|
PKID = new SEQUENCES_BL().Seq_base_get(),
|
|
UNITEID = uniteID,
|
|
RESID = cr.resId,
|
|
OLDCUSTOMERID = cr.oldCustomerid,
|
|
NEWCUSTOMERID = cr.newCustomerid,
|
|
};
|
|
db.CSVR_UNITECUSTOMERAPPLYDETAIL.Add(detailModel);
|
|
}
|
|
return db.SaveChanges().GetResult();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public List<CSVR_UNITECUSTOMERAPPLYDETAIL> GetList_UniteCustomerApplyDetail(decimal uniteid)
|
|
{
|
|
using (crmContext db = new crmContext())
|
|
{
|
|
return db.CSVR_UNITECUSTOMERAPPLYDETAIL.Where(m => m.UNITEID == uniteid).OrderBy(m => m.NEWCUSTOMERID).ToList<CSVR_UNITECUSTOMERAPPLYDETAIL>();
|
|
}
|
|
}
|
|
}
|
|
}
|