Esempio n. 1
0
        public static void SaveProductMap(int varAttributeId, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Store_Product_Attribute_Map WHERE AttributeId=@AttributeId", Attribute.Schema.Provider.Name);

            cmdDel.AddParameter("@AttributeId", varAttributeId);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                ProductAttributeMap varProductAttributeMap = new ProductAttributeMap();
                varProductAttributeMap.SetColumnValue("AttributeId", varAttributeId);
                varProductAttributeMap.SetColumnValue("ProductId", item);
                varProductAttributeMap.Save();
            }
        }
Esempio n. 2
0
        public static void SaveAttributeMap(int varProductId, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Store_Product_Attribute_Map WHERE ProductId=@ProductId", Product.Schema.Provider.Name);

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