public void Update(Json.StatusCode edinetstatuscode, Nullable <HttpStatusCode> status, MediaTypeHeaderValue contentType) { base.Update(status, contentType); EdinetStatusCode = edinetstatuscode; //if (edinetstatuscode.Status != "200") this.ReturnResult = (ResponseResult)Enum.ToObject(typeof(ResponseResult), int.Parse(edinetstatuscode.Status)); }
//private string GetLog(ApiResponse response, RequestType type) { // StringBuilder sb = new StringBuilder(); // sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} {1}\t", DateTime.Now, type.ToString()); // if (response.HttpStatusCode != null) // sb.AppendFormat("{0}[{1}]", (int)response.HttpStatusCode, response.HttpStatusCode.ToString()); // else // sb.Append("\t"); // if (response.EdinetStatusCode != null) // sb.AppendFormat("\t{0}[{1}]", response.EdinetStatusCode.Status, response.EdinetStatusCode.Message); // else // sb.Append("\t" + response.HeaderContentType.MediaType ?? ""); // if (response.Exception != null) { // sb.AppendFormat("\t{0}", response.Exception.Message); // if (response.Exception.InnerException != null) // sb.AppendFormat(" {0}", response.Exception.InnerException.Message); // } // return sb.ToString(); //} private string GetLog(Nullable <HttpStatusCode> statusCode, RequestType type, MediaTypeHeaderValue mediaType, string filename = "", int id = 0, Exception exception = null, Json.StatusCode edinetStatusCode = null) { StringBuilder sb = new StringBuilder(); try { sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff}\t{1}\t", DateTime.Now, type.ToString()); if (statusCode != null) { sb.AppendFormat("{0}[{1}]", (int)statusCode, statusCode.ToString()); } else { sb.Append("\t"); } if (edinetStatusCode != null) { sb.AppendFormat("\t{0}[{1}]", edinetStatusCode.Status, edinetStatusCode.Message); } else { sb.Append("\t" + mediaType ?? ""); } if (exception != null) { sb.AppendFormat("\t{0}", exception.Message); if (exception.InnerException != null) { sb.AppendFormat(" {0}", exception.InnerException.Message); } } sb.AppendFormat("\t{0}", filename); if (id > 0) { sb.AppendFormat("\t{0}", id); } } catch (Exception ex) { throw(ex); } return(sb.ToString()); }