using Dapper; using System; using WX.CRM.Common; using WX.CRM.DataSynFactory.Dao; using WX.CRM.DataSynFactory.Templates; namespace WX.CRM.DataSynFactory.Cmd { public class Server_UniteCustomer_IMP : Interfaces.IDataImportSvr { public bool GenerateBusinessOne(Server_UniteCustomer t) { try { using (var db = ZxdStore.GetConnection()) { var arr = t.oldCustomerId.Split(','); foreach (var item in arr) { var sql = "update res_customer set customerid = @customerid where resid = @resid"; db.Execute(sql, new { customerid = t.newCustomerId, resid = item }); if (t.newCustomerId != item) db.Execute("update res_customerdetail set isprimarynum = 0 where resid = @resid and isprimarynum = 1", new { resid = item }); if (t.newCustomerId == item) db.Execute("update res_customerdetail set isprimarynum = 1 where resid = @resid and isprimarynum = 0", new { resid = item }); } } return true; } catch (Exception ex) { LogHelper.Error("处理合并客户ID异常,Server_UniteCustomer_IMP:" + ex.ToString()); return false; } } } }