<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=346252320&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:346252320:41" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
/// <summary>
/// 构建响应的xml字符串
/// </summary>
/// <param name="orederInfo"></param>
/// <returns></returns>
private string ConstructorXml(CreateOrderInfo orederInfo)
{
string text = "";
try
{
XmlDocument xmlDoc = new XmlDocument();
XmlDeclaration declaration = xmlDoc.CreateXmlDeclaration("1.0", "gb2312", null);
xmlDoc.AppendChild(declaration);
XmlElement order = xmlDoc.CreateElement("JIT-Order-Response");
XmlElement orderItem = xmlDoc.CreateElement("Response");
string[] nodeName = new string[23];
string[] node = new string[23];
nodeName[0] = "OrderNo";
node[0] = orederInfo.OrderNo;
nodeName[1] = "PNR";
node[1] = orederInfo.Pnr;
nodeName[2] = "StayDiscount";
node[2] = orederInfo.StayDiscount.ToString("0.00");
nodeName[3] = "GrowDiscount";
node[3] = orederInfo.GrowDiscount.ToString("0.00");
nodeName[4] = "PayMoney";
node[4] = orederInfo.PayMoney.ToString("0.00");
nodeName[5] = "Profit";
node[5] = orederInfo.Profit.ToString("0.00");
nodeName[6] = "Status";
if (true == this.AutoState)
{
node[6] = "1";
}
else
{
node[6] = "0";
}
nodeName[7] = "Date";
node[7] = orederInfo.Date;
nodeName[8] = "Scity";
node[8] = orederInfo.Scity;
nodeName[9] = "Ecity";
node[9] = orederInfo.Ecity;
nodeName[10] = "Flight";
node[10] = orederInfo.Flight;
nodeName[11] = "Stime";
node[11] = orederInfo.Date + " " + orederInfo.Stime;
nodeName[12] = "Etime";
node[12] = orederInfo.Date + " " + orederInfo.Etime;
nodeName[13] = "Cabin";
node[13] = orederInfo.Cabin;
nodeName[14] = "Price";
node[14] = orederInfo.Price.ToString("0.00");
nodeName[15] = "Tax";
node[15] = orederInfo.Tax.ToString("0.00");
nodeName[16] = "PCount";
node[16] = orederInfo.PCount.ToString();
nodeName[17] = "PName";
node[17] = orederInfo.PName;
nodeName[18] = "PCard";
node[18] = orederInfo.PCard;
nodeName[19] = "JouneryInfo";
node[19] = orederInfo.JouneryInfo;
nodeName[20] = "IsBuyInsurance";
node[20] = orederInfo.IsBuyInsurace;
if (true == orederInfo.IsAutoPay)
{
nodeName[21] = "AutoPay";
if (true == orederInfo.IsAutoPaySuucess)
{
node[21] = "T";
}
else
{
node[21] = "F";
}
}
else
{
nodeName[21] = "";
node[21] = "";
if (!string.IsNullOrEmpty(orederInfo.TradeNum))
{
nodeName[22] = "TenpayTransactionId";//财付通交易号
node[22] = orederInfo.TradeNum;
}
else { nodeName[22] = ""; node[22] = ""; }
}
for (int index = 0; index < nodeName.Length; index++)
{
if (!string.IsNullOrEmpty(nodeName[index]))
{
XmlElement orderNo = xmlDoc.CreateElement(nodeName[index]);
XmlText txt = xmlDoc.CreateTextNode(node[index]);
orderNo.AppendChild(txt);
orderItem.AppendChild(orderNo);
order.AppendChild(orderItem);
xmlDoc.AppendChild(order);
}
}
text = xmlDoc.OuterXml;
}
catch (Exception ex)
{
Log.Process("", this.guid, ClientHelper.GetClientIP(), "OrderInterface.cs", orederInfo.OrderNo, "根据PNR创建订单", "构建响应的xml字符串异常:" + ex.StackTrace);
//Logger.Log<FlightSearchProcessor>.LogError(ex);
text = "300047"; //构建xml响应数据异常
}
return text;
}