public ActionResult <OrderBody> Update(OrderBody orderBody) { unitOfWork.OrderBodyRepo.Update(orderBody); unitOfWork.Save(); return(CreatedAtAction(nameof(GetById), new { id = orderBody.Id }, orderBody)); }
public IHttpActionResult Get__104([FromBody] OrderBody body) { System.Threading.Thread.Sleep(100); _temp.CircleDriverCount = 1; _temp.OrderStatus = 1; _temp.NeedHackOrder = true; _temp.HackOrderStartAddress = body.planStartLoc.addr; _temp.HackOrderStartTimeSince1970 = _temp.GetMSSince1970(DateTime.UtcNow); _temp.HackOrderStartLat = body.planStartLoc.lat; _temp.HackOrderStartLng = body.planStartLoc.lng; _temp.HackOrderEndAddress = body.planEndLoc?.addr ?? null; var config = ReadMockingFileAs <MockConfig>(200); var fileObject = ReadMockingFileAsObject(config.create_order_file); DoHackOrderIfNeed(fileObject); return(WrapResultJson(fileObject)); }
public async Task <Order[]> GetUnhandledOrdersAsync() { using (IDbConnection connection = _connectionFactory.BuildConnection()) { string query = $@" with cte as ( update ""Orders"" set ""Status"" = '{ProcessingStatus.InProcess}', ""LastModificationDate"" = now() where ""Status"" = '{ProcessingStatus.New}' or (""Status"" = '{ProcessingStatus.InProcess}' and date_part('minutes', now() - ""LastModificationDate""::timestamp) > 5) returning ""Title"", ""Description"", ""Link"", ""Publication"", ""FreelanceBurseId"" ) select * from cte join ""FreelanceBurses"" fb on cte.""FreelanceBurseId"" = fb.""Id"" "; IEnumerable <OrderEntity> result = await connection.QueryAsync <OrderEntity, FreelanceBurseEntity, OrderEntity>( query, (o, fb) => { o.FreelanceBurse = fb; return(o); }); return(result.Select( p => { var body = new OrderBody(p.Title, p.Description, new Uri(p.Link), p.Publication); var burse = new FreelanceBurse(p.FreelanceBurseId, new Uri(p.FreelanceBurse.Link), p.FreelanceBurse.Name); return new Order(body, burse); }) .ToArray()); } }
private static string CreateOrderBodyString(Order order) { Instrument instrument = new Instrument(order.Symbol, AssetType.OPTION, OptionSymbolUtils.StandardDateFormat); OrderLeg orderLeg = new OrderLeg(order.Instruction, order.Quantity, instrument); List <OrderLeg> orderLegCollection = new List <OrderLeg>(); orderLegCollection.Add(orderLeg); string?priceStr = null; if (order.OrderType == OrderType.LIMIT) { double doublePrice = Math.Round(order.Limit, 2); priceStr = doublePrice.ToString(); } OrderBody orderBody = new OrderBody( "NONE", order.OrderType, "NORMAL", priceStr, order.CancelTime == null ? "DAY" : "GOOD_TILL_CANCEL", "SINGLE", orderLegCollection); string orderBodyStr = JsonConvert.SerializeObject(orderBody, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore, ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } }); Log.Information("TDAm Order: {@Order}, string: {OrderStr}, Symbol {Symbol}", orderBody, orderBodyStr, instrument.Symbol); return(orderBodyStr); }
public Order(OrderBody body, FreelanceBurse source) { Source = source; Body = body; }