/// <summary> /// 修改Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public static ESB_SCHD UpdateEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { ESB_SCHD sched = schedulerDC.ESB_SCHD.Single(p => p.SCHD_ID == scheduler.SCHD_ID); sched.END_TIME = scheduler.END_TIME; sched.SCHD_CRON = scheduler.SCHD_CRON; sched.SCHD_DESC = scheduler.SCHD_DESC; sched.SCHD_FREQ = scheduler.SCHD_FREQ; sched.SCHD_HOST = scheduler.SCHD_HOST; sched.SCHD_NAME = scheduler.SCHD_NAME; sched.SCHD_TIME = scheduler.SCHD_TIME; sched.SCHD_USER = scheduler.SCHD_USER; sched.START_TIME = scheduler.START_TIME; sched.HOST_NAME = scheduler.HOST_NAME; ESB_SCHD_EsbWS esbWebServcie = schedulerDC.ESB_SCHD_EsbWS.Single(p => p.SCHD_ID == scheduler.SCHD_ID); esbWebServcie.EntityID = esbWS.EntityID; esbWebServcie.EntityName = esbWS.EntityName; esbWebServcie.MethodName = esbWS.MethodName; esbWebServcie.ParamString = esbWS.ParamString; esbWebServcie.ParamUrl = esbWS.ParamUrl; esbWebServcie.PassWord = esbWS.PassWord; esbWebServcie.ServiceID = esbWS.ServiceID; esbWebServcie.ServiceName = esbWS.ServiceName; schedulerDC.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); return sched; }
/// <summary> /// 删除Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public static void DeleteEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { schedulerDC.ESB_SCHD_EsbWS.DeleteOnSubmit(esbWS); schedulerDC.ESB_SCHD.DeleteOnSubmit(scheduler); schedulerDC.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); }
/// <summary> /// 新增Quartz WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> private void AddQuartzWebServiceScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { // define the job and ask it to run JobDetailImpl job = new JobDetailImpl(scheduler.JOB_NAME, scheduler.TRIG_GROUP, typeof(EsbWebServiceJob)); job.Description = scheduler.SCHD_DESC; job.Durable = true; JobDataMap map = new JobDataMap(); map.Put(EsbWebServiceJob.HOST, scheduler.HOST_NAME); map.Put(EsbWebServiceJob.SERVICE_NAME, esbWS.ServiceName); map.Put(EsbWebServiceJob.METHOD_NAME, esbWS.MethodName); map.Put(EsbWebServiceJob.PASSWORD, esbWS.PassWord); map.Put(EsbWebServiceJob.SCHD_ID, scheduler.SCHD_ID); map.Put(EsbWebServiceJob.PARAM_STRING, esbWS.ParamString); map.Put(EsbWebServiceJob.PARAM_URL, esbWS.ParamUrl); job.JobDataMap = map; DateTime startTime = DateTime.Parse(scheduler.START_TIME).ToUniversalTime(); DateTime endTime = DateTime.Parse(scheduler.END_TIME).ToUniversalTime(); CronTriggerImpl trigger = new CronTriggerImpl(scheduler.TRIG_NAME, scheduler.TRIG_GROUP, scheduler.JOB_NAME, scheduler.TRIG_GROUP, startTime, endTime, scheduler.SCHD_CRON); trigger.Description = scheduler.SCHD_DESC; try { sched.ScheduleJob(job, trigger); } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public static ESB_SCHD UpdateEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { ESB_SCHD sched = schedulerDC.ESB_SCHD.Single(p => p.SCHD_ID == scheduler.SCHD_ID); sched.END_TIME = scheduler.END_TIME; sched.SCHD_CRON = scheduler.SCHD_CRON; sched.SCHD_DESC = scheduler.SCHD_DESC; sched.SCHD_FREQ = scheduler.SCHD_FREQ; sched.SCHD_HOST = scheduler.SCHD_HOST; sched.SCHD_NAME = scheduler.SCHD_NAME; sched.SCHD_TIME = scheduler.SCHD_TIME; sched.SCHD_USER = scheduler.SCHD_USER; sched.START_TIME = scheduler.START_TIME; sched.HOST_NAME = scheduler.HOST_NAME; ESB_SCHD_EsbWS esbWebServcie = schedulerDC.ESB_SCHD_EsbWS.Single(p => p.SCHD_ID == scheduler.SCHD_ID); esbWebServcie.EntityID = esbWS.EntityID; esbWebServcie.EntityName = esbWS.EntityName; esbWebServcie.MethodName = esbWS.MethodName; esbWebServcie.ParamString = esbWS.ParamString; esbWebServcie.ParamUrl = esbWS.ParamUrl; esbWebServcie.PassWord = esbWS.PassWord; esbWebServcie.ServiceID = esbWS.ServiceID; esbWebServcie.ServiceName = esbWS.ServiceName; schedulerDC.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); return(sched); }
/// <summary> /// 新增Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public static void AddEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { schedulerDC.ESB_SCHD.InsertOnSubmit(scheduler); esbWS.OID = Guid.NewGuid().ToString().ToUpper(); esbWS.SCHD_ID = scheduler.SCHD_ID; schedulerDC.ESB_SCHD_EsbWS.InsertOnSubmit(esbWS); schedulerDC.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); }
/// <summary> /// 启用Esb WebService调度任务 /// </summary> /// <param name="schedID"></param> public void ResumeQuartzWebServiceScheduler(string schedID) { try { ESB_SCHD scheduler = SchedulerDataAccess.GetEsbSchedulerBySchedID(schedID); sched.ResumeTrigger(new TriggerKey(scheduler.TRIG_NAME, scheduler.TRIG_GROUP)); } catch (Exception ex) { throw new Exception("启用Esb WebService调度任务 失败!" + ex.Message); } }
/// <summary> /// 修改Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public void UpdateEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { try { ESB_SCHD sched = SchedulerDataAccess.UpdateEsbWebServcieScheduler(scheduler, esbWS); ESB_SCHD_EsbWS esbWebService = SchedulerDataAccess.GetEsbWebServiceBySchedID(sched.SCHD_ID); RemoveQuartzWebServiceScheduler(sched.TRIG_NAME, sched.JOB_NAME, sched.TRIG_GROUP); AddQuartzWebServiceScheduler(sched, esbWebService); } catch (Exception ex) { throw new Exception("修改Esb WebService调度任务 失败!" + ex.Message); } }
/// <summary> /// 新增Esb WebService调度任务 /// </summary> /// <param name="scheduler"></param> /// <param name="esbWS"></param> public void AddEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { scheduler.SCHD_ID = Guid.NewGuid().ToString().ToUpper(); AddQuartzWebServiceScheduler(scheduler, esbWS); try { SchedulerDataAccess.AddEsbWebServcieScheduler(scheduler, esbWS); } catch (Exception ex) { RemoveQuartzWebServiceScheduler(scheduler.TRIG_NAME, scheduler.JOB_NAME, scheduler.TRIG_GROUP); throw new Exception("新增Esb WebService调度任务 失败!" + ex.Message); } }
/// <summary> /// 删除Esb WebService调度任务 /// </summary> /// <param name="schedID"></param> public void DeleteEsbWebServcieScheduler(string schedID) { try { ESB_SCHD scheduler = SchedulerDataAccess.GetEsbSchedulerBySchedID(schedID); ESB_SCHD_EsbWS esbWS = SchedulerDataAccess.GetEsbWebServiceBySchedID(schedID); SchedulerDataAccess.DeleteEsbWebServcieScheduler(scheduler, esbWS); RemoveQuartzWebServiceScheduler(scheduler.TRIG_NAME, scheduler.JOB_NAME, scheduler.TRIG_GROUP); } catch (Exception ex) { throw new Exception("删除Esb WebService调度任务 失败!" + ex.Message); } }
protected void OdsHostScheduler_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { if (cbEntity.Value == null || cbService.Value == null || string.IsNullOrEmpty(txtMethodName.Text) || string.IsNullOrEmpty(txtPassWord.Text) || string.IsNullOrEmpty(txtParam.Text) ) { throw new Exception("请详细填写任务信息!"); } ESB_SCHD sched = new ESB_SCHD(); ESB_SCHD_EsbWS esbWS = new ESB_SCHD_EsbWS(); SchedulerService schedulerService = new SchedulerService(); string guid = Guid.NewGuid().ToString().ToUpper(); sched.START_TIME = DateTime.Parse(e.InputParameters["START_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); sched.END_TIME = DateTime.Parse(e.InputParameters["END_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); sched.SCHD_CRON = e.InputParameters["SCHD_CRON"].ToString(); sched.SCHD_DESC = e.InputParameters["SCHD_DESC"].ToString(); sched.SCHD_FREQ = e.InputParameters["SCHD_FREQ"].ToString(); sched.SCHD_HOST = new Guid(e.InputParameters["SCHD_HOST"].ToString()); sched.SCHD_NAME = e.InputParameters["SCHD_NAME"].ToString(); sched.SCHD_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); sched.SCHD_USER = AuthUser.UserName; sched.TRIG_GROUP = e.InputParameters["TRIG_GROUP"].ToString(); sched.TRIG_NAME = "TRIG_" + sched.TRIG_GROUP + guid; sched.JOB_NAME = "JOB_" + sched.TRIG_GROUP + guid; 注册服务目录服务 目录服务 = new 注册服务目录服务(); 业务实体 entity = 目录服务.获得服务提供者(sched.SCHD_HOST); sched.HOST_NAME = entity.业务名称; esbWS.EntityID = new Guid(cbEntity.SelectedItem.Value.ToString()); esbWS.EntityName = cbEntity.SelectedItem.GetValue("业务名称").ToString(); esbWS.ServiceID = new Guid(cbService.SelectedItem.Value.ToString()); esbWS.ServiceName = cbService.SelectedItem.GetValue("服务名称").ToString(); esbWS.MethodName = txtMethodName.Text; esbWS.PassWord = txtPassWord.Text; esbWS.ParamString = txtParam.Text; e.InputParameters.Clear(); e.InputParameters["scheduler"] = sched; e.InputParameters["esbWS"] = esbWS; }
public void UpdateEsbWebServcieScheduler(ESB_SCHD scheduler, ESB_SCHD_EsbWS esbWS) { SchedulerLogic schedulerLogic = new SchedulerLogic(); schedulerLogic.UpdateEsbWebServcieScheduler(scheduler, esbWS); }
/// <summary> /// 新增Esb调度 /// </summary> /// <param name="esbScheduler"></param> /// <returns></returns> public static void AddEsbScheduler(ESB_SCHD esbScheduler) { schedulerDC.ESB_SCHD.InsertOnSubmit(esbScheduler); schedulerDC.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); }
protected void OdsHostScheduler_OnUpdating(object sender, ObjectDataSourceMethodEventArgs e) { if (cbEntity.Value == null || cbService.Value == null || string.IsNullOrEmpty(txtMethodName.Text) || string.IsNullOrEmpty(txtPassWord.Text) || string.IsNullOrEmpty(txtParam.Text) ) { throw new Exception("请详细填写任务信息!"); } ESB_SCHD sched = new ESB_SCHD(); ESB_SCHD_EsbWS esbWS = new ESB_SCHD_EsbWS(); SchedulerService schedulerService = new SchedulerService(); sched.SCHD_ID = e.InputParameters["SCHD_ID"].ToString(); sched.START_TIME = DateTime.Parse(e.InputParameters["START_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); sched.END_TIME = DateTime.Parse(e.InputParameters["END_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); sched.SCHD_CRON = e.InputParameters["SCHD_CRON"].ToString(); sched.SCHD_DESC = e.InputParameters["SCHD_DESC"].ToString(); sched.SCHD_FREQ = e.InputParameters["SCHD_FREQ"].ToString(); sched.SCHD_HOST = new Guid(e.InputParameters["SCHD_HOST"].ToString()); sched.SCHD_NAME = e.InputParameters["SCHD_NAME"].ToString(); sched.SCHD_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); sched.SCHD_USER = AuthUser.UserName; 注册服务目录服务 目录服务 = new 注册服务目录服务(); 业务实体 entity = 目录服务.获得服务提供者(sched.SCHD_HOST); sched.HOST_NAME = entity.业务名称; esbWS.EntityID = new Guid(cbEntity.SelectedItem.Value.ToString()); esbWS.EntityName = cbEntity.SelectedItem.GetValue("业务名称").ToString(); esbWS.ServiceID = new Guid(cbService.SelectedItem.Value.ToString()); esbWS.ServiceName = cbService.SelectedItem.GetValue("服务名称").ToString(); esbWS.MethodName = txtMethodName.Text; esbWS.PassWord = txtPassWord.Text; esbWS.ParamString = txtParam.Text; e.InputParameters.Clear(); e.InputParameters["scheduler"] = sched; e.InputParameters["esbWS"] = esbWS; }