Beispiel #1
0
 public void SendAlert()
 {
     if (IsValid())
     {
         var props = Writer.EnsureProperties(properties);
         props.Add(XFConstants.EventWriter.EventType, EventTypeOption.Alert);
         props.Add(XFConstants.Alert.Title, Title);
         props.Add(XFConstants.Alert.Message, Message);
         props.Add(XFConstants.Alert.Categories, Categories.ToString());
         props.Add(XFConstants.Alert.Urgency, Urgency.ToString());
         props.Add(XFConstants.Alert.Importance, Importance.ToString());
         props.Add(XFConstants.Alert.Targets, Audiences.ToString());
         props.Add(XFConstants.Alert.Source, Source);
         props.Add(XFConstants.Alert.CreatedAt, DateTime.Now.ToString(XFConstants.DateTimeFormat));
         if (!String.IsNullOrEmpty(Error))
         {
             props.Add(XFConstants.Alert.Error, Error);
         }
         if (!String.IsNullOrWhiteSpace(Stacktrace))
         {
             props.Add(XFConstants.Alert.StackTrace, Stacktrace);
         }
         if (!String.IsNullOrWhiteSpace(NamedRecipient))
         {
             props.Add(XFConstants.Alert.NamedTarget, NamedRecipient);
         }
         if (!String.IsNullOrWhiteSpace(Topic))
         {
             props.Add(XFConstants.Alert.Topic, Topic);
         }
         List <TypedItem> list = Writer.Convert(props);
         EventWriter.Write(EventTypeOption.Alert, list);
     }
 }