public void Update(int CategoryID, int ProductID) { ProductCategoryMap item = new ProductCategoryMap(); item.CategoryID = CategoryID; item.ProductID = ProductID; item.MarkOld(); item.Save(UserName); }
public void Insert(int CategoryID, int ProductID) { ProductCategoryMap item = new ProductCategoryMap(); item.CategoryID = CategoryID; item.ProductID = ProductID; item.Save(UserName); }
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 CategoryID=@CategoryID", Category.Schema.Provider.Name); cmdDel.AddParameter("@CategoryID", varCategoryID); //add this in 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(); } }
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 ProductID=@ProductID", Product.Schema.Provider.Name); cmdDel.AddParameter("@ProductID", varProductID); //add this in 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(); } } }