public static ICollection <XElement> GetPlaceResultForMobile(Mobile.Server.Transaction transaction, Token token) { ICollection <XElement> elements = new List <XElement>(); if (token != null && token.AppType == AppType.Mobile) { Token placeToken = new Token(token.UserID, token.UserType, AppType.TradingConsole); string tranCode; TransactionError error = Application.Default.TradingConsoleServer.Place(placeToken, Application.Default.StateServer, transaction.ToXmlNode(), out tranCode); if (error == TransactionError.Action_ShouldAutoFill) { error = TransactionError.OK; } foreach (Mobile.Server.Order order in transaction.Orders) { XElement orderErrorElement = new XElement("Order"); orderErrorElement.SetAttributeValue("Id", order.Id); orderErrorElement.SetAttributeValue("ErrorCode", error.ToString()); elements.Add(orderErrorElement); } Mobile.Manager.UpdateWorkingOrder(token, transaction.Id, error); return(elements); } return(null); }
private XElement ExecuteMobileRequest() { System.Data.DataSet initData = Mobile.Manager.GetInitData(_Token); List <string> argList = ArgumentsParser.Parse(_Request.Content); Guid selectedAccountId = (argList != null && argList.Count > 0 ? new Guid(argList[0]) : Guid.Empty); InitDataService.Init(_Request.ClientInfo.Session, initData); var result = Mobile.Manager.Initialize(_Token, initData, selectedAccountId); if (System.Configuration.ConfigurationManager.AppSettings["MobileDebug"] == "true") { Mobile.Server.Transaction transaction = iExchange3Promotion.Mobile.Manager.ConvertModifyRequest(_Token, new Guid("69B80BC0-90FA-46E3-AF08-1B6E67FFF506"), "1596", null, null, null, null, null, null, false); XElement element = new XElement("Result"); ICollection <XElement> errorCodes = MobileHelper.GetPlaceResultForMobile(transaction, _Token); } return(result); }
private PacketContent ModifyOrderAction(SerializedInfo request, Token token) { var args = ArgumentsParser.Parse(request.Content); if (token != null && token.AppType == AppType.Mobile) { Guid orderId = new Guid(args[0]); string price = args[1]; Guid? orderId2 = null; if (!string.IsNullOrEmpty(args[2])) { orderId2 = new Guid(args[2]); } string price2 = args[3]; string order1DoneLimitPrice = args[4]; string order1DoneStopPrice = args[5]; string order2DoneLimitPrice = args[6]; string order2DoneStopPrice = args[7]; bool isOco = bool.Parse(args[8]); Mobile.Server.Transaction transaction = Mobile.Manager.ConvertModifyRequest(token, orderId, price, orderId2, price2, order1DoneLimitPrice, order1DoneStopPrice, order2DoneLimitPrice, order2DoneStopPrice, isOco); XElement element = new XElement("Result"); ICollection <XElement> errorCodes = MobileHelper.GetPlaceResultForMobile(transaction, token); foreach (XElement orderErrorElement in errorCodes) { element.Add(orderErrorElement); } XElement changes = Mobile.Manager.GetChanges(request.ClientInfo.Session.ToString(), false); element.Add(changes); return(element.ToPacketContent()); } else { throw new NotImplementedException(); } }