通用返回XML格式结果

public class ResultModel
{
public string OrderCode { get; set; }
public string Message { get; set; }
} //通用返回XML格式结果
public void ReturnMsgToXML(string ErrMessage, int Status, List<ResultModel> ErrorResultList = null)
{
StringBuilder SBXML = new StringBuilder();
SBXML.Append("<Data>");
SBXML.AppendFormat("<ValidateResult Result=\"{1}\" Message=\"{0}\"></ValidateResult>", ErrMessage, Status);
if (ErrorResultList != null)
{
SBXML.Append("<OrderCodeResult>");
ErrorResultList.ForEach(item =>
{
SBXML.AppendFormat("<Information OrderCode=\"{0}\" Message=\"{1}\"></Information>", item.OrderCode.ToString(), item.Message.ToString());
});
SBXML.Append("</OrderCodeResult>");
}
SBXML.Append("</Data>");
Response.Clear();
Response.Write(SBXML.ToString()); }
上一篇:EM算法 The EM Algorithm


下一篇:RHEL6.4安装nginx