Ejemplo n.º 1
0
        public bool Delete(Tree config)
        {
            if (config.ChildNodes.Contains(userConfig))
            {
                config.ChildNodes.Remove(userConfig);
            }

            return(AMSHelper.RemoveAccount(mailboxName) &&
                   AMSHelper.SetUsersConfig(config));
        }
Ejemplo n.º 2
0
        public bool Save(Tree config)
        {
            if (!config.ChildNodes.Contains(userConfig))
            {
                userConfig["dir"] = Path.Combine(AMSHelper.AMSLocation, string.Format(@"{0}\{1}\", GetDomainName(mailboxName), GetAccountName(mailboxName)));
                config.ChildNodes.Add(userConfig);
            }

            return(AMSHelper.SetUsersConfig(config) &&
                   AMSHelper.SetAccountConfig(accountConfig, mailboxName) &&
                   AMSHelper.SetAccountDelivery(deliveryConfig, mailboxName));
        }
Ejemplo n.º 3
0
        public bool Delete(Tree config)
        {
            if (config.ChildNodes.Contains(domainConfig))
            {
                config.ChildNodes.Remove(domainConfig);
            }

            Tree            usersConfig   = AMSHelper.GetUsersConfig();
            List <TreeNode> nodesToDelete = new List <TreeNode>();

            foreach (TreeNode node in usersConfig.ChildNodes)
            {
                if (string.Compare(node["domain"], domainName, true) == 0)
                {
                    nodesToDelete.Add(node);
                }
            }

            while (nodesToDelete.Count > 0)
            {
                usersConfig.ChildNodes.Remove(nodesToDelete[0]);
                nodesToDelete.RemoveAt(0);
            }

            Tree listsConfig = AMSHelper.GetMailListsConfig();

            foreach (TreeNode node in listsConfig.ChildNodes)
            {
                if (string.Compare(node["domain"], domainName, true) == 0)
                {
                    nodesToDelete.Add(node);
                }
            }

            while (nodesToDelete.Count > 0)
            {
                listsConfig.ChildNodes.Remove(nodesToDelete[0]);
                nodesToDelete.RemoveAt(0);
            }

            return(AMSHelper.RemoveDomain(domainName) &&
                   AMSHelper.SetUsersConfig(usersConfig) &&
                   AMSHelper.SetMailListsConfig(listsConfig) &&
                   AMSHelper.SetDomainsConfig(config));
        }