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); }
public static void SaveCategoryMap(int varProductID, int[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM [Product_Category_Map] WHERE [Product_Category_Map].[ProductID] = PARM__ProductID", Product.Schema.Provider.Name); cmdDel.AddParameter("PARM__ProductID", varProductID, DbType.Int32); 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(); } }
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 [Product_Category_Map] WHERE [Product_Category_Map].[CategoryID] = PARM__CategoryID", Category.Schema.Provider.Name); cmdDel.AddParameter("PARM__CategoryID", varCategoryID, 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("CategoryID", varCategoryID); varProductCategoryMap.SetColumnValue("ProductID", l.Value); varProductCategoryMap.Save(); } } }