Advertisement
Guest User

Untitled

a guest
May 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. public string GenerateMessage(IResourceProvider resourceProvider)
  2. {
  3.     string pattern;
  4.     switch (Reason)
  5.     {
  6.         case NotificationReason.SavingError:
  7.             pattern = resourceProvider.GetResource("ID_NOTIFICATION_SAVING_ERROR");
  8.             break;
  9.         case NotificationReason.ConfigurationOutOfReach:
  10.             pattern = resourceProvider.GetResource("ID_NOTIFICATION_CONFIGURATIONFROZEN");
  11.             break;
  12.         case NotificationReason.ConfigurationResumed:
  13.             pattern = resourceProvider.GetResource("ID_NOTIFICATION_CONFIGURATIONRESUMED");
  14.             break;
  15.         case NotificationReason.DataSourceConnectionResumed:
  16.             pattern = resourceProvider.GetResource("ID_NOTIFICATION_DATA_SOURCE_CONNECTION_RESUMED");
  17.             break;
  18.         case NotificationReason.DataSourceConnectionLost:
  19.             pattern = resourceProvider.GetResource("ID_NOTIFICATION_DATA_SOURCE_CONNECTION_LOST");
  20.             break;
  21.         default:
  22.             throw new NotSupportedException();
  23.     }
  24.     string notificationTimestamp;
  25.  
  26.     notificationTimestamp = NotificationTimeStamp.ToString(Interfaces.Utility.AuditTrailDateTimeFormat);
  27.  
  28.     pattern = Regex.Replace(pattern, Regex.Escape(configName), ConfigName, RegexOptions.IgnoreCase);
  29.     pattern = Regex.Replace(pattern, Regex.Escape(timestamp), notificationTimestamp, RegexOptions.IgnoreCase);
  30.     return pattern;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement