public static void SaveProductModelMap(int varIllustrationID, int[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ProductModelIllustration WHERE IllustrationID=@IllustrationID", Illustration.Schema.Provider.Name); cmdDel.AddParameter("@IllustrationID", varIllustrationID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (int item in itemList) { ProductModelIllustration varProductModelIllustration = new ProductModelIllustration(); varProductModelIllustration.SetColumnValue("IllustrationID", varIllustrationID); varProductModelIllustration.SetColumnValue("ProductModelID", item); varProductModelIllustration.Save(); } }
public static void SaveIllustrationMap(int varProductModelID, System.Web.UI.WebControls.ListItemCollection itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ProductModelIllustration WHERE ProductModelID=@ProductModelID", ProductModel.Schema.Provider.Name); cmdDel.AddParameter("@ProductModelID", varProductModelID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (System.Web.UI.WebControls.ListItem l in itemList) { if (l.Selected) { ProductModelIllustration varProductModelIllustration = new ProductModelIllustration(); varProductModelIllustration.SetColumnValue("ProductModelID", varProductModelID); varProductModelIllustration.SetColumnValue("IllustrationID", l.Value); varProductModelIllustration.Save(); } } }