private static string GetOrderFieldText(string date, OrderHistoryEntry oh, string newValue) { return((string.IsNullOrEmpty(newValue) && string.IsNullOrEmpty(oh.Value)) ? string.Empty : string.IsNullOrEmpty(newValue) ? $"{date}{oh.ChangeOrderType.GetDescription()} - Informationen togs bort\n" : newValue.Equals(oh.Value, StringComparison.OrdinalIgnoreCase) ? string.Empty : $"{date}{oh.ChangeOrderType.GetDescription()} - Nytt värde: {newValue}\n"); }
/** * getOrderHistoryExample * Get historical order information and return information only for the last two days */ public static void getOrderHistoryExample() { /***Initialize the calling object*/ IdaxApiRestClient idaxApiRestClient = IdaxConfig.init(); /**Request parameter encapsulation**/ string symbol = IdaxApiConstants.ETH_BTC; OrderHistoryRequest orderHistoryRequest = new OrderHistoryRequest(); orderHistoryRequest.currentPage = 1; orderHistoryRequest.key = IdaxConfig.API_KEY; orderHistoryRequest.orderState = -1; orderHistoryRequest.pair = symbol; orderHistoryRequest.timestamp = DateTime.UtcNow.UnixTimeStamp(); orderHistoryRequest.pageLength = 10; /**Call remote interface**/ OrderHistoryEntry orderHistoryEntry = idaxApiRestClient.getOrderHistory(orderHistoryRequest); }
public void UpdateProjection(Order.Placed @event) { using (var db = new OrderHistoryDbContext()) { var entry = new OrderHistoryEntry { CustomerId = @event.CustomerId, OrderId = @event.AggregateId, OrderNumber = @event.OrderNumber, TotalPrice = @event.TotalPrice, Items = new List <OrderHistoryItem>(@event.Items.Select(i => new OrderHistoryItem { Id = Guid.NewGuid(), Price = i.Price, ProductName = i.ProductName, Quantity = i.Quantity })), PlacedOn = new DateTime(@event.Timestamp.Ticks) }; db.Orders.AddOrUpdate(entry); db.SaveChanges(); } }