public void Insert(int CategoryID, int ProductID)
        {
            ProductCategoryMap item = new ProductCategoryMap();

            item.CategoryID = CategoryID;

            item.ProductID = ProductID;


            item.Save(UserName);
        }
        public void Update(int CategoryID, int ProductID)
        {
            ProductCategoryMap item = new ProductCategoryMap();

            item.MarkOld();
            item.IsLoaded = true;

            item.CategoryID = CategoryID;

            item.ProductID = ProductID;

            item.Save(UserName);
        }
Example #3
0
        public static void SaveProductMap(int varCategoryID, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [Product_Category_Map] WHERE [Product_Category_Map].[CategoryID] = @CategoryID", Category.Schema.Provider.Name);

            cmdDel.AddParameter("@CategoryID", varCategoryID, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
                varProductCategoryMap.SetColumnValue("CategoryID", varCategoryID);
                varProductCategoryMap.SetColumnValue("ProductID", item);
                varProductCategoryMap.Save();
            }
        }
Example #4
0
        public static void SaveCategoryMap(int varProductID, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [Product_Category_Map] WHERE [Product_Category_Map].[ProductID] = @ProductID", Product.Schema.Provider.Name);

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