public static Query CreateRetrieveOrdersUsingAComplexQuery(Guid CustomerId) { IList<Criterion> criteria = new List<Criterion>(); criteria.Add(new Criterion("CustomerId", CustomerId, CriteriaOperator.NotApplicable)); Query query = new Query(QueryName.RetrieveOrdersUsingAComplexQuery, criteria); return query; }
public IEnumerable<Order> FindAllCustomersOrderBy(Guid customerId) { IEnumerable<Order> cusomterOrders = new List<Order>(); Query query = new Query(); query.Add(new Criterion(fieldName_CustomerId, customerId, CriteriaOperator.Equal)); query.OrderByProperty = new OrderByClause(){ PropertyName = fieldName_CustomerId, Desc = true }; cusomterOrders = _orderRepository.FindBy(query); return cusomterOrders; }
public IEnumerable<Order> FindAllCustomerOrdersWithInOrderDateBy(Guid customerId, DateTime orderDate) { IEnumerable<Order> customerOrders = new List<Order>(); Query query = new Query(); query.Add(new Criterion(fieldName_CustomerId, orderDate, CriteriaOperator.Equal)); query.QueryOperator = QueryOperator.And; query.Add(new Criterion(fieldName_OrderDate, orderDate, CriteriaOperator.LessThanOrEqual)); query.OrderByProperty = new OrderByClause() { PropertyName = fieldName_OrderDate, Desc = true }; customerOrders = _orderRepository.FindBy(query); return customerOrders; }
private static string GetQueryOperator(Query query) { if (query.QueryOperator == QueryOperator.And) { return "AND"; } else { return "OR"; } }