using Quartz; using System; using WX.CRM.BLL.Res; using WX.CRM.BLL.Util; using WX.CRM.Common; namespace WX.CRM.CRMServices.Res { public class ResMobileBelongToArea { private SecurityHelper sHelper = new SecurityHelper(); private readonly RES_CUSTOMERDETAIL_BL _customerDetial = new RES_CUSTOMERDETAIL_BL(); private readonly RES_RESOURCEMOBILE_BL _mobile = new RES_RESOURCEMOBILE_BL(); public void Start() { var totalRows = 0; var list = _customerDetial.GetList(p => p.BELONGTOPROVINCE == null, p => p.RESID, 1, 100, out totalRows); foreach (var item in list) { try { PhoneLogModel phoneLogModel = new PhoneLogModel { Method = System.Reflection.MethodBase.GetCurrentMethod().Name, userid = 0 }; var mobile = _mobile.GetNumberByResId(item.RESID, phoneLogModel); if (!string.IsNullOrEmpty(mobile)) { var belongMobile = mobile.Substring(1, 7); _customerDetial.SetMobileBelongToArea(belongMobile, item.RESID); } } catch (Exception e) { LogHelper.Error(e); } } } } public class ResMobileBelongToAreaJob : IJob { private static bool _isNotice = false; public void Execute(JobExecutionContext context) { if (_isNotice) return; _isNotice = true; try { new ResMobileBelongToArea().Start(); } catch (Exception e) { WX.CRM.Common.LogHelper.Error("WX.CRM.CRMServices.Res_AlloCate.ResAllocateActJob.ResAllocateAct().Execute:" + e); } finally { _isNotice = false; } } } }