public async Task <IActionResult> Confirm(ConfirmationResult confirmation) { if (confirmation == null || confirmation.UniqueId == null) { return(NotFound()); } var candidate = await _context.Candidates .SingleOrDefaultAsync(m => m.Guid == confirmation.UniqueId); if (candidate == null) { return(NotFound("We could not find the candidate you were looking for. If you were trying to submit your confirmation page and it did not work, please message us on Facebook.")); } candidate.Confirmed = true; candidate.Accepted = confirmation.Accepted; _context.Update(candidate); await _context.SaveChangesAsync(); var result = "Thank you for submitting your response."; if (confirmation.Accepted) { result += "Your response has been noted and you are now eligible to be seconded."; } else { result += "Your response has been noted and you will be removed from the candidates list."; } return(Ok(result)); }
public async Task <ConfirmationResult> ConfirmAccountAsync(string secret) { var userName = await _clientAppRepository.GetUserNameFromTokenAsync(secret); if (userName == null) { return(ConfirmationResult.Failure); } if (WebSecurity.IsConfirmed(userName)) { return(ConfirmationResult.UserAlreadyConfirmed); } var success = WebSecurity.ConfirmAccount(secret); if (success) { var passwordResetToken = WebSecurity.GeneratePasswordResetToken(userName); var result = ConfirmationResult.Successful(userName, passwordResetToken); return(result); } return(ConfirmationResult.Failure); }
/// <summary> /// Function to show a confirmation message. /// </summary> /// <param name="message">The message to display.</param> /// <param name="caption">[Optional] A caption for the message.</param> /// <param name="toAll">[Optional] <b>true</b> to allow an application to apply the result to all items, <b>false</b> to only allow an application to apply the result to a single item.</param> /// <param name="allowCancel">[Optional] <b>true</b> to allow cancellation support, <b>false</b> to only allow accept or deny functionality.</param> /// <returns>The response value for the message.</returns> public MessageResponse ShowConfirmation(string message, string caption = null, bool toAll = false, bool allowCancel = false) { ConfirmationResult confirmResult = GorgonDialogs.ConfirmBox(GetParentForm(), message, caption, allowCancel, toAll); switch (confirmResult) { case ConfirmationResult.None: return(MessageResponse.None); case ConfirmationResult.Cancel: return(MessageResponse.Cancel); } if (((confirmResult & ConfirmationResult.ToAll) == ConfirmationResult.ToAll) && (toAll)) { if ((confirmResult & ConfirmationResult.Yes) == ConfirmationResult.Yes) { return(MessageResponse.YesToAll); } if ((confirmResult & ConfirmationResult.No) == ConfirmationResult.No) { return(MessageResponse.NoToAll); } } switch (confirmResult) { case ConfirmationResult.Yes: return(MessageResponse.Yes); default: return(MessageResponse.No); } }
/// <summary> /// Execute function <paramref name="onConfirmed"/> /// if <paramref name="confirmationResult"/> is equal to <see cref="ConfirmationResult.Confirmed"/>. /// </summary> public static async Task OnConfirmedAsync(this ConfirmationResult confirmationResult, Func <Task> onConfirmed) { if (confirmationResult != ConfirmationResult.Confirmed) { return; } await onConfirmed(); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.FormClosing"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.FormClosingEventArgs"></see> that contains the event data.</param> protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); // Assume cancel. if (ConfirmationResult != ConfirmationResult.None) { return; } ConfirmationResult = _showCancel ? ConfirmationResult.Cancel : ConfirmationResult.No; }
internal bool QueryCanClose() { ConfirmationResult result = application.AskConfirmation(ConfirmationType.NeedSaveChanges); if (result == ConfirmationResult.Cancel) { return(false); } if (result == ConfirmationResult.Yes) { SaveDocument(); } return(true); }
public ConfirmationResult Confirm(string message, ConfirmationResult defaultResult) { var result = ConfirmationResult.Undefined; do { result = Confirm_INTERNAL(message, defaultResult); if (result == ConfirmationResult.Undefined) { _host.Out.Warning.WriteLine("Please enter [Y]es or [N]o."); _host.Out.Standard.WriteLine(); } } while (result == ConfirmationResult.Undefined); return(result); }
private ConfirmationResult Confirm_INTERNAL(string message, ConfirmationResult defaultResult) { _host.Out.Standard.WriteLine(message); _host.Out.Standard.Write("Enter "); if (defaultResult == ConfirmationResult.Yes) { _host.Out.Accent2.Write("[Y]es"); } else { _host.Out.Standard.Write("[Y]es"); } _host.Out.Standard.Write(" to confirm, or "); if (defaultResult == ConfirmationResult.No) { _host.Out.Accent2.Write("[N]o"); } else { _host.Out.Standard.Write("[N]o"); } _host.Out.Standard.Write(" to cancel"); if (defaultResult != ConfirmationResult.Undefined) { _host.Out.Standard.Write(" ("); if (defaultResult == ConfirmationResult.Yes) { _host.Out.Standard.Write("Yes"); } else { _host.Out.Standard.Write("No"); } _host.Out.Standard.WriteLine(" is default)."); } return(EvaluateResponse(_host.Prompt("Confirmation: "), defaultResult)); }
private ConfirmationResult EvaluateResponse(string response, ConfirmationResult defaultResult) { switch (response.Trim().ToUpper()) { case "Y": case "YES": return(ConfirmationResult.Yes); case "N": case "NO": return(ConfirmationResult.No); case "": return(defaultResult); default: return(ConfirmationResult.Undefined); } }
public async Task <ConfirmationResult> ConfirmAccount(string userEmail, string secret) { if (await _identityProvider.VerifyUserEmailConfirmed(userEmail)) { return(ConfirmationResult.UserAlreadyConfirmed); } var success = await _identityProvider.ConfirmEmailWithToken(userEmail, secret); if (success) { var passwordResetToken = await _identityProvider.GeneratePasswordResetToken(userEmail); var result = ConfirmationResult.Successful(userEmail, passwordResetToken); return(result); } return(ConfirmationResult.Failure); }
public ConfirmationResult AskConfirmation(ConfirmationType confirmationType) { ConfirmationResult result = ConfirmationResult.Cancel; DialogResult userChoice = DialogResult.None; switch (confirmationType) { case ConfirmationType.NeedSaveChanges: { userChoice = GetUserChoice(CaptionHelper.GetLocalizedText(Confirmations, "Save"), MessageBoxButtons.YesNoCancel); break; } case ConfirmationType.CancelChanges: { userChoice = GetUserChoice(CaptionHelper.GetLocalizedText(Confirmations, "Cancel"), MessageBoxButtons.YesNo); break; } } if (userChoice == DialogResult.Yes) { result = ConfirmationResult.Yes; } if (userChoice == DialogResult.No) { result = ConfirmationResult.No; } if (userChoice == DialogResult.Cancel) { result = ConfirmationResult.Cancel; } Tracing.Tracer.LogValue("UserConfirmationResult", result); return(result); }
/// <summary> /// Handles the Click event of the buttonCancel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void buttonCancel_Click(object sender, EventArgs e) { ConfirmationResult = ConfirmationResult.Cancel; Close(); }
public static void NotifyUserConfirmation(ConfirmationResult answer) { CrashesInternal.NotifyWithUserConfirmation(answer); }
public ConfirmationEventArgs(ConfirmationType confirmationType, ConfirmationResult confirmationResult) : base() { this.confirmationType = confirmationType; this.confirmationResult = confirmationResult; }
void cancel_Click(object sender, RoutedEventArgs e) { _result = ConfirmationResult.Cancel; Close(); }
public IConfirmationDialog DefaultResult(ConfirmationResult defaultResult) { _defaultResult = defaultResult; return this; }
void close_Click(object sender, RoutedEventArgs e) { _result = ConfirmationResult.Quit; Close(); }
public ConfirmationBox() { InitializeComponent(); _result = ConfirmationResult.Cancel; image.Source = Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Question.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); }
/// <summary> /// Handles the Click event of the OKButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OKButton_Click(object sender, EventArgs e) { ConfirmationResult = ConfirmationResult.Yes; Close(); }
/// <summary> /// Constructor. /// </summary> public ConfirmationDialog() { ConfirmationResult = ConfirmationResult.None; InitializeComponent(); }
/// <summary> /// Handles the Click event of the buttonNo control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void buttonNo_Click(object sender, EventArgs e) { ConfirmationResult = ConfirmationResult.No; Close(); }