Dynamicweb 8 Documentation
GroupDeleting Class
Members  Example 

Helper class to properly delete group with access rights checks and from all places: pages, shops, other groups and products relations etc.
Syntax
'Declaration
 
Public Class GroupDeleting 
public class GroupDeleting 
Example
class MyPage : System.Web.UI.Page
{
   public bool Run(string ShopId)
   {
       Dynamicweb.eCommerce.Shops.Shop shop = new Dynamicweb.eCommerce.Shops.Shop(ShopId);
       if (!shop.get_Granted(Dynamicweb.eCommerce.UserPermissions.UserPermissionRights.Delete))
       {
           return false;
       }

       //Delete groups
       bool allGroupsDeleted = true;
       foreach (Dynamicweb.eCommerce.Products.Group @group in shop.Groups)
       {
           allGroupsDeleted = Dynamicweb.eCommerce.Products.GroupDeleting.Run(@group.ID) && allGroupsDeleted;
       }

       //Delete shop
       if (allGroupsDeleted)
       {
           shop.Delete();
           Dynamicweb.eCommerce.Common.Application.KillShops();
           return true;
       }
       else
       {
           return false;
       }
   }
}
Inheritance Hierarchy

System.Object
   Dynamicweb.eCommerce.Products.GroupDeleting

Requirements

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

See Also

Reference

GroupDeleting Members
Dynamicweb.eCommerce.Products Namespace

Send Feedback