public static void SetAlert(AlertStatus status, string message) { string alert = String.Empty; switch (status) { case AlertStatus.Succes: alert = "success"; break; case AlertStatus.Info: alert = "info"; break; case AlertStatus.Warning: alert = "warning"; break; case AlertStatus.Danger: alert = "danger"; break; } AlertType = alert; Message = message; IsAlerted = true; }
public async Task AcceptReport_WhenAlertIsInRightStatus_ShouldReturnSuccess(AlertStatus status) { _alertReports.First().Alert.Status = status; var result = await _alertReportService.AcceptReport(TestData.AlertId, TestData.ReportId); result.IsSuccess.ShouldBeTrue(); }
public async Task EscalateAlert_WhenAlertIsNotPending_ShouldReturnError(AlertStatus status) { _alerts.First().Status = status; var result = await _alertService.Escalate(TestData.AlertId); result.IsSuccess.ShouldBeFalse(); result.Message.Key.ShouldBe(ResultKey.Alert.EscalateAlert.WrongStatus); }
public Alert() { _alertID = 0; _type = AlertType.support; _category = AlertCategory.expired; _message = ""; _field1 = ""; _field2 = ""; _status = AlertStatus.active; _alertedOnDate = DateTime.Today; }
/// <summary> /// Copy constructor /// </summary> /// <param name="other"></param> public Alert(Alert other) { _alertID = other._alertID; _type = other._type; _category = other._category; _message = other._message; _field1 = other._field1; _field2 = other._field2; _status = other._status; _alertedOnDate = other._alertedOnDate; }
protected Alert( DateTime time, AlertSeverity severity, AlertStatus status) : this( time, time, severity, status) { }
public AlertViewModel(string message, AlertStatus status = AlertStatus.Information, string title = null) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException("Message is empty"); } Title = title; Message = message; Status = status; }
private void BuildSweetAlert(string hexaBgColor, AlertStatus alertStatus, string title, string message) { SweetAlertBuilder sweetAlertBuilder = new SweetAlertBuilder { HexaBackgroundColor = hexaBgColor, AlertIcons = alertStatus, Title = title, Message = message, }; sweetAlertBuilder.BuildSweetAlert(this); }
internal static string ToSerializedValue(this AlertStatus value) { switch (value) { case AlertStatus.Active: return("Active"); case AlertStatus.Cleared: return("Cleared"); } return(null); }
protected Alert( DateTime startTime, DateTime endTime, AlertSeverity severity, AlertStatus status) { Id = ObjectId.GenerateNewId(); StartTime = startTime; EndTime = endTime; IsVisible = true; Severity = severity; Status = status; }
/// <summary> /// Initializes a new instance of the Alert class. /// </summary> /// <param name="title">The title of the alert</param> /// <param name="scope">The scope of the alert. Possible values /// include: 'Resource', 'Device'</param> /// <param name="alertType">The type of the alert</param> /// <param name="appearedAtTime">The UTC time at which the alert was /// raised</param> /// <param name="appearedAtSourceTime">The source time at which the /// alert was raised</param> /// <param name="source">The source at which the alert was /// raised</param> /// <param name="severity">The severity of the alert. Possible values /// include: 'Informational', 'Warning', 'Critical'</param> /// <param name="status">The current status of the alert. Possible /// values include: 'Active', 'Cleared'</param> /// <param name="id">The path ID that uniquely identifies the /// object.</param> /// <param name="name">The name of the object.</param> /// <param name="type">The hierarchical type of the object.</param> /// <param name="kind">The Kind of the object. Currently only /// Series8000 is supported. Possible values include: /// 'Series8000'</param> /// <param name="clearedAtTime">The UTC time at which the alert was /// cleared</param> /// <param name="clearedAtSourceTime">The source time at which the /// alert was cleared</param> /// <param name="recommendation">The recommended action for the issue /// raised in the alert</param> /// <param name="resolutionReason">The reason for resolving the /// alert</param> /// <param name="errorDetails">The details of the error for which the /// alert was raised</param> /// <param name="detailedInformation">More details about the /// alert</param> public Alert(string title, AlertScope scope, string alertType, System.DateTime appearedAtTime, System.DateTime appearedAtSourceTime, AlertSource source, AlertSeverity severity, AlertStatus status, string id = default(string), string name = default(string), string type = default(string), Kind?kind = default(Kind?), System.DateTime?clearedAtTime = default(System.DateTime?), System.DateTime?clearedAtSourceTime = default(System.DateTime?), string recommendation = default(string), string resolutionReason = default(string), AlertErrorDetails errorDetails = default(AlertErrorDetails), IDictionary <string, string> detailedInformation = default(IDictionary <string, string>)) : base(id, name, type, kind) { Title = title; Scope = scope; AlertType = alertType; AppearedAtTime = appearedAtTime; AppearedAtSourceTime = appearedAtSourceTime; ClearedAtTime = clearedAtTime; ClearedAtSourceTime = clearedAtSourceTime; Source = source; Recommendation = recommendation; ResolutionReason = resolutionReason; Severity = severity; Status = status; ErrorDetails = errorDetails; DetailedInformation = detailedInformation; }
/// <summary> /// The alert level, based on the alert status /// </summary> /// <param name="alertStatus"></param> public static AlertLevel?GetAlertLevel(this AlertStatus alertStatus) { var alertStatusString = alertStatus.ToString(); if (alertStatusString.Contains("Critical")) { return(AlertLevel.Critical); } if (alertStatusString.Contains("Error")) { return(AlertLevel.Error); } if (alertStatusString.Contains("Warn")) { return(AlertLevel.Warning); } return(null); }
public static string ToString(AlertStatus value) { if (value == AlertStatus.Active) { return("active"); } else if (value == AlertStatus.Inactive) { return("inactive"); } else if (value == AlertStatus.Error) { return("error"); } else { throw new ArgumentException("Unrecognized AlertStatus value: " + value.ToString()); } }
public Alert(DataRow dataRow) : this() { try { _alertID = (int)dataRow["_ALERTID"]; _type = (AlertType)(int)dataRow["_TYPE"]; _category = (AlertCategory)(int)dataRow["_CATEGORY"]; _message = (string)dataRow["_MESSAGE"]; _field1 = (string)dataRow["_FIELD1"]; _field2 = (string)dataRow["_FIELD2"]; _status = (AlertStatus)(int)dataRow["_STATUS"]; _alertedOnDate = (DateTime)dataRow["_ALERTDATE"]; _assetName = (string)dataRow["_ASSETNAME"]; _alertName = (string)dataRow["_ALERTNAME"]; } catch (Exception ex) { MessageBox.Show("Exception occured creating an ALERT Object, please check database schema. The message was " + ex.Message); } }
public static bool TryParse(string value, out AlertStatus result) { result = default(AlertStatus); if (value == "active") { result = AlertStatus.Active; } else if (value == "inactive") { result = AlertStatus.Inactive; } else if (value == "error") { result = AlertStatus.Error; } else { return(false); } return(true); }
public async Task CheckAlert_WhenAlertIsNoLongerPending_ShouldNotNotifyHeadManager(AlertStatus alertStatus) { // arrange _testData.WhenAnAlertAreTriggered.GenerateData().AddToDbContext(); var alert = _testData.WhenAnAlertAreTriggered.EntityData.Alerts.Single(); alert.Status = alertStatus; var stringResourceResult = new Dictionary <string, string> { { EmailContentKey.AlertHasNotBeenHandled.Subject, "Alert escalated subject" }, { EmailContentKey.AlertHasNotBeenHandled.Body, "Alert escalated body" } }; _stringsResourcesServiceMock.GetEmailContentResources(Arg.Any <string>()) .Returns(Result.Success <IDictionary <string, string> >(stringResourceResult)); _nyssReportApiConfigMock.BaseUrl = "http://example.com"; // act await _alertService.CheckIfAlertHasBeenHandled(alert.Id); // assert await _queuePublisherServiceMock.DidNotReceive().SendEmail(Arg.Any <(string, string)>(), Arg.Any <string>(), Arg.Any <string>()); }
public AlertMessage(AlertStatus status = 0, string message = "") { this.Status = status; this.Message = message; }
private static AlertAssessmentStatus GetAssessmentStatus(AlertStatus alertStatus, int acceptedReports, int pendingReports, int countThreshold) => alertStatus switch {
internal AlertDecoratorResult(ActionResult innerResult, AlertStatus status, string message) { InnerResult = innerResult; Status = status; Message = message; }
public Alert(string alertMessage, AlertStatus alertStatus) { this.alertMessage = alertMessage; this.alertStatus = alertStatus; }
public static void SaveAlertForSession(this ITempDataDictionary TempData, string message, AlertStatus status = AlertStatus.Information, string title = null) { TempData["alertMessage"] = message; TempData["alertTitle"] = title; TempData["alertStatus"] = status.ToString(); }
/// <summary> /// The SDT status, based on the alert status /// </summary> /// <param name="alertStatus"></param> public static bool IsInSdt(this AlertStatus alertStatus) => alertStatus.ToString().Contains("Sdt");
/// <summary> /// The acknowledgement status, based on the alert status /// </summary> /// <param name="alertStatus"></param> public static bool IsAcknowledged(this AlertStatus alertStatus) => alertStatus.ToString().Contains("Confirmed");
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="AlertStatus" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AlertStatus.CreateFrom(sourceValue);
public List<Alert> FindBy(AlertStatus status) { if (_alerts == null) Refresh(); var result = _alerts.Where<Alert>(x => x.Status == status).ToList<Alert>(); return result; }
public Alert(AlertStatus status, string message) { Status = status; Message = message; }