Example #1
0
 private string RaiseBeforeAddToIndex(IPublishedContent content)
 {
     if (BeforeAddToIndex != null)
     {
         try
         {
             var cancelEventArgs = new FormEditorCancelEventArgs(content);
             BeforeAddToIndex.Invoke(this, cancelEventArgs);
             if (cancelEventArgs.Cancel)
             {
                 Log.Info("The form submission was valid, but it was not added to the index because an event handler for BeforeAddToIndex cancelled the submission.");
                 return(cancelEventArgs.ErrorMessage ?? "The form submission was cancelled by the BeforeAddToIndex event handler.");
             }
         }
         catch (Exception ex)
         {
             // an event handler failed - log error and continue
             Log.Error(ex, "An event handler for BeforeAddToIndex threw an exception.");
         }
     }
     return(null);
 }
Example #2
0
 private bool RaiseBeforeAddToIndex()
 {
     if (BeforeAddToIndex != null)
     {
         try
         {
             var cancelEventArgs = new CancelEventArgs();
             BeforeAddToIndex.Invoke(this, cancelEventArgs);
             if (cancelEventArgs.Cancel)
             {
                 Log.Info("The form submission was valid, but it was not added to the index because an event handler for BeforeAddToIndex cancelled the submission.");
                 return(false);
             }
         }
         catch (Exception ex)
         {
             // an event handler failed - log error and continue
             Log.Error(ex, "An event handler for BeforeAddToIndex threw an exception.");
         }
     }
     return(true);
 }