protected MSERVEntry ProcessExternalOrgIdParameter(int partnerId, int minorPartnerId, Func <string, int, int> invoke)
        {
            MSERVEntry mserventry = new MSERVEntry();
            Guid       guid       = (Guid)base.Fields["ExternalDirectoryOrganizationId"];

            mserventry.ExternalDirectoryOrganizationId = guid;
            if (partnerId > -1)
            {
                string text = string.Format("43BA6209CC0F4542958F65F8BF1CDED6@{0}.exchangereserved", guid);
                mserventry.AddressForPartnerId = text;
                mserventry.PartnerId           = invoke(text, partnerId);
                MServDirectorySession mservDirectorySession = new MServDirectorySession(null);
                string forest;
                if (mservDirectorySession.TryGetForestFqdnFromPartnerId(mserventry.PartnerId, out forest))
                {
                    mserventry.Forest = forest;
                }
            }
            if (minorPartnerId > -1)
            {
                string text = string.Format("3da19c7b44a74bd3896daaf008594b6c@{0}.exchangereserved", guid);
                mserventry.AddressForMinorPartnerId = text;
                mserventry.MinorPartnerId           = invoke(text, minorPartnerId);
            }
            return(mserventry);
        }
        protected MSERVEntry ProcessDomainNameParameter(int partnerId, int minorPartnerId, Func <string, int, int> invoke)
        {
            MSERVEntry mserventry = new MSERVEntry();
            string     domain     = ((SmtpDomain)base.Fields["DomainName"]).Domain;

            mserventry.DomainName = domain;
            if (partnerId > -1)
            {
                string text = string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", domain);
                mserventry.AddressForPartnerId = text;
                mserventry.PartnerId           = invoke(text, partnerId);
                MServDirectorySession mservDirectorySession = new MServDirectorySession(null);
                string forest;
                if (mservDirectorySession.TryGetForestFqdnFromPartnerId(mserventry.PartnerId, out forest))
                {
                    mserventry.Forest = forest;
                }
            }
            if (minorPartnerId > -1)
            {
                string text = string.Format("7f66cd009b304aeda37ffdeea1733ff6@{0}", domain);
                mserventry.AddressForMinorPartnerId = text;
                mserventry.MinorPartnerId           = invoke(text, minorPartnerId);
            }
            return(mserventry);
        }
예제 #3
0
        protected override void InternalProcessRecord()
        {
            MSERVEntry sendToPipeline = new MSERVEntry();

            if (base.Fields.IsModified("ExternalDirectoryOrganizationId"))
            {
                sendToPipeline = base.ProcessExternalOrgIdParameter(this.partnerId, this.minorPartnerId, (string address, int id) => base.AddMservEntry(address, id));
            }
            else if (base.Fields.IsModified("DomainName"))
            {
                sendToPipeline = base.ProcessDomainNameParameter(this.partnerId, this.minorPartnerId, (string address, int id) => base.AddMservEntry(address, id));
            }
            else
            {
                sendToPipeline = base.ProcessAddressParameter((this.partnerId != -1) ? this.partnerId : this.minorPartnerId, (string address, int id) => base.AddMservEntry(address, id));
            }
            base.WriteObject(sendToPipeline);
        }
        protected MSERVEntry ProcessAddressParameter(int id, Func <string, int, int> invoke)
        {
            MSERVEntry mserventry = new MSERVEntry();
            string     text       = (string)base.Fields["Address"];

            if (this.ShouldProcessPartnerId(text))
            {
                mserventry.AddressForPartnerId = text;
                mserventry.PartnerId           = invoke(text, id);
                MServDirectorySession mservDirectorySession = new MServDirectorySession(null);
                string forest;
                if (mservDirectorySession.TryGetForestFqdnFromPartnerId(mserventry.PartnerId, out forest))
                {
                    mserventry.Forest = forest;
                }
            }
            else
            {
                mserventry.AddressForMinorPartnerId = text;
                mserventry.MinorPartnerId           = invoke(text, id);
            }
            return(mserventry);
        }