示例#1
0
 /// <summary>
 /// Creates a JSON result wrapped from another JSON result.
 /// </summary>
 /// <param name="wrapped">The JSON result to wrap.</param>
 protected JsonResult(JsonResult <T> wrapped)
 {
     m_exception = wrapped.Exception;
     m_message   = wrapped.ErrorMessage;
     m_error     = wrapped.ErrorType;
     m_response  = wrapped.m_response;
     Result      = wrapped.Result;
 }
示例#2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public JsonResult(ResponseParams response, T result = default(T))
 {
     m_error     = APIErrorType.None;
     m_exception = null;
     m_message   = string.Empty;
     m_response  = response;
     Result      = result;
 }
示例#3
0
 /// <summary>
 /// Constructor from a CCP API internal error
 /// </summary>
 /// <param name="response">The response parameters including the error code.</param>
 /// <param name="message">The CCP error message.</param>
 public JsonResult(ResponseParams response, string message)
 {
     m_error     = APIErrorType.CCP;
     m_exception = null;
     m_message   = message ?? string.Empty;
     m_response  = response;
     Result      = default(T);
 }
示例#4
0
 /// <summary>
 /// Creates a JSON result wrapped from another JSON result.
 /// </summary>
 /// <param name="wrapped">The JSON result to wrap.</param>
 protected JsonResult(JsonResult <T> wrapped)
 {
     m_exception    = wrapped.Exception;
     m_message      = wrapped.ErrorMessage;
     m_error        = wrapped.ErrorType;
     m_responseCode = wrapped.ResponseCode;
     Result         = wrapped.Result;
     CurrentTime    = wrapped.CurrentTime;
 }
示例#5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public JsonResult(int responseCode, T result = default(T))
 {
     m_error        = APIErrorType.None;
     m_exception    = null;
     m_message      = string.Empty;
     m_responseCode = responseCode;
     Result         = result;
     CurrentTime    = DateTime.UtcNow;
 }
示例#6
0
 /// <summary>
 /// Constructor from a CCP API internal error
 /// </summary>
 /// <param name="code">The CCP error code.</param>
 /// <param name="message">The CCP error message.</param>
 public JsonResult(int code, string message)
 {
     m_error        = APIErrorType.CCP;
     m_exception    = null;
     m_message      = message ?? string.Empty;
     m_responseCode = code;
     Result         = default(T);
     CurrentTime    = DateTime.UtcNow;
 }
示例#7
0
 /// <summary>
 /// Constructor from a custom exception.
 /// </summary>
 /// <param name="error">The error.</param>
 /// <param name="message">The message.</param>
 public CCPAPIResult(APIErrorType error, string message)
 {
     m_error        = error;
     m_errorMessage = message;
     m_exception    = null;
 }
示例#8
0
 /// <summary>
 /// Constructor from an XML serialization exception wrapped into an InvalidOperationException
 /// </summary>
 /// <param name="exception">The exception.</param>
 public CCPAPIResult(InvalidOperationException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Xml;
 }
示例#9
0
 /// <summary>
 /// Constructor from an XSLT exception
 /// </summary>
 /// <param name="exception">The exception.</param>
 public CCPAPIResult(XsltException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Xml;
 }
示例#10
0
 /// <summary>
 /// Constructor from an XML exception
 /// </summary>
 /// <param name="exception">The exception.</param>
 public CCPAPIResult(XmlException exception)
     : this((Exception)exception)
 {
     m_error = APIErrorType.Xml;
 }
示例#11
0
 /// <summary>
 /// Constructor from an http exception
 /// </summary>
 /// <param name="exception">The exception.</param>
 public CCPAPIResult(HttpWebClientServiceException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Http;
 }
示例#12
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public CCPAPIResult()
 {
     m_error        = APIErrorType.None;
     m_errorMessage = String.Empty;
     m_exception    = null;
 }
示例#13
0
 /// <summary>
 /// Constructor from a JSON serialization exception wrapped into a SerializationException
 /// </summary>
 /// <param name="exception">The exception.</param>
 public JsonResult(SerializationException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Json;
 }
示例#14
0
 /// <summary>
 /// Constructor from a JSON serialization exception wrapped into an InvalidOperationException
 /// </summary>
 /// <param name="exception">The exception.</param>
 public JsonResult(InvalidOperationException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Json;
 }
示例#15
0
 /// <summary>
 /// Constructor from a JSON exception
 /// </summary>
 /// <param name="exception">The exception.</param>
 public JsonResult(InvalidDataContractException exception)
     : this(exception as Exception)
 {
     m_error = APIErrorType.Json;
 }