/// <summary> /// در اینجا تابع بررسی شرط هریک از زمانبندهای تعریف شده در فایل تنظیمات /// فراخوانی می گردد و در صورت رخداد شرایط هرکدام از آنها وب سرویس را فراخوانی می نماید /// همچنین وقایع انجام شده را در جدول لاگ ذخیره می کند /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void schedulerTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { if (CalculatorSchedulerFactory.IsConditionOccurenced(this.setting, DateTime.Now)) { TotalWebServiceClient ExcRuleSvc = new GTS.Clock.ELESchedulingService.ServiceReference.TotalWebServiceClient(); if (!Utility.IsEmpty(this.setting.GTSWebServiceAddress)) { ExcRuleSvc = new GTS.Clock.ELESchedulingService.ServiceReference.TotalWebServiceClient("BasicHttpBinding_ITotalWebService", this.setting.GTSWebServiceAddress); } ExcRuleSvc.GTS_ExecuteAll("CalculatorSchedulerService"); GTSLogger.Logger.Info(@"وب سرویس اجراکننده قوانین فراخوانی شد"); if (!this.setting.BatchFlush) { GTSLogger.Flush(); } } } catch (Exception ex) { GTSLogger.Logger.Info(String.Format("{0}: {1}", "عدم موفقیت در فراخوانی وب سرویس", ex.Message)); if (!this.setting.BatchFlush) { GTSLogger.Flush(); } } }
public CalculatorSchedulerService() { InitializeComponent(); this.setting = CalculatorSchedulerFactory.GetSetting(); try { this.schedulerTimer.Elapsed += new System.Timers.ElapsedEventHandler(schedulerTimer_Elapsed); } catch (Exception ex) { GTSLogger.Error("ELE", Utility.GetExecptionMessage(ex)); throw new BaseException(ex.Message, "GTSCalculatorSchedulerService"); } }