Пример #1
0
        /// <summary>
        /// Processes the selection, save state and navigates to the next page if no errors
        /// are encountered during processing the activity.
        /// </summary>
        /// <param name="modalAlert">The modal alert control to show if errors occur.</param>
        /// <param name="doNotProceedCondition">A condition that must be met after processing
        /// the activity in order to save state and continue to the next page.</param>
        /// <param name="conditionMessage">The message to display in the modal if the condition fails.</param>
        /// <param name="validateSelectionRequired">if set to <c>true</c> will check that block on next page has a selection required before redirecting.</param>
        /// <returns></returns>
        protected virtual bool ProcessSelection(Rock.Web.UI.Controls.ModalAlert modalAlert, Func <bool> doNotProceedCondition, string conditionMessage, bool validateSelectionRequired)
        {
            var errors = new List <string>();

            string workflowActivity = GetAttributeValue("WorkflowActivity");

            if (string.IsNullOrEmpty(workflowActivity) || ProcessActivity(workflowActivity, out errors))
            {
                if (doNotProceedCondition())
                {
                    modalAlert?.Show(conditionMessage, Rock.Web.UI.Controls.ModalAlertType.None);
                    return(false);
                }
                else
                {
                    SaveState();
                    NavigateToNextPage(validateSelectionRequired);
                    return(true);
                }
            }
            else
            {
                string errorMsg = "<ul><li>" + errors.AsDelimited("</li><li>") + "</li></ul>";
                modalAlert?.Show(errorMsg.Replace("'", @"\'"), Rock.Web.UI.Controls.ModalAlertType.Warning);
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// Processes the selection, save state and navigates to the next page if no errors
        /// are encountered during processing the activity.
        /// </summary>
        /// <param name="modalAlert">The modal alert control to show if errors occur.</param>
        /// <param name="doNotProceedCondition">A condition that must be met after processing
        /// the activity in order to save state and continue to the next page.</param>
        /// <param name="conditionMessage">The message to display in the modal if the condition fails.</param>
        /// <returns></returns>
        protected virtual List <string> ProcessSelection(Rock.Web.UI.Controls.ModalAlert modalAlert, Func <bool> doNotProceedCondition, string conditionMessage)
        {
            var errors = new List <string>();

            string workflowActivity = GetAttributeValue("WorkflowActivity");

            if (string.IsNullOrEmpty(workflowActivity) || ProcessActivity(workflowActivity, out errors))
            {
                if (doNotProceedCondition())
                {
                    modalAlert.Show(conditionMessage, Rock.Web.UI.Controls.ModalAlertType.Warning);
                }
                else
                {
                    SaveState();
                    NavigateToNextPage();
                }
            }
            else
            {
                string errorMsg = "<ul><li>" + errors.AsDelimited("</li><li>") + "</li></ul>";
                modalAlert.Show(errorMsg, Rock.Web.UI.Controls.ModalAlertType.Warning);
            }

            return(errors);
        }
Пример #3
0
        /// <summary>
        /// Processes the selection, save state and navigates to the next page if no errors
        /// are encountered during processing the activity.
        /// </summary>
        /// <param name="modalAlert">The modal alert control to show if errors occur.</param>
        /// <returns>a list of errors encountered during processing the activity</returns>
        /// <param name="validateSelectionRequired">if set to <c>true</c> will check that block on next page has a selection required before redirecting.</param>
        protected virtual List <string> ProcessSelection(Rock.Web.UI.Controls.ModalAlert modalAlert, bool validateSelectionRequired)
        {
            var errors = new List <string>();

            string workflowActivity = GetAttributeValue("WorkflowActivity");

            if (string.IsNullOrEmpty(workflowActivity) || ProcessActivity(workflowActivity, out errors))
            {
                SaveState();
                NavigateToNextPage(validateSelectionRequired);
            }
            else
            {
                string errorMsg = "<ul><li>" + errors.AsDelimited("</li><li>") + "</li></ul>";
                modalAlert.Show(errorMsg.Replace("'", @"\'"), Rock.Web.UI.Controls.ModalAlertType.Warning);
            }

            return(errors);
        }