Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Delete event of the grdScheduledJobs control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
        protected void gScheduledJobs_Delete(object sender, RowEventArgs e)
        {
            ServiceJobService jobService = new ServiceJobService();
            ServiceJob        job        = jobService.Get((int)e.RowKeyValue);

            string errorMessage;

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

            jobService.Delete(job, CurrentPersonId);
            jobService.Save(job, CurrentPersonId);

            BindGrid();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Delete event of the grdScheduledJobs control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
        protected void gScheduledJobs_Delete(object sender, RowEventArgs e)
        {
            var        rockContext = new RockContext();
            var        jobService  = new ServiceJobService(rockContext);
            ServiceJob job         = jobService.Get(e.RowKeyId);

            string errorMessage;

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

            jobService.Delete(job);
            rockContext.SaveChanges();

            BindGrid();
        }