public void SendAlert(int level, AlertType type, Action <ISendAlertResult> callback) { try { IWebCall <TriggerAlertRequest, BaseResponse> webCall = mixWebCallFactory.IntegrationTestSupportUserAlertPost(new TriggerAlertRequest { Level = level.ToString(), Text = AlertTypeUtils.ToString(type) }); webCall.OnResponse += delegate { callback(new SendAlertResult(success: true)); }; webCall.OnError += delegate { callback(new SendAlertResult(success: false)); }; webCall.Execute(); } catch (Exception ex) { logger.Critical("Unhandled exception: " + ex); callback(new SendAlertResult(success: false)); } }
public void AddAlert(IInternalAlert alert) { try { string type = AlertTypeUtils.ToString(alert.Type); string level = alert.Level.ToString(); AlertDocument alertDocument = GetAlertDocument(alert.AlertId); if (alertDocument == null) { AlertDocument alertDocument2 = new AlertDocument(); alertDocument2.AlertId = alert.AlertId; alertDocument2.Type = type; alertDocument2.Level = level; alertDocument = alertDocument2; alerts.Insert(alertDocument); } else { alertDocument.Type = type; alertDocument.Level = level; alerts.Update(alertDocument); } } catch (CorruptionException ex) { databaseCorruptionHandler.HandleCorruption(ex); throw; } }
public Alert(string level, string type, long alertId) { int.TryParse(level, out this.level); Type = AlertTypeUtils.FromString(type); AlertId = alertId; }