Exemple #1
0
        public void CreateDomain(MailDomain domain)
        {
            Tree      domains   = AMSHelper.GetDomainsConfig();
            AmsDomain amsDomain = new AmsDomain(domain.Name);

            if (amsDomain.Load(domains))
            {
                throw new Exception("Domain is already registered.");
            }

            amsDomain.Read(domain);

            if (!amsDomain.Save(domains))
            {
                throw new Exception("Couldn't create a domain.");
            }
        }
Exemple #2
0
        public void UpdateDomain(MailDomain domain)
        {
            Tree      config    = AMSHelper.GetDomainsConfig();
            AmsDomain amsDomain = new AmsDomain(domain.Name);

            if (amsDomain.Load(config))
            {
                amsDomain.Read(domain);

                if (!amsDomain.Save(config))
                {
                    throw new Exception("Couldn't update specified domain.");
                }
            }
            else
            {
                throw new Exception("Couldn't find specified domain.");
            }
        }