private void ReportAlarmsAndEvents(string _mssg, AlarmPriority _priority, ServiceType _partner, EntitiesDataContext EDC, Shipping _sh) { Partner _principal = null; switch (_partner) { case ServiceType.Vendor: case ServiceType.Forwarder: case ServiceType.VendorAndForwarder: _principal = _sh.PartnerTitle; break; case ServiceType.SecurityEscortProvider: _principal = _sh.Shipping2PartnerTitle; break; case ServiceType.None: case ServiceType.Invalid: default: break; } AlarmsAndEvents _ae = new AlarmsAndEvents() { AlarmAndEventDetails = _mssg, AlarmAndEventOwner = _principal.ShepherdUserTitle, AlarmPriority = _priority, AlarmsAndEventsList2Shipping = _sh, AlarmsAndEventsList2PartnerTitle = _principal, Title = _sh.Title(), }; EDC.AlarmsAndEvents.InsertOnSubmit(_ae); }
private void RequestData(TimeSpan _delay, Shipping _sp, AlarmPriority _pr, EntitiesDataContext EDC, bool _TimeOutExpired) { string _frmt = "RequestDataTrucktrailerDrivers".GetLocalizedString(); _frmt = String.Format(_frmt, _delay, DateTime.Now + _delay); Shipping.RequiredOperations _ro = 0; switch (_pr) { case AlarmPriority.Normal: _ro = _sp.CalculateOperations2Do(false, true, _TimeOutExpired); _frmt.Insert(0, "Remainder".GetLocalizedString()); break; case AlarmPriority.High: _ro = _sp.CalculateOperations2Do(true, true, _TimeOutExpired); _frmt.Insert(0, "LastCall".GetLocalizedString()); break; case AlarmPriority.Warning: _ro = _sp.CalculateOperations2Do(false, true, _TimeOutExpired); _frmt.Insert(0, "Warnning".GetLocalizedString()); break; case AlarmPriority.None: case AlarmPriority.Invalid: default: break; } SetupEnvironment(_delay, _ro, _sp, _pr, EDC, _frmt, EmailType.RequestData); }
public void TriggerAlarm(AlarmPriority priority, TimeSpan?duration = null) { if (!this.IsAlarming) { this.IsAlarming = true; this.AlarmStateChanged?.Invoke(this, this.IsAlarming); } }
public void TriggerAlarm(AlarmPriority priority, TimeSpan?duration = null) { if (!this.IsAlarming || (priority == AlarmPriority.High && this.currentPriority == AlarmPriority.Normal)) { if (duration.HasValue) { this.whenToStop = DateTime.UtcNow + duration.Value; } else { this.whenToStop = null; } // Trigger the timer immediately this.currentPriority = priority; this.alarmTimer.Change( TimeSpan.Zero, priority == AlarmPriority.High ? HighPriorityInterval : NormalPriorityInterval); this.IsAlarming = true; this.AlarmStateChanged?.Invoke(this, true); } }
private void SetupAlarmsEvents(string _msg, Shipping.RequiredOperations _operations, AlarmPriority _prrty, EntitiesDataContext EDC, Shipping _sh) { if (Shipping.InSet(_operations, Shipping.RequiredOperations.AddAlarm2Escort)) { //TODO the message must depend on the receiver roele http://cas_sp:11225/sites/awt/Lists/RequirementsList/DispForm.aspx?ID=447 ReportAlarmsAndEvents(_msg, _prrty, ServiceType.SecurityEscortProvider, EDC, _sh); } if (Shipping.InSet(_operations, Shipping.RequiredOperations.AddAlarm2Carrier)) { ReportAlarmsAndEvents(_msg, _prrty, ServiceType.VendorAndForwarder, EDC, _sh); } }
private void SetupEnvironment(TimeSpan _delay, Shipping.RequiredOperations _operations, Shipping _sp, AlarmPriority _prrty, EntitiesDataContext _EDC, string _logDescription, EmailType _etype) { SetupAlarmsEvents(_logDescription, _operations, _prrty, _EDC, _sp); SetupEmail(_operations, _sp, _etype); SetupTimeout(_delay, _sp); }