private PacketContent PlaceAction(SerializedInfo request, Token token) { var args = ArgumentsParser.Parse(request.Content); if (token != null && token.AppType == iExchange.Common.AppType.Mobile) { ICollection <Mobile.Server.Transaction> transactions = Mobile.Manager.ConvertPlacingRequest(token, args[0].ToXmlNode()); XElement element = new XElement("Result"); if (transactions != null) { foreach (Mobile.Server.Transaction transaction in transactions) { 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()); } return(TransactionService.Place(request.ClientInfo.Session, args[0].ToXmlNode()).ToPacketContent()); }
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(); } }