Пример #1
0
        public CategoryCollection FetchByQuery(Query qry)
        {
            CategoryCollection coll = new CategoryCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Пример #2
0
        /// <summary>
        /// Fetches the associated categories by product id.
        /// </summary>
        /// <param name="productId">The product id.</param>
        /// <returns></returns>
        public CategoryCollection FetchAssociatedCategoriesByProductId(int productId)
        {
            IDataReader        reader             = SPs.FetchAssociatedCategoriesByProductId(productId).GetReader();
            CategoryCollection categoryCollection = new CategoryCollection();

            categoryCollection.LoadAndCloseReader(reader);
            return(categoryCollection);
        }
Пример #3
0
        public CategoryCollection FetchAll()
        {
            CategoryCollection coll = new CategoryCollection();
            Query qry = new Query(Category.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Пример #4
0
        public static MettleSystems.dashCommerce.Store.CategoryCollection GetCategoryCollection(int varProductId)
        {
            SubSonic.QueryCommand cmd = new SubSonic.QueryCommand(
                "SELECT * FROM dashCommerce_Store_Category INNER JOIN dashCommerce_Store_Product_Category_Map ON " +
                "dashCommerce_Store_Category.CategoryId=dashCommerce_Store_Product_Category_Map.CategoryId WHERE dashCommerce_Store_Product_Category_Map.ProductId=@ProductId", Product.Schema.Provider.Name);

            cmd.AddParameter("@ProductId", varProductId, DbType.Int32);
            IDataReader        rdr  = SubSonic.DataService.GetReader(cmd);
            CategoryCollection coll = new CategoryCollection();

            coll.LoadAndCloseReader(rdr);
            return(coll);
        }
Пример #5
0
        public static void SaveCategoryMap(int varProductId, CategoryCollection items)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Store_Product_Category_Map WHERE ProductId=@ProductId", Product.Schema.Provider.Name);

            cmdDel.AddParameter("@ProductId", varProductId);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (Category item in items)
            {
                ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
                varProductCategoryMap.SetColumnValue("ProductId", varProductId);
                varProductCategoryMap.SetColumnValue("CategoryId", item.GetPrimaryKeyValue());
                varProductCategoryMap.Save();
            }
        }
Пример #6
0
        public CategoryCollection FetchByID(object CategoryId)
        {
            CategoryCollection coll = new CategoryCollection().Where("CategoryId", CategoryId).Load();

            return(coll);
        }