예제 #1
0
        public static void SaveCategoryMap(int varProductId, int[] itemList)
        {
            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 (int item in itemList)
            {
                ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
                varProductCategoryMap.SetColumnValue("ProductId", varProductId);
                varProductCategoryMap.SetColumnValue("CategoryId", item);
                varProductCategoryMap.Save();
            }
        }
예제 #2
0
        public static void SaveProductMap(int varCategoryId, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Store_Product_Category_Map WHERE CategoryId=@CategoryId", Category.Schema.Provider.Name);

            cmdDel.AddParameter("@CategoryId", varCategoryId);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
                    varProductCategoryMap.SetColumnValue("CategoryId", varCategoryId);
                    varProductCategoryMap.SetColumnValue("ProductId", l.Value);
                    varProductCategoryMap.Save();
                }
            }
        }