internal bool Execute(MonitorExecutionContext context) { using (ILogMethod method = Log.LogMethod("MonitorHandlerFactory", "Execute")) { bool result = default(bool); try { _MonitorHandlerFactory factory = GetFactory(context); if (factory.IsExecuting) { _executorDelayLoading.QueueWorkerItem(context); result = true; } else { result = factory.Execute(context, null); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
internal void SetTicketResponseMeters(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { this.ForceMeterReadAndGetLatest(context, target, (i, h, j, v) => { ExCommsDataContext.Current.UpdateTicketExceptionResponseMeters(i, h, j, v); }); }
public bool Execute(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Execute")) { bool result = default(bool); string key = (target != null ? target.TypeFaultSourceTypeKey : string.Empty); try { if (!key.IsEmpty()) { method.Info("!&! HANDLER STARTED FOR : " + key); } // force meters add this.OnForceMeterRead(context, target); // execute the target result = this.OnExecuteInternal(context, target); } catch (Exception ex) { method.Exception(ex); } finally { if (!key.IsEmpty()) { method.Info("!&! HANDLER COMPLETED FOR : " + key); } } return(result); } }
internal EPIMeterValueDictionary ForceMeterReadAndGetLatest(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { this.ForceMeterRead(context, target); EPIMeterValueDictionary result = new EPIMeterValueDictionary(); result.GetLatestMeters(context.G2HMessage.InstallationNo, EPIMeterValueTypes.Start); return(result); }
protected override void OnForceMeterRead(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { string key = target.FaultSourceTypeKey; if (_forceMeterRead || _configStore.ForceMeterReads.ContainsKey(key)) { this.ForceMeterRead(context, target); } }
void OnExecutorDelayLoading_ProcessItem(MonitorExecutionContext context) { var factory = GetFactory(context); do { if (!factory.IsExecuting) { break; } } while (!_teWait.Wait(_tsWait)); factory.Execute(context, null); }
internal void ForceMeterReadAndGetLatest(MonitorExecutionContext context, MonitorEntity_MsgTgt target, Action <int, int, int, int> action) { int installationNo = context.G2HMessage.InstallationNo; EPIMeterValueTypes valueType = EPIMeterValueTypes.Start; using (EPIMeterValueDictionary meterValues = this.ForceMeterReadAndGetLatest(context, target)) { action(installationNo, (int)meterValues[EPIMeterTypes.Handpay][valueType], (int)meterValues[EPIMeterTypes.Jackpot][valueType], (int)meterValues[EPIMeterTypes.VouchersOut][valueType]); } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { this.ForceMeterRead(context, target); return(true); } catch (Exception ex) { ExceptionManager.Publish(ex); return(false); } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { this.ForceMeterRead(context, target); return true; } catch (Exception ex) { ExceptionManager.Publish(ex); return false; } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod("MonitorHandler_CompListChangedXC", "ProcessG2HMessageInternal")) { try { ExCommsDataContext.Current.ResetCompVerificationRequestStatus(context.G2HMessage.InstallationNo, ""); } catch (Exception ex) { ExceptionManager.Publish(ex); } return true; } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod("MonitorHandler_CompListChangedXC", "ProcessG2HMessageInternal")) { try { ExCommsDataContext.Current.ResetCompVerificationRequestStatus(context.G2HMessage.InstallationNo, ""); } catch (Exception ex) { ExceptionManager.Publish(ex); } return(true); } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { MonMsg_G2H request = context.G2HMessage; string faultDesc = request.FaultType == (int)FaultType_NonPriorityEvent.CommsStopped ? "Polling Failed" : "Polling Resumed"; base.AddFaultEvent(request.InstallationNo, request.FaultSource, request.FaultType, faultDesc, true, request.FaultDate); return base.OnExecuteInternal(context, target); } catch (Exception ex) { method.Exception(ex); return false; } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { MonMsg_G2H request = context.G2HMessage; request.FaultSource = 200; base.AddFaultEvent(request.InstallationNo, request.FaultSource, request.FaultType, string.Empty, true, request.FaultDate); return(base.OnExecuteInternal(context, target)); } catch (Exception ex) { method.Exception(ex); return(false); } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { MonMsg_G2H request = context.G2HMessage; request.FaultSource = 200; base.AddFaultEvent(request.InstallationNo, request.FaultSource, request.FaultType, string.Empty, true, request.FaultDate); return base.OnExecuteInternal(context, target); } catch (Exception ex) { method.Exception(ex); return false; } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { try { MonMsg_G2H request = context.G2HMessage; string faultDesc = request.FaultType == (int)FaultType_NonPriorityEvent.CommsStopped ? "Polling Failed" : "Polling Resumed"; base.AddFaultEvent(request.InstallationNo, request.FaultSource, request.FaultType, faultDesc, true, request.FaultDate); return(base.OnExecuteInternal(context, target)); } catch (Exception ex) { method.Exception(ex); return(false); } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { bool result = default(bool); try { MonMsg_G2H request = context.G2HMessage; DateTime dDate = request.FaultDate; return(ExCommsDataContext.Current.InsertGeneralEvents(request.InstallationNo, target.FaultType, true, dDate, target.FaultSource)); } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, ExComms.Contracts.DTO.Monitor.MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { bool result = default(bool); try { MonMsg_G2H request = context.G2HMessage; DateTime dDate = request.FaultDate; return ExCommsDataContext.Current.InsertGeneralEvents(request.InstallationNo, target.FaultType, true, dDate, target.FaultSource); } catch (Exception ex) { method.Exception(ex); } return result; } }
protected virtual bool AddFaultEvent(MonitorExecutionContext context, MonitorEntity_MsgTgt target, string description, bool polled) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "AddFaultEvent")) { bool result = default(bool); try { MonMsg_G2H request = context.G2HMessage; method.InfoV("FAULT EVENT : Inserting fault event for {0:D}/{1:D}", target.FaultSource, target.FaultType); result = this.AddFaultEvent(request.InstallationNo, target.FaultSource, target.FaultType, description, polled, request.FaultDate); } catch (Exception ex) { method.Exception(ex); } return(result); } }
public virtual void ForceMeterRead(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { Log.Info("ForceMeterRead : " + target.TypeFaultSourceTypeKey); this.ProcessMeters(context, target); }
protected bool ProcessMeters(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { return this.MeterHandler.Execute(context, target); }
protected virtual bool AddFaultEvent(MonitorExecutionContext context, MonitorEntity_MsgTgt target, string description, bool polled) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "AddFaultEvent")) { bool result = default(bool); try { MonMsg_G2H request = context.G2HMessage; method.InfoV("FAULT EVENT : Inserting fault event for {0:D}/{1:D}", target.FaultSource, target.FaultType); result = this.AddFaultEvent(request.InstallationNo, target.FaultSource, target.FaultType, description, polled, request.FaultDate); } catch (Exception ex) { method.Exception(ex); } return result; } }
protected virtual bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { return true; }
protected bool ProcessMeters(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { return(this.MeterHandler.Execute(context, target)); }
internal bool Execute(MonitorExecutionContext context) { using (ILogMethod method = Log.LogMethod("MonitorHandlerFactory", "Execute")) { bool result = default(bool); try { _MonitorHandlerFactory factory = GetFactory(context); if (factory.IsExecuting) { _executorDelayLoading.QueueWorkerItem(context); result = true; } else { result = factory.Execute(context, null); } } catch (Exception ex) { method.Exception(ex); } return result; } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { bool result = default(bool); int installationNo = 0; MonMsg_H2G h2gMessage = null; Lazy<IList<MonitorEntity_MsgTgt>> invalidTargets = new Lazy<IList<MonitorEntity_MsgTgt>>( () => { return new List<MonitorEntity_MsgTgt>(); }); try { if (context.G2HMessage != null) { MonMsg_G2H request = context.G2HMessage; installationNo = request.InstallationNo; foreach (var target2 in request.Targets) { if (target2 is IMonTgt_Secondary) continue; string key = target2.FaultSourceTypeKey; if (_handlerMappings.ContainsKey(key)) { request.FaultSource = target2.FaultSource; request.FaultType = target2.FaultType; result |= _handlerMappings[key].Execute(context, target2); } else { invalidTargets.Value.Add(target2); } } if (installationNo <= 0) installationNo = context.G2HMessage.InstallationNo; } // unmapped targets if (invalidTargets.Value != null && invalidTargets.Value.Count > 0) { foreach (var target2 in invalidTargets.Value) { result |= _faultHandler.Execute(context, target2); } } if (context.H2GMessage != null) { h2gMessage = context.H2GMessage; } else if (context.H2GTargets != null && context.H2GTargets.Count > 0) { h2gMessage = new MonMsg_H2G() { InstallationNo = installationNo, }; h2gMessage.Targets.AddRange(context.H2GTargets); } } catch (Exception ex) { method.Exception(ex); } finally { if (h2gMessage != null) { if (h2gMessage.InstallationNo <= 0) h2gMessage.InstallationNo = installationNo; (ExMonitorServerImpl.Current as IExMonServer4CommsServer2).ProcessH2GMessage(h2gMessage); } } return result; } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { bool result = default(bool); int installationNo = 0; MonMsg_H2G h2gMessage = null; Lazy <IList <MonitorEntity_MsgTgt> > invalidTargets = new Lazy <IList <MonitorEntity_MsgTgt> >( () => { return(new List <MonitorEntity_MsgTgt>()); }); try { if (context.G2HMessage != null) { MonMsg_G2H request = context.G2HMessage; installationNo = request.InstallationNo; foreach (var target2 in request.Targets) { if (target2 is IMonTgt_Secondary) { continue; } string key = target2.FaultSourceTypeKey; if (_handlerMappings.ContainsKey(key)) { request.FaultSource = target2.FaultSource; request.FaultType = target2.FaultType; result |= _handlerMappings[key].Execute(context, target2); } else { invalidTargets.Value.Add(target2); } } if (installationNo <= 0) { installationNo = context.G2HMessage.InstallationNo; } } // unmapped targets if (invalidTargets.Value != null && invalidTargets.Value.Count > 0) { foreach (var target2 in invalidTargets.Value) { result |= _faultHandler.Execute(context, target2); } } if (context.H2GMessage != null) { h2gMessage = context.H2GMessage; } else if (context.H2GTargets != null && context.H2GTargets.Count > 0) { h2gMessage = new MonMsg_H2G() { InstallationNo = installationNo, }; h2gMessage.Targets.AddRange(context.H2GTargets); } } catch (Exception ex) { method.Exception(ex); } finally { if (h2gMessage != null) { if (h2gMessage.InstallationNo <= 0) { h2gMessage.InstallationNo = installationNo; } (ExMonitorServerImpl.Current as IExMonServer4CommsServer2).ProcessH2GMessage(h2gMessage); } } return(result); } }
protected virtual bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { return(true); }
internal _MonitorHandlerFactory GetFactory(MonitorExecutionContext request) { return(_factoryHelper.Current); }
internal EPIMeterValueDictionary ForceMeterReadAndGetLatest(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { this.ForceMeterRead(context, target); EPIMeterValueDictionary result = new EPIMeterValueDictionary(); result.GetLatestMeters(context.G2HMessage.InstallationNo, EPIMeterValueTypes.Start); return result; }
internal void ForceMeterReadAndGetLatest(MonitorExecutionContext context, MonitorEntity_MsgTgt target, Action<int, int, int, int> action) { int installationNo = context.G2HMessage.InstallationNo; EPIMeterValueTypes valueType = EPIMeterValueTypes.Start; using (EPIMeterValueDictionary meterValues = this.ForceMeterReadAndGetLatest(context, target)) { action(installationNo, (int)meterValues[EPIMeterTypes.Handpay][valueType], (int)meterValues[EPIMeterTypes.Jackpot][valueType], (int)meterValues[EPIMeterTypes.VouchersOut][valueType]); } }
public virtual void ForceMeterRead(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { }
internal _MonitorHandlerFactory GetFactory(MonitorExecutionContext request) { return _factoryHelper.Current; }
public bool Execute(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Execute")) { bool result = default(bool); string key = (target != null ? target.TypeFaultSourceTypeKey : string.Empty); try { if (!key.IsEmpty()) method.Info("!&! HANDLER STARTED FOR : " + key); // force meters add this.OnForceMeterRead(context, target); // execute the target result = this.OnExecuteInternal(context, target); } catch (Exception ex) { method.Exception(ex); } finally { if (!key.IsEmpty()) method.Info("!&! HANDLER COMPLETED FOR : " + key); } return result; } }
protected virtual void OnForceMeterRead(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { }
void OnExecutorDelayLoading_ProcessItem(MonitorExecutionContext context) { var factory = GetFactory(context); do { if (!factory.IsExecuting) break; } while (!_teWait.Wait(_tsWait)); factory.Execute(context, null); }