public static string From(MOrder_OrderStatus value) { return(value switch { MOrder_OrderStatus.Pending => OrderStatusCodes.Pending, MOrder_OrderStatus.Submitted => OrderStatusCodes.Submitted, MOrder_OrderStatus.Fulfilling => OrderStatusCodes.Fulfilling, MOrder_OrderStatus.Closed => OrderStatusCodes.Closed, _ => throw new ArgumentException($"Unknown value {value}."), });
public string CreatePagingStateFilter(string orderNumber, DateTime?orderDate, MOrder_OrderStatus orderStatus, string userName, int recordCount) { return($"{orderNumber}|{orderDate}|{orderStatus}|{userName}|{recordCount}"); }
public async Task <IReadOnlyList <AOrder_OrderSummary> > GetOrderSummariesAsync(string orderNumber, DateTime?orderDateUtc, MOrder_OrderStatus orderStatus, string userName, int?recordCount) { using var log = BeginFunction(nameof(OrderAdminService), nameof(GetOrderSummariesAsync), orderNumber, orderDateUtc, orderStatus, userName, recordCount); try { await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false); long?ordererId; if (!string.IsNullOrEmpty(userName)) { var userId = await UserMicroService.LookupUserIdAsync(userName).ConfigureAwait(false); if (!string.IsNullOrEmpty(userId)) { var ordererReference = CreateOrdererReference.FromUserId(userId); ordererId = await OrderMicroService.LookupOrdererAsync(ordererReference); } else { ordererId = null; } } else { ordererId = null; } var mOrderSummaryList = await OrderMicroService.GetOrderSummariesAsync(orderNumber, orderDateUtc, orderStatus, ordererId, recordCount).ConfigureAwait(false); var orderSummaries = new List <AOrder_OrderSummary>(); foreach (var mOrderSummary in mOrderSummaryList.Summaries) { orderSummaries.Add(new AOrder_OrderSummary() { OrderId = mOrderSummary.OrderId, OrderNumber = mOrderSummary.OrderNumber, OrderDateTimeUtc = mOrderSummary.OrderDateTimeUtc, StatusDateTimeUtc = mOrderSummary.UpdateDateTimeUtc, OrderStatusType = mOrderSummary.OrderStatus.ToString(), Total = mOrderSummary.TotalAmount, UserId = "", UserName = "" }); } var result = orderSummaries; log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }