Пример #1
0
 /// <summary>
 /// Format error message string
 /// </summary>
 /// <param name="error">Error object</param>
 /// <returns>Formatted error string</returns>
 public string GetErrorString(Misys.OpicsPlus.Framework.Common.Errors.Error error)
 {
     return string.Format("Error {0} of type '{2}' occurred.\n{1}", error.Number, error.Text, error.Type);
 }
Пример #2
0
 /// <summary>
 /// Log outgoing messages
 /// </summary>
 /// <param name="error">Misys.OpicsPlus.Framework.Common.Errors.Error</param>
 /// <param name="outgoingMessage">Message that is going out (to client)</param>
 public void LogOutgoingErrors(Misys.OpicsPlus.Framework.Common.Errors.Error error, ServiceMessage outgoingMessage)
 {
     string empty;
     string str;
     try
     {
         if (error.Occurred())
         {
             Log(string.Format("Error {0}: '{1}'", error.Number, error.Text), string.Empty, "ServiceRedirector.LogOutgoingErrors", LogMessageType.Error, "MBRE");
         }
         if (outgoingMessage.Header.ServiceErrors.Count > 0)
         {
             foreach (Misys.OpicsPlus.Framework.ServiceMessages.Error serviceError in outgoingMessage.Header.ServiceErrors)
             {
                 empty = string.Empty;
                 foreach (Field field in serviceError.Fields)
                 {
                     empty = string.Concat(empty, string.Format("Field: {0}, Location: {1};", field.Name, field.Location));
                 }
                 str = string.Empty;
                 foreach (Param parameter in serviceError.Parameters)
                 {
                     str = string.Concat(str, string.Format("Parameter: {0}, Value: {1};", parameter.Name, parameter.Value));
                 }
                 Log(string.Format("Error {0}. Fields: '{1}'; Parameters: '{2}'", serviceError.Name, empty, str), string.Empty, "ServiceRedirector.LogOutgoingErrors", LogMessageType.Error, "MBRE");
             }
         }
         if (outgoingMessage.Body.Errors.Count > 0)
         {
             foreach (Misys.OpicsPlus.Framework.ServiceMessages.Error error2 in outgoingMessage.Body.Errors)
             {
                 empty = string.Empty;
                 foreach (Field field in error2.Fields)
                 {
                     empty = string.Concat(empty, string.Format("Field: {0}, Location: {1};", field.Name, field.Location));
                 }
                 str = string.Empty;
                 foreach (Param parameter in error2.Parameters)
                 {
                     str = string.Concat(str, string.Format("Parameter: {0}, Value: {1};", parameter.Name, parameter.Value));
                 }
                 this.Log(string.Format("Error {0}. Fields: '{1}'; Parameters: '{2}'", error2.Name, empty, str), string.Empty, "ServiceRedirector.LogOutgoingErrors", LogMessageType.Error, "MBRE");
             }
         }
     }
     catch (Exception exception)
     {
         Debug.WriteLine(string.Format("OpicsLoggerHelper.LogOutgoingErrors(Common.Errors.Error error, ServiceMessage outgoingMessage): {0}", exception));
     }
 }