/// <summary> /// The wizard_ next button click. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.Web.UI.WebControls.WizardNavigationEventArgs"/> instance containing the event data. /// </param> protected void Wizard_NextButtonClick([NotNull] object sender, [NotNull] WizardNavigationEventArgs e) { e.Cancel = true; switch (this.CurrentWizardStepID) { case "WizValidatePermission": e.Cancel = false; break; case "WizDatabaseConnection": // save the database settings... UpdateDBFailureType type = this.UpdateDatabaseConnection(); e.Cancel = false; switch (type) { case UpdateDBFailureType.None: this.CurrentWizardStepID = "WizTestSettings"; break; case UpdateDBFailureType.AppSettingsWrite: this.NoWriteAppSettingsHolder.Visible = true; break; case UpdateDBFailureType.ConnectionStringWrite: this.NoWriteDBSettingsHolder.Visible = true; this.lblDBConnStringName.Text = Config.ConnectionStringName; this.lblDBConnStringValue.Text = this.CurrentConnString; break; } break; case "WizManualDatabaseConnection": e.Cancel = false; break; case "WizCreatePassword": if (this.txtCreatePassword1.Text.Trim() == string.Empty) { this.ShowErrorMessage("Please enter a configuration password."); break; } if (this.txtCreatePassword2.Text != this.txtCreatePassword1.Text) { this.ShowErrorMessage("Verification is not the same as your password."); break; } e.Cancel = false; this.CurrentWizardStepID = this._config.WriteAppSetting(_AppPasswordKey, this.txtCreatePassword1.Text) ? "WizDatabaseConnection" : "WizManuallySetPassword"; break; case "WizManuallySetPassword": if (this.IsConfigPasswordSet) { e.Cancel = false; } else { this.ShowErrorMessage( "You must update your appSettings with the YAF.ConfigPassword Key to continue. NOTE: The key name is case sensitive."); } break; case "WizTestSettings": e.Cancel = false; break; case "WizEnterPassword": if (this._config.GetConfigValueAsString(_AppPasswordKey) == FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtEnteredPassword.Text, "md5") || this._config.GetConfigValueAsString(_AppPasswordKey) == this.txtEnteredPassword.Text.Trim()) { e.Cancel = false; // move to upgrade.. this.CurrentWizardStepID = this.IsForumInstalled ? "WizWelcomeUpgrade" : "WizDatabaseConnection"; var dbVersionName = LegacyDb.GetDBVersionName(); var dbVersion = LegacyDb.GetDBVersion(); this.CurrentVersionName.Text = dbVersion < 0 ? "New" : "{0} ({1})".FormatWith(dbVersionName, dbVersion); this.UpgradeVersionName.Text = "{0} ({1})".FormatWith(YafForumInfo.AppVersionName, YafForumInfo.AppVersion); } else { this.ShowErrorMessage("You entered the <strong>wrong password</strong>!"); } break; case "WizCreateForum": if (this.CreateForum()) { e.Cancel = false; } break; case "WizInitDatabase": if (this.InstallUpgradeService.UpgradeDatabase( this.FullTextSupport.Checked, this.UpgradeExtensions.Checked)) { e.Cancel = false; } var messages = this.InstallUpgradeService.Messages; if (messages.Any()) { this._loadMessage += messages.ToDelimitedString("\r\n"); } this.ShowErrorMessage(this._loadMessage); break; case "WizMigrateUsers": // migrate users/roles only if user does not want to skip if (!this.skipMigration.Checked) { RoleMembershipHelper.SyncRoles(this.PageBoardID); // start the background migration task... this.Get <ITaskModuleManager>().Start <MigrateUsersTask>(this.PageBoardID); } e.Cancel = false; break; case "WizWelcomeUpgrade": e.Cancel = false; // move to upgrade.. this.CurrentWizardStepID = "WizInitDatabase"; break; case "WizWelcome": e.Cancel = false; // move to upgrade.. this.CurrentWizardStepID = "WizValidatePermission"; break; case "WizFinished": break; default: throw new ApplicationException( "Installation Wizard step not handled: {0}".FormatWith( this.InstallWizard.WizardSteps[e.CurrentStepIndex].ID)); } }