Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public Task<IQueryable<Order>> Handle(GetOrderQuery request, CancellationToken c
{
query = query.Where(o => o.Code == request.OrderCode.ToUpperInvariant());
}
if (!string.IsNullOrEmpty(request.OrderNumber) && int.TryParse(request.OrderNumber, out int orderNumber))
{
query = query.Where(o => o.OrderNumber == orderNumber);
}

//tag filtering
if (!string.IsNullOrEmpty(request.OrderTagId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public virtual Task<Order> GetOrderByGuid(Guid orderGuid)
/// <param name="pageIndex">Page index</param>
/// <param name="pageSize">Page size</param>
/// <param name="orderTagId">Order tag identifier</param>
/// <param name="orderNumber">Order number</param>
/// <returns>Orders</returns>
public virtual async Task<IPagedList<Order>> SearchOrders(string storeId = "",
string vendorId = "", string customerId = "",
Expand All @@ -160,10 +161,9 @@ public virtual async Task<IPagedList<Order>> SearchOrders(string storeId = "",
DateTime? createdFromUtc = null, DateTime? createdToUtc = null,
int? os = null, PaymentStatus? ps = null, ShippingStatus? ss = null,
string billingEmail = null, string billingLastName = "", string orderGuid = null,
string orderCode = null, int pageIndex = 0, int pageSize = int.MaxValue, string orderTagId = "")
string orderCode = null, int pageIndex = 0, int pageSize = int.MaxValue, string orderTagId = "", string orderNumber = "")
{
var queryModel = new GetOrderQuery
{
var queryModel = new GetOrderQuery {
AffiliateId = affiliateId,
BillingCountryId = billingCountryId,
BillingEmail = billingEmail,
Expand All @@ -185,7 +185,8 @@ public virtual async Task<IPagedList<Order>> SearchOrders(string storeId = "",
WarehouseId = warehouseId,
OrderTagId = orderTagId,
OwnerId = ownerId,
SalesEmployeeId = salesEmployeeId
SalesEmployeeId = salesEmployeeId,
OrderNumber = orderNumber
};
var query = await _mediator.Send(queryModel);
return await PagedList<Order>.Create(query, pageIndex, pageSize);
Expand Down Expand Up @@ -232,7 +233,7 @@ public async Task CancelExpiredOrders(DateTime expirationDateUtc)
{
var orders = _orderRepository.Table
.Where(o => o.CreatedOnUtc < expirationDateUtc && o.PaymentStatusId == PaymentStatus.Pending &&
o.OrderStatusId == (int)OrderStatusSystem.Pending && (o.ShippingStatusId == ShippingStatus.Pending
o.OrderStatusId == (int)OrderStatusSystem.Pending && (o.ShippingStatusId == ShippingStatus.Pending
|| o.ShippingStatusId == ShippingStatus.ShippingNotRequired))
.ToList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Task<IPagedList<Order>> SearchOrders(string storeId = "",
DateTime? createdFromUtc = null, DateTime? createdToUtc = null,
int? os = null, PaymentStatus? ps = null, ShippingStatus? ss = null,
string billingEmail = null, string billingLastName = "", string orderGuid = null,
string orderCode = null, int pageIndex = 0, int pageSize = int.MaxValue, string orderTagId = "");
string orderCode = null, int pageIndex = 0, int pageSize = int.MaxValue, string orderTagId = "",string orderNumber = "");

/// <summary>
/// Inserts an order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ public class GetOrderQuery : IRequest<IQueryable<Order>>
public int PageIndex { get; set; } = 0;
public int PageSize { get; set; } = int.MaxValue;
public string OrderTagId { get; set; } = "";
public string OrderNumber { get; set; } = "";
}
}