コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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);
            }
        }
コード例 #4
0
 /// <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();
 }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
        internal bool QueryCanClose()
        {
            ConfirmationResult result = application.AskConfirmation(ConfirmationType.NeedSaveChanges);

            if (result == ConfirmationResult.Cancel)
            {
                return(false);
            }
            if (result == ConfirmationResult.Yes)
            {
                SaveDocument();
            }
            return(true);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
 /// <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();
 }
コード例 #13
0
 public static void NotifyUserConfirmation(ConfirmationResult answer)
 {
     CrashesInternal.NotifyWithUserConfirmation(answer);
 }
コード例 #14
0
ファイル: EventArgs.cs プロジェクト: g-shabanin/Katrin-CRM
 public ConfirmationEventArgs(ConfirmationType confirmationType, ConfirmationResult confirmationResult)
     : base()
 {
     this.confirmationType   = confirmationType;
     this.confirmationResult = confirmationResult;
 }
コード例 #15
0
 void cancel_Click(object sender, RoutedEventArgs e)
 {
     _result = ConfirmationResult.Cancel;
     Close();
 }
コード例 #16
0
 public IConfirmationDialog DefaultResult(ConfirmationResult defaultResult)
 {
     _defaultResult = defaultResult;
     return this;
 }
コード例 #17
0
 void close_Click(object sender, RoutedEventArgs e)
 {
     _result = ConfirmationResult.Quit;
     Close();
 }
コード例 #18
0
 public ConfirmationBox()
 {
     InitializeComponent();
     _result      = ConfirmationResult.Cancel;
     image.Source = Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Question.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
 }
コード例 #19
0
 /// <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();
 }
コード例 #20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public ConfirmationDialog()
 {
     ConfirmationResult = ConfirmationResult.None;
     InitializeComponent();
 }
コード例 #21
0
 /// <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();
 }