示例#1
0
        /// <summary>
        /// Delete the current Step.
        /// </summary>
        private void DeleteStep()
        {
            var step = this.GetStep();

            if (step == null)
            {
                return;
            }

            var dataContext = GetRockContext();

            var stepService = new StepService(dataContext);

            string errorMessage;

            if (!stepService.CanDelete(step, out errorMessage))
            {
                mdDeleteWarning.Show(errorMessage, ModalAlertType.Information);
                return;
            }

            stepService.Delete(step);

            dataContext.SaveChanges();

            GoToSuccessPage(null);
        }
示例#2
0
        /// <summary>
        /// Handles the Click event of the delete/archive button in the grid
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs" /> instance containing the event data.</param>
        protected void DeleteStep_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e)
        {
            var dataContext = GetDataContext();

            var stepService = new StepService(dataContext);

            var step = stepService.Get(e.RowKeyId);

            if (step != null)
            {
                string errorMessage;

                if (!stepService.CanDelete(step, out errorMessage))
                {
                    mdGridWarning.Show(errorMessage, ModalAlertType.Information);
                    return;
                }

                stepService.Delete(step);

                dataContext.SaveChanges();
            }

            BindParticipantsGrid();
        }
示例#3
0
        /// <summary>
        /// Delete the step with the given Id and then re-render the lists of steps
        /// </summary>
        /// <param name="stepId"></param>
        private void DeleteStep(int stepId)
        {
            var    rockContext = GetRockContext();
            var    service     = new StepService(rockContext);
            var    step        = service.Get(stepId);
            string errorMessage;

            if (step == null)
            {
                return;
            }

            if (!service.CanDelete(step, out errorMessage))
            {
                ShowError(errorMessage);
                return;
            }

            service.Delete(step);
            rockContext.SaveChanges();
            ClearBlockData();
        }