private void textBoxUserName_LostFocus(object sender, EventArgs e)
        {
            try
            {
                String fullUserName = String.Empty;
                try
                {
                    DnsHelper.CheckAndGetFullUserName(this.textBoxUserName.Text, out fullUserName);
                    fullUserName = this.textBoxUserName.Text;
                }
                catch
                {
                    // Ignore the exception
                }

                string[] nameSplits = fullUserName.Split(SetupConstants.AccountDomainUserSeparator);
                if (nameSplits.Length == 1)
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, String.Empty);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, nameSplits[0]);
                }
                else if (nameSplits.Length == 2)
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, nameSplits[0]);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, nameSplits[1]);
                }
                else
                {
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminDomainTag, String.Empty);
                    SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDBAdminNameTag, String.Empty);
                }
            }
            catch (Exception backEndErrorException)
            {
                SetupLogger.LogException(backEndErrorException);
                SetupHelpers.ShowError(backEndErrorException.Message);
            }

            this.SetNextButtonState();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Validates the page.
        /// The default implementation always returns true for 'validated'.
        /// </summary>
        /// <returns>true if valid</returns>
        public override bool ValidatePage()
        {
            bool isPageValid = true;

            try
            {
                if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server))
                {
                    if (this.radioDomainAccount.IsChecked.GetValueOrDefault(false))
                    {
                        String fullUserName;

                        try
                        {
                            DnsHelper.CheckAndGetFullUserName(this.textBoxUserName.Text, out fullUserName);
                            fullUserName = this.textBoxUserName.Text;
                        }
                        catch
                        {
                            // Ignore failures
                            fullUserName = String.Empty;
                        }

                        string[] nameSplits = fullUserName.Split(SetupConstants.AccountDomainUserSeparator);
                        if (nameSplits.Length == 1)
                        {
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceDomainTag, String.Empty);
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceUserNameTag, nameSplits[0]);
                        }
                        else if (nameSplits.Length == 2)
                        {
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceDomainTag, nameSplits[0]);
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceUserNameTag, nameSplits[1]);
                        }
                        else
                        {
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceDomainTag, String.Empty);
                            SetupInputs.Instance.EditItem(SetupInputTags.CmpServiceUserNameTag, String.Empty);
                        }
                        SetupInputs.Instance.EditItem(
                            SetupInputTags.CmpServiceUserPasswordTag,
                            this.passwordBoxPassword.SecurePassword);

                        if (!this.TestCredential())
                        {
                            throw new Exception("Invalid service account");
                        }
                    }
                }

                // Only the certificate is selected for both server and extensions
                this.selectedCertificate = SetupInputs.Instance.FindItem(SetupInputTags.CmpCertificateThumbprintTag);
                this.certificateSelectionCombobox.Text = selectedCertificate;
            }
            catch (Exception backEndErrorException)
            {
                SetupLogger.LogException(backEndErrorException);
                SetupHelpers.ShowError(backEndErrorException.Message);

                isPageValid = false;
            }

            return(isPageValid);
        }