/// <summary> /// Records a transaction message to the debug log. /// </summary> /// <param name="providerName">Name of the provider or gateway</param> /// <param name="direction">Indicates whether the data was sent or received</param> /// <param name="message">Content of the message</param> /// <param name="sensitiveData">A dictionary of key/value pairs that contains sensitive data that exists within the message (key) and the desired replacement (value). Pass null if no replacements are required.</param> protected void RecordCommunication(string providerName, CommunicationDirection direction, string message, Dictionary <string, string> sensitiveData) { //CHECK FOR SENSITIVE DATA THAT MUST BE SCRUBBED if (sensitiveData != null) { foreach (string key in sensitiveData.Keys) { message = message.Replace(key, sensitiveData[key]); } } //GET LOG DIRECTORY string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data\\Logs\\"); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } string fileName = Path.Combine(directory, providerName + ".Log"); using (StreamWriter sw = File.AppendText(fileName)) { sw.WriteLine(direction.ToString() + ": " + message); sw.WriteLine(string.Empty); sw.Close(); } }
public Communication(CommunicationDirection direction, String content, DateTime communicationTime) { Direction = direction; Content = content; CommunicationTime = communicationTime; }
public void RecordCommunication(CommunicationDirection direction, String content, DateTime communicationTime, TimeSpan duration, String responsibleParty) { _serviceCase.ApplyCommunicationRecorded(ThreadId, direction, content, communicationTime, duration, responsibleParty); }