public void ManualWhereAnd()
        {
            ProductQuery pq = new ProductQuery("p");
            pq.es2.Connection.Name = "ForeignKeyTest";

            esComparison comp = null;
            comp = pq.ManualWhere("Discontinued", "EQUAL", false, null, "AND");
            comp = pq.ManualWhere("UnitPrice", "BETWEEN", 0.15, 0.20, "AND");
            comp = pq.ManualWhere("ProductID", "GREATERTHAN", 2, null, "AND");
            pq.Where(comp);

            ProductCollection coll = new ProductCollection();
            coll.es.Connection.Name = "ForeignKeyTest";
            Assert.IsTrue(coll.Load(pq));
            Assert.AreEqual(1, coll.Count);
        }
        public void ManualWhereOr()
        {
            ProductQuery pq = new ProductQuery("p");
            pq.es2.Connection.Name = "ForeignKeyTest";

            List<int> inList = new List<int>();
            inList.Add(8);
            inList.Add(9);

            esComparison comp = null;
            comp = pq.ManualWhere("ProductName", "LIKE", "W%", null, "OR");
            comp = pq.ManualWhere("UnitPrice", "LESSTHAN", 10.0, null, "OR");
            comp = pq.ManualWhere("ProductID", "IN", inList, null, "OR");
            pq.Where(comp);

            ProductCollection coll = new ProductCollection();
            coll.es.Connection.Name = "ForeignKeyTest";
            Assert.IsTrue(coll.Load(pq));
            Assert.AreEqual(7, coll.Count);
        }
        public void MixedANDAndORInOn()
        {
            ProductCollection collection = new ProductCollection();
            collection.es.Connection.ConnectionString =
                UnitTestBase.GetFktString(collection.es.Connection);

            int empId = 1;

            ProductQuery prd = new ProductQuery("pq");
            OrderItemQuery item = new OrderItemQuery("oiq");
            OrderQuery ord = new OrderQuery("oq");
            CustomerQuery cust = new CustomerQuery("cq");
            EmployeeQuery emp = new EmployeeQuery("eq");

            prd.Select(prd.ProductID);
            prd.InnerJoin(item).On(prd.ProductID == item.ProductID);
            prd.InnerJoin(ord).On(item.OrderID == ord.OrderID);
            prd.InnerJoin(cust).On(ord.CustID == cust.CustomerID &
                (ord.CustSub == cust.CustomerSub |
                ord.EmployeeID == cust.StaffAssigned));
            prd.InnerJoin(emp).On(cust.Manager == emp.EmployeeID);
            prd.Where(emp.EmployeeID == empId);
            prd.Where(prd.Discontinued == false);
            prd.OrderBy(prd.ProductID.Ascending);

            Assert.IsTrue(collection.Load(prd));
            Assert.AreEqual(9, collection.Count);
        }