public void RunUnitOfWork(string jobKey) { var orders = SourceRepository.GetOrders().ToList(); if (orders.Any()) { _logger.Debug("Processing " + orders.Count + " orders."); _orderHistoryRepository.Save(orders.SelectMany(o => o.CreateHistories("Order picked.", "Pick Job"))); foreach (var order in orders) { var map = new OmsManhattanOrderMap { Company = order.Company, Created = DateTime.Now, OmsOrderNumber = order.OrderNumber, WmOrderNumber = order.ControlNumber }; _omsManhattanOrderMapRepository.InsertOmsManhattanOrderMapRepository(map); } DestinationRepository.SaveOrders(orders); SourceRepository.SetAsProcessed(orders); } else { _logger.Debug("No orders to run"); } }
public void RunUnitOfWork(string jobKey) { var orders = SourceRepository.GetOrders().ToList(); if (orders.Any()) { _logger.Debug("Processing " + orders.Count + " orders."); foreach (var order in orders) { var map = new OmsManhattanOrderMap { Company = order.Company, Created = DateTime.Now, OmsOrderNumber = order.ControlNumber, WmOrderNumber = order.OrderNumber }; _omsManhattanOrderMapRepository.InsertOmsManhattanOrderMapRepository(map); _orderHistoryRepository.Save(order.CreateHistories("Processing pickticket confirmation.", "Aurora Pick Confirmation Job")); SetAuroraPickTicketInformation(order); } DestinationRepository.SaveOrders(orders); var processed = orders.Select(s => new PickTicketConfirmationOrderProcessing { ControlNumber = s.ControlNumber, OrderNumber = s.OrderNumber, ProcessedDate = DateTime.Now }).ToList(); _pickTicketProcessingRepository.InsertPickTicketProcessing(processed); } else { _logger.Debug("No orders to run"); } }