@using Oqtane.Services @using Oqtane.Models @inject IUriHelper UriHelper @inject IInstallationService InstallationService @inject IUserService UserService @if (!Installed) {

Database Configuration


Application Administrator



@((MarkupString)@Message)
} @code { [Parameter] private bool Installed { get; set; } private string DatabaseType = "LocalDB"; private string ServerName = "(LocalDb)\\MSSQLLocalDB"; private string DatabaseName = "Oqtane-" + DateTime.Now.ToString("yyyyMMddHHmm"); private string Username = ""; private string Password = ""; private string HostUsername = "host"; private string HostPassword = ""; private string Message = ""; private string IntegratedSecurityDisplay = "display:none;"; private string LoadingDisplay = "display:none;"; private void SetIntegratedSecurity(UIChangeEventArgs e) { if (Convert.ToBoolean(e.Value)) { IntegratedSecurityDisplay = "display:none;"; } else { IntegratedSecurityDisplay = ""; } } private async Task Install() { if (HostPassword.Length >= 6) { LoadingDisplay = ""; StateHasChanged(); string connectionstring = ""; if (DatabaseType == "LocalDB") { connectionstring = "Data Source=" + ServerName + ";AttachDbFilename=|DataDirectory|\\" + DatabaseName + ".mdf;Initial Catalog=" + DatabaseName + ";Integrated Security=SSPI;"; } else { connectionstring = "Data Source=" + ServerName + ";Initial Catalog=" + DatabaseName + ";"; if (IntegratedSecurityDisplay == "display:none;") { connectionstring += "Integrated Security=SSPI;"; } else { connectionstring += "User ID=" + Username + ";Password=" + Password; } } GenericResponse response = await InstallationService.Install(connectionstring); if (response.Success) { User user = new User(); user.SiteId = 1; user.Username = HostUsername; user.DisplayName = HostUsername; user.Password = HostPassword; user.IsSuperUser = true; user.Roles = ""; await UserService.AddUserAsync(user); UriHelper.NavigateTo("", true); } else { Message = "
" + response.Message + "
"; LoadingDisplay = "display:none;"; } } else { Message = "
Password Must Be 6 Characters Or Greater
"; } } }