/// <summary>
        /// Handles the Delete event of the gEmailTemplates 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 gEmailTemplates_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            SystemEmailService emailTemplateService = new SystemEmailService( rockContext );
            SystemEmail emailTemplate = emailTemplateService.Get( (int)gEmailTemplates.DataKeys[e.RowIndex]["id"] );
            if ( emailTemplate != null )
            {
                emailTemplateService.Delete( emailTemplate );
                rockContext.SaveChanges();
            }

            BindGrid();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Delete event of the gEmailTemplates 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 gEmailTemplates_Delete(object sender, RowEventArgs e)
        {
            var rockContext = new RockContext();
            SystemEmailService emailTemplateService = new SystemEmailService(rockContext);
            SystemEmail        emailTemplate        = emailTemplateService.Get(e.RowKeyId);

            if (emailTemplate != null)
            {
                emailTemplateService.Delete(emailTemplate);
                rockContext.SaveChanges();
            }

            BindGrid();
        }