public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); DelHoldInfo DhInfo = new DelHoldInfo(); DhInfo.LoginID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText; DhInfo.TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; DhInfo.CurrentTime = Convert.ToDateTime(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/CurrentTime").InnerText); DhInfo.HoldOrderID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/HoldOrderId").InnerText; DhInfo.UserType = 0; //客户端没有传递这个值 内部调用默认赋值0 表示普通用户 DhInfo.ReasonType = "1"; //手动取消 MarDelivery mdy = trade.DelHoldOrder(DhInfo); if (!mdy.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(mdy.ReturnCode, mdy.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { StringBuilder fundinfo = new StringBuilder(); fundinfo.Append("<FundInfo>"); fundinfo.AppendFormat("<Money>{0}</Money>", mdy.MoneyInventory.FdInfo.Money); fundinfo.AppendFormat("<OccMoney>{0}</OccMoney>", mdy.MoneyInventory.FdInfo.OccMoney); fundinfo.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", mdy.MoneyInventory.FdInfo.FrozenMoney); fundinfo.Append("</FundInfo>"); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, string.Format("<DataBody>{0}</DataBody>", fundinfo.ToString())); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); string UserName = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/UserName").InnerText; string TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/TradeAccount").InnerText; string TradePwd = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/TradePwd").InnerText; string PhoneNum = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/PhoneNum").InnerText; string Email = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/Email").InnerText; string CardNum = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/RegInfo/CardNum").InnerText; ResultDesc rdsc = trade.RegTestTradeUser(UserName, TradeAccount, TradePwd, PhoneNum, Email, CardNum); if (!rdsc.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(rdsc.ReturnCode, rdsc.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, string.Format("<DataBody></DataBody>")); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); MarketLnEnter orderln = new MarketLnEnter(); orderln.LoginID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText; orderln.TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; orderln.CurrentTime = Convert.ToDateTime(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/CurrentTime").InnerText); orderln.OrderId = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/OrderId").InnerText; //可以不设置止盈止损价 如果为空 不能直接转换 string ProfitPrice = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/ProfitPrice").InnerText; string LossPrice = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/LossPrice").InnerText; orderln.ProfitPrice = Convert.ToDouble(string.IsNullOrEmpty(ProfitPrice) ? "0" : ProfitPrice); orderln.LossPrice = Convert.ToDouble(string.IsNullOrEmpty(LossPrice) ? "0" : LossPrice); Marketorders orders = trade.ModifyMarketorders(orderln); if (!orders.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(orders.ReturnCode, orders.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { StringBuilder strb = new StringBuilder(); strb.Append("<Order>"); strb.AppendFormat("<OrderId>{0}</OrderId>", orders.TradeOrder.OrderId); strb.AppendFormat("<ProductName>{0}</ProductName>", orders.TradeOrder.ProductName); strb.AppendFormat("<ProductCode>{0}</ProductCode>", orders.TradeOrder.ProductCode); strb.AppendFormat("<PriceCode>{0}</PriceCode>", orders.TradeOrder.PriceCode); strb.AppendFormat("<OrderPrice>{0}</OrderPrice>", orders.TradeOrder.OrderPrice); strb.AppendFormat("<Quantity>{0}</Quantity>", orders.TradeOrder.Quantity); strb.AppendFormat("<UseQuantity>{0}</UseQuantity>", orders.TradeOrder.UseQuantity); strb.AppendFormat("<OccMoney>{0}</OccMoney>", orders.TradeOrder.OccMoney); strb.AppendFormat("<LossPrice>{0}</LossPrice>", orders.TradeOrder.LossPrice); strb.AppendFormat("<ProfitPrice>{0}</ProfitPrice>", orders.TradeOrder.ProfitPrice); strb.AppendFormat("<OrderType>{0}</OrderType>", orders.TradeOrder.OrderType); strb.AppendFormat("<OrderTime>{0}</OrderTime>", orders.TradeOrder.OrderTime.ToString(Const.dateformat)); strb.AppendFormat("<TradeFee>{0}</TradeFee>", orders.TradeOrder.TradeFee); strb.AppendFormat("<StorageFee>{0}</StorageFee>", orders.TradeOrder.StorageFee); strb.AppendFormat("<TotalWeight></TotalWeight>"); strb.Append("</Order>"); //响应消息体 string DataBody = string.Format("<DataBody><Orders>{0}</Orders></DataBody>", strb); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, DataBody); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); string LoginID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText; string TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; MoneyInventory miy = trade.GetMoneyInventory(LoginID); if (!miy.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(miy.ReturnCode, miy.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { StringBuilder strb = new StringBuilder(); strb.Append("<FundInfo>"); strb.AppendFormat("<CashUser>{0}</CashUser>", miy.FdInfo.CashUser); strb.AppendFormat("<SubUser>{0}</SubUser>", miy.FdInfo.SubUser); strb.AppendFormat("<TanUser>{0}</TanUser>", miy.FdInfo.TanUser); strb.AppendFormat("<State>{0}</State>", miy.FdInfo.State); strb.AppendFormat("<Money>{0}</Money>", miy.FdInfo.Money); strb.AppendFormat("<OccMoney>{0}</OccMoney>", miy.FdInfo.OccMoney); strb.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", miy.FdInfo.FrozenMoney); strb.AppendFormat("<ConBankType>{0}</ConBankType>", miy.FdInfo.ConBankType); strb.AppendFormat("<OpenBank>{0}</OpenBank>", miy.FdInfo.OpenBank); strb.AppendFormat("<BankAccount>{0}</BankAccount>", miy.FdInfo.BankAccount); strb.AppendFormat("<AccountName>{0}</AccountName>", miy.FdInfo.AccountName); strb.Append("</FundInfo>"); strb.Append("<Storages>"); //strb.Append("<Storage>"); //strb.Append("<Key>XAU</Key>"); //strb.Append("<Name>黄金</Name>"); //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xau); //strb.Append("</Storage>"); //strb.Append("<Storage>"); //strb.Append("<Key>XAG</Key>"); //strb.Append("<Name>白银</Name>"); //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xag); //strb.Append("</Storage>"); //strb.Append("<Storage>"); //strb.Append("<Key>XPT</Key>"); //strb.Append("<Name>铂金</Name>"); //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xpt); //strb.Append("</Storage>"); //strb.Append("<Storage>"); //strb.Append("<Key>XPD</Key>"); //strb.Append("<Name>钯金</Name>"); //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xpd); //strb.Append("</Storage>"); strb.Append("</Storages>"); //响应消息体 string DataBody = string.Format("<DataBody>{0}</DataBody>", strb); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, DataBody); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); OrdersLncoming orderln = new OrdersLncoming(); orderln.Mac = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/Mac").InnerText; orderln.LoginID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText; orderln.TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; orderln.CurrentTime = Convert.ToDateTime(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/CurrentTime").InnerText); //可以不设置止盈止损价 如果为空 不能直接转换 string ProfitPrice = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/ProfitPrice").InnerText; string LossPrice = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/LossPrice").InnerText; orderln.ProfitPrice = Convert.ToDouble(string.IsNullOrEmpty(ProfitPrice) ? "0" : ProfitPrice); orderln.LossPrice = Convert.ToDouble(string.IsNullOrEmpty(LossPrice) ? "0" : LossPrice); orderln.OrderType = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/OrderType").InnerText; orderln.ProductCode = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/ProductCode").InnerText; orderln.HoldPrice = Convert.ToDouble(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/HoldPrice").InnerText); orderln.Quantity = Convert.ToDouble(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/Quantity").InnerText); orderln.RtimePrices = Convert.ToDouble(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/RtimePrices").InnerText); orderln.ValidTime = Convert.ToDateTime(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/HoldOrders/HoldOrder/ValidTime").InnerText); //ValidTime orderln.UserType = 0; //客户端没有传递这个值 内部调用默认赋值0 表示普通用户 orderln.OrderMoney = 0; //客户端没有传递这个值 这个值本身也没有使用 随便赋个值 Orders orders = trade.GetOrders(orderln); if (!orders.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(orders.ReturnCode, orders.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { //返回的结构不一样 不能直接转换 //string holdorder = XmlUtil.SerializeObjToXml(typeof(TradeHoldOrder), orders.TradeHoldOrder); StringBuilder strb = new StringBuilder(); strb.AppendFormat("<HoldOrderId>{0}</HoldOrderId>", orders.TradeHoldOrder.HoldOrderID); strb.AppendFormat("<ProductCode>{0}</ProductCode>", orders.TradeHoldOrder.ProductCode); strb.AppendFormat("<HoldPrice>{0}</HoldPrice>", orders.TradeHoldOrder.HoldPrice); strb.AppendFormat("<Quantity>{0}</Quantity>", orders.TradeHoldOrder.Quantity); strb.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", orders.TradeHoldOrder.FrozenMoney); strb.AppendFormat("<ValidTime>{0}</ValidTime>", orders.TradeHoldOrder.ValidTime.ToString(Const.dateformat)); strb.AppendFormat("<LossPrice>{0}</LossPrice>", orders.TradeHoldOrder.LossPrice); strb.AppendFormat("<ProfitPrice>{0}</ProfitPrice>", orders.TradeHoldOrder.ProfitPrice); strb.AppendFormat("<OrderType>{0}</OrderType>", orders.TradeHoldOrder.OrderType); strb.AppendFormat("<OrderTime>{0}</OrderTime>", orders.TradeHoldOrder.OrderTime.ToString(Const.dateformat)); strb.Append("<CancelTime></CancelTime>"); StringBuilder fundinfo = new StringBuilder(); fundinfo.Append("<FundInfo>"); fundinfo.AppendFormat("<Money>{0}</Money>", orders.MoneyInventory.FdInfo.Money); fundinfo.AppendFormat("<OccMoney>{0}</OccMoney>", orders.MoneyInventory.FdInfo.OccMoney); fundinfo.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", orders.MoneyInventory.FdInfo.FrozenMoney); fundinfo.Append("</FundInfo>"); //响应消息体 string DataBody = string.Format("<DataBody><HoldOrders><HoldOrder>{0}</HoldOrder></HoldOrders>{1}</DataBody>", strb.ToString(), fundinfo.ToString()); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, DataBody); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); DeliveryEnter orderln = new DeliveryEnter(); orderln.LoginID = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText; orderln.TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; orderln.CurrentTime = Convert.ToDateTime(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/CurrentTime").InnerText); orderln.Orderid = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/OrderId").InnerText; orderln.Quantity = Convert.ToDouble(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/Quantity").InnerText); orderln.RtimePrices = Convert.ToDouble(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/RtimePrices").InnerText); string MaxPrice = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/Orders/Order/MaxPrice").InnerText; orderln.MaxPrice = Convert.ToDouble(string.IsNullOrEmpty(MaxPrice) ? "0" : MaxPrice); // orderln.UserType = 0; //客户端没有传递这个值 内部调用默认赋值0 表示普通用户 Marketorders orders = trade.DelOrder(orderln); if (!orders.Result) { string CodeDesc = ResCode.UL005Desc; string ReturnCode = GssGetCode.GetCode(orders.ReturnCode, orders.Desc, ref CodeDesc); ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>")); } else { StringBuilder strb = new StringBuilder(); strb.Append("<Order>"); strb.AppendFormat("<OrderId>{0}</OrderId>", orders.TradeOrder.OrderId); strb.AppendFormat("<ProductName>{0}</ProductName>", orders.TradeOrder.ProductName); strb.AppendFormat("<ProductCode>{0}</ProductCode>", orders.TradeOrder.ProductCode); strb.AppendFormat("<PriceCode>{0}</PriceCode>", orders.TradeOrder.PriceCode); strb.AppendFormat("<OrderPrice>{0}</OrderPrice>", orders.TradeOrder.OrderPrice); strb.AppendFormat("<Quantity>{0}</Quantity>", orders.TradeOrder.Quantity); strb.AppendFormat("<UseQuantity>{0}</UseQuantity>", orders.TradeOrder.UseQuantity); strb.AppendFormat("<OccMoney>{0}</OccMoney>", orders.TradeOrder.OccMoney); strb.AppendFormat("<LossPrice>{0}</LossPrice>", orders.TradeOrder.LossPrice); strb.AppendFormat("<ProfitPrice>{0}</ProfitPrice>", orders.TradeOrder.ProfitPrice); strb.AppendFormat("<OrderType>{0}</OrderType>", orders.TradeOrder.OrderType); strb.AppendFormat("<OrderTime>{0}</OrderTime>", orders.TradeOrder.OrderTime.ToString(Const.dateformat)); strb.AppendFormat("<TradeFee>{0}</TradeFee>", orders.TradeOrder.TradeFee); strb.AppendFormat("<StorageFee>{0}</StorageFee>", orders.TradeOrder.StorageFee); strb.AppendFormat("<TotalWeight></TotalWeight>"); strb.Append("</Order>"); StringBuilder fundinfo = new StringBuilder(); fundinfo.Append("<FundInfo>"); fundinfo.AppendFormat("<Money>{0}</Money>", orders.MoneyInventory.FdInfo.Money); fundinfo.AppendFormat("<OccMoney>{0}</OccMoney>", orders.MoneyInventory.FdInfo.OccMoney); fundinfo.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", orders.MoneyInventory.FdInfo.FrozenMoney); fundinfo.Append("</FundInfo>"); //响应消息体 string DataBody = string.Format("<DataBody><Orders>{0}</Orders>{1}</DataBody>", strb.ToString(), fundinfo.ToString()); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, DataBody); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }