Exemple #1
0
        /// <summary>
        /// Handles the Delete event of the rGrid 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 rGrid_Delete(object sender, RowEventArgs e)
        {
            var tagService = new Rock.Model.TagService();
            var tag        = tagService.Get((int)rGrid.DataKeys[e.RowIndex]["id"]);

            if (tag != null)
            {
                string errorMessage;
                if (!tagService.CanDelete(tag, out errorMessage))
                {
                    mdGridWarning.Show(errorMessage, ModalAlertType.Information);
                    return;
                }

                tagService.Delete(tag, CurrentPersonId);
                tagService.Save(tag, CurrentPersonId);
            }

            BindGrid();
        }
Exemple #2
0
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var tagService = new Rock.Model.TagService();
            var tag        = tagService.Get(int.Parse(hfId.Value));

            if (tag != null)
            {
                string errorMessage;
                if (!tagService.CanDelete(tag, out errorMessage))
                {
                    mdDeleteWarning.Show(errorMessage, ModalAlertType.Information);
                    return;
                }

                tagService.Delete(tag, CurrentPersonId);
                tagService.Save(tag, CurrentPersonId);

                NavigateToParentPage();
            }
        }
Exemple #3
0
        /// <summary>
        /// Handles the Delete event of the rGrid 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 rGrid_Delete(object sender, RowEventArgs e)
        {
            var rockContext = new RockContext();
            var tagService  = new Rock.Model.TagService(rockContext);
            var tag         = tagService.Get(e.RowKeyId);

            if (tag != null)
            {
                string errorMessage;
                if (!tagService.CanDelete(tag, out errorMessage))
                {
                    mdGridWarning.Show(errorMessage, ModalAlertType.Information);
                    return;
                }

                tagService.Delete(tag);
                rockContext.SaveChanges();
            }

            BindGrid();
        }
        /// <summary>
        /// Handles the Delete event of the rGrid 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 rGrid_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            var tagService = new Rock.Model.TagService( rockContext );
            var tag = tagService.Get( (int)rGrid.DataKeys[e.RowIndex]["id"] );

            if ( tag != null )
            {
                string errorMessage;
                if ( !tagService.CanDelete( tag, out errorMessage ) )
                {
                    mdGridWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                tagService.Delete( tag );
                rockContext.SaveChanges();
            }

            BindGrid();
        }
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnDelete_Click( object sender, EventArgs e )
        {
            var rockContext = new RockContext();
            var tagService = new Rock.Model.TagService( rockContext );
            var tag = tagService.Get( int.Parse( hfId.Value ) );

            if ( tag != null )
            {
                string errorMessage;
                if ( !tagService.CanDelete( tag, out errorMessage ) )
                {
                    mdDeleteWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                tagService.Delete( tag );
                rockContext.SaveChanges();

                NavigateToParentPage();
            }
        }