public static void SaveContactMap(int varCreditCardID, int[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ContactCreditCard WHERE CreditCardID=@CreditCardID", CreditCard.Schema.Provider.Name); cmdDel.AddParameter("@CreditCardID", varCreditCardID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (int item in itemList) { ContactCreditCard varContactCreditCard = new ContactCreditCard(); varContactCreditCard.SetColumnValue("CreditCardID", varCreditCardID); varContactCreditCard.SetColumnValue("ContactID", item); varContactCreditCard.Save(); } }
public static void SaveCreditCardMap(int varContactID, System.Web.UI.WebControls.ListItemCollection itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ContactCreditCard WHERE ContactID=@ContactID", Contact.Schema.Provider.Name); cmdDel.AddParameter("@ContactID", varContactID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (System.Web.UI.WebControls.ListItem l in itemList) { if (l.Selected) { ContactCreditCard varContactCreditCard = new ContactCreditCard(); varContactCreditCard.SetColumnValue("ContactID", varContactID); varContactCreditCard.SetColumnValue("CreditCardID", l.Value); varContactCreditCard.Save(); } } }