public static void SavePageMap(int varRegionId, int[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Content_Page_Region_Map WHERE RegionId=@RegionId", Region.Schema.Provider.Name); cmdDel.AddParameter("@RegionId", varRegionId); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (int item in itemList) { PageRegionMap varPageRegionMap = new PageRegionMap(); varPageRegionMap.SetColumnValue("RegionId", varRegionId); varPageRegionMap.SetColumnValue("PageId", item); varPageRegionMap.Save(); } }
public static void SaveRegionMap(int varPageId, System.Web.UI.WebControls.ListItemCollection itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Content_Page_Region_Map WHERE PageId=@PageId", Page.Schema.Provider.Name); cmdDel.AddParameter("@PageId", varPageId); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (System.Web.UI.WebControls.ListItem l in itemList) { if (l.Selected) { PageRegionMap varPageRegionMap = new PageRegionMap(); varPageRegionMap.SetColumnValue("PageId", varPageId); varPageRegionMap.SetColumnValue("RegionId", l.Value); varPageRegionMap.Save(); } } }