public void SetDomainFlag(string domainFqdn, GlsDomainFlags flag, bool value)
        {
            string address = MServDirectorySession.EntryIdForGlsDomainFlag(domainFqdn, flag);

            MServDirectorySession.RemoveMserveEntry(address, value ? 0 : 1);
            MServDirectorySession.AddMserveEntry(address, value ? 1 : 0);
        }
 private static void CleanupLegacyEntries(Guid externalDirectoryOrganizationId, string domainFqdn, int partnerId)
 {
     Tuple <string, int>[] array = new Tuple <string, int>[]
     {
         new Tuple <string, int>(string.Format("7f66cd009b304aeda37ffdeea1733ff6@{0}", domainFqdn), partnerId),
         new Tuple <string, int>(string.Format("3da19c7b44a74bd3896daaf008594b6c@{0}.exchangereserved", externalDirectoryOrganizationId.ToString()), partnerId)
     };
     foreach (Tuple <string, int> tuple in array)
     {
         MServDirectorySession.RemoveMserveEntry(tuple.Item1, tuple.Item2);
     }
 }
        public void RemoveTenant(Guid externalDirectoryOrganizationId)
        {
            int partnerId = this.GetLocalSite().PartnerId;

            string[] array = new string[]
            {
                string.Format("43BA6209CC0F4542958F65F8BF1CDED6@{0}.exchangereserved", externalDirectoryOrganizationId.ToString())
            };
            foreach (string address in array)
            {
                MServDirectorySession.RemoveMserveEntry(address, partnerId);
            }
        }
        public void RemoveAcceptedDomain(Guid externalDirectoryOrganizationId, string domainFqdn)
        {
            int partnerId = this.GetLocalSite().PartnerId;

            Tuple <string, int>[] array = new Tuple <string, int>[]
            {
                new Tuple <string, int>(string.Format("21668DE042684883B19BCB376E3BE474@{0}", domainFqdn), partnerId),
                new Tuple <string, int>(string.Format("ade5142cfe3d4ff19fed54a7f6087a98@{0}", domainFqdn), 0),
                new Tuple <string, int>(string.Format("0f01471e875a455a80c59def2a36ee3f@{0}", domainFqdn), 0),
                new Tuple <string, int>(string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", domainFqdn), partnerId)
            };
            foreach (Tuple <string, int> tuple in array)
            {
                MServDirectorySession.RemoveMserveEntry(tuple.Item1, tuple.Item2);
            }
        }
        private int UpdateMservEntry(Guid externalDirectoryOrganizationId, bool allowOverwrite, string mservEntryKey)
        {
            int partnerId = this.GetLocalSite().PartnerId;
            int num       = MServDirectorySession.ReadMservEntry(mservEntryKey);

            if (num == -1)
            {
                MServDirectorySession.AddMserveEntry(mservEntryKey, partnerId);
            }
            else if (num != partnerId)
            {
                if (!allowOverwrite)
                {
                    throw new MServPermanentException(DirectoryStrings.TenantAlreadyExistsInMserv(externalDirectoryOrganizationId, num, partnerId));
                }
                MServDirectorySession.RemoveMserveEntry(mservEntryKey, num);
                MServDirectorySession.AddMserveEntry(mservEntryKey, partnerId);
            }
            return(num);
        }