/// <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; }
/// <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; }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Constructor from an XML exception /// </summary> /// <param name="exception">The exception.</param> public CCPAPIResult(XmlException exception) : this((Exception)exception) { m_error = APIErrorType.Xml; }
/// <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; }
/// <summary> /// Default constructor. /// </summary> public CCPAPIResult() { m_error = APIErrorType.None; m_errorMessage = String.Empty; m_exception = null; }
/// <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; }
/// <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; }
/// <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; }