private void Init(IReadOnlyCollection <Order> todayOrdersMap) { TimeSpan mapStartTime = DateTimeHelper.RoundTo(_timeMapConfig.WorkingDayStart, Convert.ToInt32(_timeMapConfig.TraySize.TotalMinutes)); var trayList = new List <TimeMapTray>(); for (TimeSpan i = _timeMapConfig.WorkingDayStart; i < _timeMapConfig.WorkingDayEnd; i += _timeMapConfig.TraySize) { var trayOrers = todayOrdersMap.Where(t => t.TargetStartDate.TimeOfDay >= i && t.TargetEndDate.TimeOfDay <= i.Add(_timeMapConfig.TraySize)).ToList <Order>(); TimeMapTray trayItem = new TimeMapTray(i, i.Add(_timeMapConfig.TraySize), GetTrayCapcityByRules(i, (i + _timeMapConfig.TraySize)), _timeMapConfig.OrderLifeTime, trayOrers); trayList.Add(trayItem); } _timeMapTrays = new ReadOnlyCollection <TimeMapTray>(trayList); CreationDate = DateTimeHelper.GetCurrentApplicationDateTimeValue(); }
public void UnregisterCreatedOrder(Order order) { TimeMapTray targetTray = GetTimeMapTray(order.TargetStartDate.TimeOfDay, order.TargetEndDate.TimeOfDay); targetTray.InvalidateOrderItem(order.OrderIdentifier); }
public void UpdateOrderStatus(Order order) { TimeMapTray targetTray = GetTimeMapTray(order.TargetStartDate.TimeOfDay, order.TargetEndDate.TimeOfDay); targetTray.UpdateOrderItemStatus(order.OrderIdentifier, order.OrderStatus); }
public void RegisterCreatedOrder(Order order) { TimeMapTray targetTray = GetTimeMapTray(order.TargetStartDate.TimeOfDay, order.TargetEndDate.TimeOfDay); targetTray.AddOrderItem(order.OrderIdentifier, order.GetOrderExpirationDate(_timeMapConfig.OrderLifeTime), order.OrderStatus); }