internal static async Task AwaitReadiness() { using (await SyncLock.Lock()) { switch (Status) { case CreationStatus.Created: break; case CreationStatus.Failed: case CreationStatus.NotCreated: Status = CreationStatus.Creating; await Create(); break; case CreationStatus.Creating: await Task.Delay(100); await AwaitReadiness(); break; default: throw new NotSupportedException(Status + " is not handled"); } } }
public static async Task Create(bool dropExisting = false) { if (!WebTestConfig.IsActive()) { Debug.WriteLine("Creating temp database aborted. Test mode is not active."); return; } try { if (new TestDatabaseGenerator().Process(Config, dropExisting)) { try { await(WebTestConfig.ReferenceDataCreator?.Invoke() ?? Task.CompletedTask); } catch (Exception ex) { throw new Exception("Failed to run the reference data.", ex); } } Status = CreationStatus.Created; } catch { Status = CreationStatus.Failed; throw; } finally { DatabaseChangeWatcher.Restart(); } }
/// <summary> /// Gets an error message corresponding to the given <see cref="CreationStatus"/>. /// </summary> /// <param name="creationStatus">A <see cref="CreationStatus"/> value.</param> /// <returns>An error message corresponding to the given <see cref="CreationStatus"/>.</returns> public string GetCreationErrorMessage(CreationStatus creationStatus) { var statusError = GetCreationStatusErrorMessage(creationStatus); return(string.IsNullOrEmpty(statusError) ? string.Empty : ToString() + ": " + Environment.NewLine + statusError); }
internal static async Task Restart() { using (await SyncLock.Lock()) { Status = CreationStatus.Creating; await Create(dropExisting : true); } }
public void AddLog(string message, CreationStatus creationStatus, LogType type) { if (creationStatus != CreationStatus.None) { status = creationStatus; } log.Add(new LogModel(message, type)); }
public TenantDeployment(CreationStatus creationStatus, TenantDeployment copyFrom, string externalEndpoint) : this(copyFrom.InternalName, copyFrom.ApplicationName, copyFrom.Name, creationStatus, copyFrom.InternalMineCraftEndpoint, copyFrom.InternalRconEndpoint, externalEndpoint) { }
public TenantDeployment(CreationStatus creationStatus, string internalEndpoint, string rconEndpoint, TenantDeployment copyFrom) : this(copyFrom.InternalName, copyFrom.ApplicationName, copyFrom.Name, creationStatus, internalEndpoint, rconEndpoint, copyFrom.ExternalEndpoint) { }
public TenantDeployment( string internalName, string applicationName, string name, CreationStatus status, string internalMineCraftEndpoint, string internalRconEndpoint, string externalEndpoint) { this.InternalName = internalName; this.ApplicationName = applicationName; this.Name = name; this.CreationStatus = status; this.InternalMineCraftEndpoint = internalMineCraftEndpoint; this.InternalRconEndpoint = internalRconEndpoint; this.ExternalEndpoint = externalEndpoint; }
/// <summary> /// Gets an error message corresponding to the given <see cref="CreationStatus"/>. /// </summary> /// <param name="creationStatus">A <see cref="CreationStatus"/> value.</param> /// <returns>An error message corresponding to the given <see cref="CreationStatus"/>.</returns> public static string GetCreationStatusErrorMessage(CreationStatus creationStatus) { switch (creationStatus) { case CreationStatus.ModelRelationshipsNotSupported: return(Resources.ModelRelationshipsNotSupportedError); case CreationStatus.ModelTableColumnsNotFound: return(Resources.ModelTableColumnsNotFoundError); case CreationStatus.ModelTablesNotFound: return(Resources.ModelTablesNotFoundError); case CreationStatus.PossibleCircularReference: return(Resources.PossibleCircularReferenceError); } return(string.Empty); }
public IActionResult Register([FromForm] string login, [FromForm] string password, [FromForm] string password2, [FromForm] int shouldRedirect) { if (!(CheckLoginFormat(login) && CheckPasswordFormat(password))) { if (shouldRedirect == 1) { return(RedirectToAction("Index", "Client", new { msg = "Incorrect login or password.\n" + "Both need to be at least 6 characters long and contains only letters and digits." })); } else { return(StatusCode((int)HttpStatusCode.BadRequest, new { response = "Incorrect login or password.\n" + "Both need to be at least 6 characters long and contains only letters and digits." })); } } if (password != password2) { if (shouldRedirect == 1) { return(RedirectToAction("Index", "Client", new { msg = "Password are not equal!" })); } else { return(StatusCode((int)HttpStatusCode.BadRequest, new { response = "Password are not equal!" })); } } CreationStatus status = _accountService.CreateUser(login, password); switch (status) { case CreationStatus.AlreadyExists: if (shouldRedirect == 1) { return(RedirectToAction("Index", "Client", new { msg = "User already exists!" })); } else { return(StatusCode((int)HttpStatusCode.Forbidden, new { response = "User already exists" })); } case CreationStatus.ExceptionThrown: if (shouldRedirect == 1) { return(RedirectToAction("Index", "Client", new { msg = "Server error, please contact administrator!" })); } else { return(StatusCode((int)HttpStatusCode.InternalServerError, new { response = "Server error, please contact administrator" })); } case CreationStatus.Created: default: if (shouldRedirect == 1) { return(RedirectToAction("Index", "Client", new { msg = "User created!" })); } else { return(Ok(new { response = "User created" })); } } }
public CreationEventArgs(CreationStatus cause, ValueTuple <ushort, ushort, ushort> location, CAGraphCell cell = null) { this.Cause = cause; this.Location = location; this.Cell = cell; }
public void ChangeStatus(CreationStatus s) { status = s; GlobalSettings.createForm.UpdateStatus(this); }