Beispiel #1
0
        public void CreateAccount(MailAccount mailbox)
        {
            Tree       users = AMSHelper.GetUsersConfig();
            AmsMailbox accnt = new AmsMailbox(mailbox.Name);

            if (accnt.Load(users))
            {
                throw new Exception("Mailbox is already registered.");
            }

            accnt.Read(mailbox);

            if (!accnt.Save(users))
            {
                throw new Exception("Couldn't create a mailbox.");
            }
        }
Beispiel #2
0
        public void CreateGroup(MailGroup group)
        {
            Tree       users    = AMSHelper.GetUsersConfig();
            AmsMailbox amsGroup = new AmsMailbox(group.Name);

            if (amsGroup.Load(users))
            {
                throw new Exception("Mail group is already exists.");
            }

            amsGroup.Read(group);

            if (!amsGroup.Save(users))
            {
                throw new Exception("Couldn't create a mail group.");
            }
        }
Beispiel #3
0
        public void UpdateGroup(MailGroup group)
        {
            Tree       config   = AMSHelper.GetUsersConfig();
            AmsMailbox amsGroup = new AmsMailbox(group.Name);

            if (amsGroup.Load(config))
            {
                amsGroup.LoadAccountConfig();
                amsGroup.Read(group);

                if (!amsGroup.Save(config))
                {
                    throw new Exception("Couldn't update specified mail group.");
                }
            }
            else
            {
                throw new Exception("Couldn't find specified mail group.");
            }
        }
Beispiel #4
0
        public void UpdateAccount(MailAccount mailbox)
        {
            Tree       config     = AMSHelper.GetUsersConfig();
            AmsMailbox amsMailbox = new AmsMailbox(mailbox.Name);

            if (amsMailbox.Load(config))
            {
                amsMailbox.LoadAccountConfig();
                amsMailbox.Read(mailbox);

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