ComplianceServer/oldcode/BLL/Csvr/CSVR_RELATIONCUSTOMER_BL.cs

44 lines
1.4 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;
namespace WX.CRM.BLL.Csvr
{
public class CSVR_RELATIONCUSTOMER_BL : ICSVR_RELATIONCUSTOMER, ICSVR_RELATIONCUSTOMER_Q
{
public bool Create(ref ValidationErrors errors, WX.CRM.Model.Entity.CSVR_RELATIONCUSTOMER model)
{
try
{
using (WX.CRM.Model.Entity.crmContext db = new WX.CRM.Model.Entity.crmContext())
{
model.PKID = new SEQUENCES_BL().Seq_base_get();
model.CTIME = DateTime.Now;
db.CSVR_RELATIONCUSTOMER.Add(model);
return db.SaveChanges().GetResult();
}
}
catch (Exception ex)
{
errors.Add(ex.Message);
return false;
}
}
public List<WX.CRM.Model.Entity.CSVR_RELATIONCUSTOMER> GetRelationByResId(string resId)
{
using (WX.CRM.Model.Entity.crmContext db = new WX.CRM.Model.Entity.crmContext())
{
resId = resId.Trim();
List<WX.CRM.Model.Entity.CSVR_RELATIONCUSTOMER> list = db.CSVR_RELATIONCUSTOMER.Where(p => p.RESID == resId).ToList();
return list;
}
}
}
}