public CustomerDeleteResult Delete(RhspDataID dataID)
        {
            CustomerDeleteResult r = new CustomerDeleteResult();

            // Get the customer to delete physical objects.
            Customer customer = Get(dataID);

            // Delete websites belonging to customer.
            WebsiteManager wm = CreateManager <WebsiteManager>();

            wm.GetByCustomer(dataID).ToList().ForEach(
                w => r.Errors.AddRange(wm.Delete(w.DataID).Errors));

            // Make client directory obsolete after websites are made obsolete.
            MakeDirectoryObsoleteResult mdor = TryMakeDirectoryObsolete(getDirectory(customer));

            if (mdor.Error != null)
            {
                r.Errors.Add(mdor.Error.Message);
            }

            // Delete ftp users, group, and security.
            deleteFtpObjects(customer);

            // Finally delete the actual customer configuration.
            Context.HostingConfig.Delete <Customer>(dataID);

            return(r);
        }
        protected MakeDirectoryObsoleteResult TryMakeDirectoryObsolete(DirectoryInfo directory)
        {
            MakeDirectoryObsoleteResult r = new MakeDirectoryObsoleteResult();

            try
            {
                MakeDirectoryObsolete(directory);
            }
            catch (Exception ex)
            {
                r.Error = ex;
            }
            return(r);
        }
Beispiel #3
0
        private DeleteHostingResult deleteHosting(CleanWebsite website)
        {
            DeleteHostingResult r = new DeleteHostingResult();

            deleteIisObjects(website);
            clearFileZillaSecurity(getWebsiteDirectory(website));
            tryRemoveIisIdentity(website);
            removeWebsiteSecurity(website);

            MakeDirectoryObsoleteResult mdor = TryMakeDirectoryObsolete(getWebsiteDirectory(website));

            if (mdor.Error != null)
            {
                r.Errors.Add(mdor.Error);
            }

            return(r);
        }