123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace CB.TVUCenter
- {
- /// <summary>
- /// 输出结果
- /// </summary>
- /// <typeparam name="T"></typeparam>
- public class ViewResult<T>
- {
- public ViewResult()
- {
- }
- public int Code { get; set; }
- public string Message { get; set; }
- public T Entity { get; set; }
- public override string ToString()
- {
- var sp = new StringBuilder(2000);
- sp.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
- sp.Append("<Channel>");
- sp.AppendFormat("<Code>{0}</Code>", this.Code);
- if (0 != this.Code)
- {
- sp.AppendFormat("<Result>{0}</Result>", this.Message);
- }
- else
- {
- sp.AppendFormat("<Result>{0}</Result>", null == Entity ? "" : this.Entity.ToString());
- }
- sp.Append("</Channel>");
- return sp.ToString();
- }
- }
- }
|