TG.WXCRM.V4/CRMServices/CRMJobs/OpenResSyncJob.cs

43 lines
1.3 KiB
C#

using Quartz;
using System;
using System.Data;
using WX.CRM.BLL.Res;
using WX.CRM.Common;
namespace WX.CRM.CRMServices.CRMJobs
{
public class OpenResSyncJob : IJob
{
static bool isRuning = false;
public void Execute(JobExecutionContext context)
{
if (isRuning)
return;
isRuning = true;
try
{
var resdt = new RES_CUSTOMER_BL().GetOpenAccountRes();
if (null != resdt)
{
foreach (DataRow row in resdt.Rows)
{
row["MOBILE"] = Utility.EncryptMD5(row["MOBILE"].ToString());
}
}
string sql = "truncate table OpenAccountRes";
SqlHelper.SqlHelper.ExcuteSPOrSql(SqlHelper.SqlHelper.DatabaseType.CRMRES, sql, CommandType.Text);
SqlHelper.SqlHelper.BulkInsert(SqlHelper.SqlHelper.DatabaseType.CRMRES, "OpenAccountRes", resdt);
}
catch (Exception e)
{
Console.WriteLine(e.Message + e.StackTrace);
WX.CRM.Common.LogHelper.Error("开户资源同步: " + e);
}
finally
{
isRuning = false;
}
}
}
}