/// <summary> /// Orders already in monitoring and/or putted on waiting status. /// </summary> /// <param name="pOrders">Orders already in monitoring.</param> /// <returns>Reloads the respective containers with orders on waiting status.</returns> public async Task ReloadAwaitingContainer(int[] pOrders) { var vOrders = await fOrder.GetListOrderDTO(order => order.Process == EOrderProcess.Awaiting); vOrders.ToList() .ForEach(order => { if ( (pOrders != null) && (pOrders.Length > 0) && pOrders.ToList().Exists(o => order.OrderId == o) ) { order.Command = EOrderCommand.None; } } ); await Clients.Caller.SendAsync($"{Utilities.LOAD_AWAITING_CONTAINER}", vOrders.OrderBy(o => o.AwaitingStart.Value).ToList()); await Clients.Others.SendAsync($"{Utilities.LOAD_AWAITING_CONTAINER_FOR_CUSTOMERS}", vOrders.OrderBy(o => o.AwaitingStart.Value).ToList()); }
public async Task <IActionResult> GetAll( EOrderProcess pProcess = EOrderProcess.None, [FromQuery] Pagination pPagination = null) { try { var vOrders = await fOrder.GetListOrderDTO( pWhereClause : order => (order.Process > 0 && (order.Process == pProcess || pProcess == EOrderProcess.None)), pInclude : itm => itm.Items, pPagination : pPagination ); if (vOrders == null || vOrders.Count() == 0 || (pPagination != null && (pPagination.CurrentPage > pPagination.TotalPages))) { return(NotFound(new { ErrorMessage = Resource.MSG_RECORDS_NOT_FOUND })); } if (pPagination != null) { Response.Headers.Add($"X-{nameof(Pagination)}", JsonConvert.SerializeObject(pPagination)); } return(Ok(vOrders)); } catch (CustomException ex) { return(StatusCode(ex.StatusCode, new { ErrorMessage = ex.Message })); } catch (Exception ex) { return (StatusCode ( StatusCodes.Status500InternalServerError, new { ErrorMessage = ex.Message } )); } }