Beispiel #1
0
        private bool LoadByPrimaryKeyDynamic(System.Int32 productID)
        {
            ProductsQuery query = new ProductsQuery();

            query.Where(query.ProductID == productID);
            return(this.Load(query));
        }
    protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e)
    {
        ProductsQuery p = new ProductsQuery("p");
        CategoriesQuery c = new CategoriesQuery("c");

        p.Select(p, c.CategoryName);
        p.InnerJoin(c).On(p.CategoryID == c.CategoryID);

        if (e.PrimaryKeys != null)
        {
            p.Where(p.ProductID == (int)e.PrimaryKeys[0]);
        }
        else
        {
            // They want to add a new one, lets do a select that brings back
            // no records so that our CategoryName column (virutal) will be
            // present in the underlying record format
            p.Where(1 == 0);
        }

        Products prd = new Products();
        prd.Load(p);  // load the data (if any)

        // Assign the Entity
        e.Entity = prd;
    }
Beispiel #3
0
        protected void InitQuery(ProductsQuery query)
        {
            query.OnLoadDelegate = this.OnQueryLoaded;

            if (!query.es2.HasConnection)
            {
                query.es2.Connection = ((IEntityCollection)this).Connection;
            }
        }
        public ProductsCollection Products_LoadWithExtraColumn()
        {
            ProductsQuery p = new ProductsQuery("p");
            SuppliersQuery s = new SuppliersQuery("s");

            // Bring back the suppliers name for the Product from the Supplier table
            p.Select(p, s.CompanyName.As("SupplierName"));
            p.InnerJoin(s).On(p.SupplierID == s.SupplierID);

            ProductsCollection coll = new ProductsCollection();
            coll.Load(p);

            return coll;
        }
    protected void EsDataSource1_esSelect(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e)
    {
        ProductsQuery p = new ProductsQuery("P");
        CategoriesQuery c = new CategoriesQuery("c");

        // All columns from our products table and the CategoryName from the Category table, we really do not
        // display all of the product fields so I could have selected individual fields out of the products
        // table
        p.Select(p, c.CategoryName);
        p.InnerJoin(c).On(p.CategoryID == c.CategoryID);

        // We supply the Collection and the Query, because we're letting the grid to auto paging and
        // auto sorting. Otherwise, we could just load the collection ourselves and only supply the
        // collection
        e.Collection = new ProductsCollection();
        e.Query = p;
    }
Beispiel #6
0
 public bool Load(ProductsQuery query)
 {
     this.query = query;
     InitQuery(this.query);
     return(Query.Load());
 }
Beispiel #7
0
 public ProductsQuery(string joinAlias, out ProductsQuery query)
 {
     query             = this;
     this.es.JoinAlias = joinAlias;
 }