hMailServer.Administrator.ucDistributionList.SaveData C# (CSharp) Method

SaveData() public method

public SaveData ( ) : bool
return bool
        public bool SaveData()
        {
            bool newObject = false;
            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.DistributionLists lists = domain.DistributionLists;
                representedObject = lists.Add();
                newObject = true;

                Marshal.ReleaseComObject(lists);
                Marshal.ReleaseComObject(domain);
            }

            representedObject.Address = textAddress.Text;
            representedObject.Active = checkEnabled.Checked;

            if (radioModePublic.Checked)
                representedObject.Mode = eDistributionListMode.eLMPublic;

            if (radioModeMembership.Checked)
                representedObject.Mode = eDistributionListMode.eLMMembership;

            if (optModeAnnouncements.Checked)
                representedObject.Mode = eDistributionListMode.eLMAnnouncement;

            representedObject.RequireSenderAddress = textRequireAddress.Text;
            representedObject.RequireSMTPAuth = checkRequireSMTPAuthentication.Checked;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;
            mainForm.RefreshCurrentNode(textAddress.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Address);
                mainForm.SelectNode(crit);
            }

            EnableDisableTabs();

            return true;
        }