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(); } }
public void Update(int ProductId, int CategoryId, string CreatedBy, DateTime CreatedOn, string ModifiedBy, DateTime ModifiedOn) { ProductCategoryMap item = new ProductCategoryMap(); item.ProductId = ProductId; item.CategoryId = CategoryId; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.MarkOld(); item.Save(UserName); }
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(); } } }
public bool Destroy(object ProductId) { return(ProductCategoryMap.Destroy(ProductId) == 1); }
public bool Delete(object ProductId) { return(ProductCategoryMap.Delete(ProductId) == 1); }