Dynamicweb.eCommerce.Products Namespace > Product Class : GetSqlConditionPartForIDs Method |
class MyPage : System.Web.UI.Page { public string DeleteAll(GroupCollection groups, bool run) { string grps = Group.WhereClauseBuilder(groups); System.Text.StringBuilder SQL = new System.Text.StringBuilder(); //01) Delete group releations SQL.Append("DELETE FROM EcomGroupRelations WHERE GroupRelationsGroupID " + Product.GetSqlConditionPartForIDs(grps) + "; "); //02) Delete group to shop releations SQL.Append("DELETE FROM EcomShopGroupRelation WHERE ShopGroupGroupID " + Product.GetSqlConditionPartForIDs(grps) + "; "); //03) Delete the items (BOM) groups from products SQL.Append("DELETE FROM EcomProductItems WHERE ProductItemBomGroupID " + Product.GetSqlConditionPartForIDs(grps) + "; "); //04) Delete the groups SQL.Append("DELETE FROM EcomGroups WHERE GroupID " + Product.GetSqlConditionPartForIDs(grps) + "; "); if (run) { Database.ExecuteNonQuery(SQL.ToString(), "Ecom.mdb"); // Sending out notifications Dynamicweb.Extensibility.NotificationManager.Notify(Dynamicweb.Notifications.eCommerce.Group.Deleted, new Dynamicweb.Notifications.eCommerce.Group.GroupModifiedEventArgs(groups)); } return SQL.ToString(); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2