コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: OrderService.cs プロジェクト: NDChen/MyDemoCode
        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;
        }
コード例 #3
0
ファイル: OrderService.cs プロジェクト: NDChen/MyDemoCode
        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;
        }
コード例 #4
0
 private static string GetQueryOperator(Query query)
 {
     if (query.QueryOperator == QueryOperator.And)
     {
         return "AND";
     }
     else
     {
         return "OR";
     }
 }