public static void GetDomainOptions(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            List <string> cloudDomainNames = null;
            string        text             = inputRow["CloudDomains"] as string;

            if (text != null)
            {
                cloudDomainNames = (from cloudDomain in text.Split(new char[]
                {
                    ','
                })
                                    select cloudDomain.Trim()).ToList <string>();
            }
            IEnumerable <object> source     = store.GetDataObject("AcceptedDomain") as IEnumerable <object>;
            IEnumerable <object> enumerable = from domain in source
                                              where HybridConfigurationWizardServiceCodeBehind.IsSelectableDomain((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain, cloudDomainNames)
                                              select((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain).DomainName.SmtpDomain;
            int num = enumerable.Count <object>();

            if (num != 0)
            {
                inputRow["DomainOptions"] = (dataTable.Rows[0]["DomainOptions"] = enumerable);
            }
            if (num == 1)
            {
                store.SetModifiedColumns(new List <string>
                {
                    "Domains"
                });
                inputRow["Domains"] = (dataTable.Rows[0]["Domains"] = enumerable.First <object>().ToString());
            }
        }
        public static void FindValidCertExistingOnEveryServer(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow                   = dataTable.Rows[0];
            List <MailCertificate> list       = dataRow["MailCertificateOptions"] as List <MailCertificate>;
            IEnumerable <object>   enumerable = store.GetDataObject("ExchangeCertificates") as IEnumerable <object>;

            if (list == null)
            {
                list = (dataRow["MailCertificateOptions"] = new List <MailCertificate>());
                using (IEnumerator <object> enumerator = enumerable.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        object obj = enumerator.Current;
                        ExchangeCertificate exchangeCertificate = (ExchangeCertificate)obj;
                        if (HybridConfigurationWizardServiceCodeBehind.IsValidCertificate(exchangeCertificate))
                        {
                            list.Add(new MailCertificate
                            {
                                FriendlyName = exchangeCertificate.FriendlyName,
                                Thumbprint   = exchangeCertificate.Thumbprint,
                                Issuer       = exchangeCertificate.Issuer,
                                Subject      = exchangeCertificate.Subject
                            });
                        }
                    }
                    return;
                }
            }
            IEnumerable <string> source = from cert in enumerable
                                          where HybridConfigurationWizardServiceCodeBehind.IsValidCertificate((ExchangeCertificate)cert)
                                          select((ExchangeCertificate)cert).Thumbprint;

            for (int i = list.Count - 1; i >= 0; i--)
            {
                if (!source.Contains(list[i].Thumbprint))
                {
                    list.RemoveAt(i);
                }
            }
        }
        public static void AddCertificates(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            List <MailCertificate> list       = new List <MailCertificate>();
            IEnumerable <object>   enumerable = store.GetDataObject("ExchangeCertificates") as IEnumerable <object>;

            foreach (object obj in enumerable)
            {
                ExchangeCertificate exchangeCertificate = (ExchangeCertificate)obj;
                if (HybridConfigurationWizardServiceCodeBehind.IsValidCertificate(exchangeCertificate))
                {
                    list.Add(new MailCertificate
                    {
                        FriendlyName = exchangeCertificate.FriendlyName,
                        Thumbprint   = exchangeCertificate.Thumbprint,
                        Subject      = exchangeCertificate.Subject,
                        Issuer       = exchangeCertificate.Issuer
                    });
                }
            }
            DataRow dataRow = dataTable.NewRow();

            dataTable.Rows.Add(dataRow);
            dataRow["MailCertificateOptions"] = list;
        }