Exemplo n.º 1
0
        /// <summary>
        /// Handles the Delete event of the gMarketingCampaignAds 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 gMarketingCampaignAds_Delete(object sender, RowEventArgs e)
        {
            MarketingCampaignAdService marketingCampaignAdService = new MarketingCampaignAdService();
            MarketingCampaignAd        marketingCampaignAd        = marketingCampaignAdService.Get((int)e.RowKeyValue);

            marketingCampaignAdService.Delete(marketingCampaignAd, CurrentPersonId);
            marketingCampaignAdService.Save(marketingCampaignAd, CurrentPersonId);
            BindMarketingCampaignAdsGrid();
        }
        /// <summary>
        /// Handles the Delete event of the gMarketingCampaignAds 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 gMarketingCampaignAds_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            MarketingCampaignAdService marketingCampaignAdService = new MarketingCampaignAdService( rockContext );

            MarketingCampaignAd marketingCampaignAd = marketingCampaignAdService.Get( e.RowKeyId );
            if ( marketingCampaignAd != null )
            {
                string errorMessage;
                if ( !marketingCampaignAdService.CanDelete( marketingCampaignAd, out errorMessage ) )
                {
                    mdGridWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                marketingCampaignAdService.Delete( marketingCampaignAd );
                rockContext.SaveChanges();
            }

            BindGrid();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the Delete event of the gMarketingCampaignAds 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 gMarketingCampaignAds_Delete(object sender, RowEventArgs e)
        {
            RockTransactionScope.WrapTransaction(() =>
            {
                MarketingCampaignAdService marketingCampaignAdService = new MarketingCampaignAdService();
                MarketingCampaignAd marketingCampaignAd = marketingCampaignAdService.Get(e.RowKeyId);
                if (marketingCampaignAd != null)
                {
                    string errorMessage;
                    if (!marketingCampaignAdService.CanDelete(marketingCampaignAd, out errorMessage))
                    {
                        mdGridWarning.Show(errorMessage, ModalAlertType.Information);
                        return;
                    }

                    marketingCampaignAdService.Delete(marketingCampaignAd, CurrentPersonId);
                    marketingCampaignAdService.Save(marketingCampaignAd, CurrentPersonId);
                }
            });

            BindGrid();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles the Delete event of the gMarketingCampaignAds 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 gMarketingCampaignAds_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            MarketingCampaignAdService marketingCampaignAdService = new MarketingCampaignAdService( rockContext );

            MarketingCampaignAd marketingCampaignAd = marketingCampaignAdService.Get( e.RowKeyId );
            if ( marketingCampaignAd != null )
            {
                string errorMessage;
                if ( !marketingCampaignAdService.CanDelete( marketingCampaignAd, out errorMessage ) )
                {
                    mdGridWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                marketingCampaignAdService.Delete( marketingCampaignAd );
                rockContext.SaveChanges();
            }

            BindGrid();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handles the Delete event of the gMarketingCampaignAds 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 gMarketingCampaignAds_Delete( object sender, RowEventArgs e )
        {
            MarketingCampaignAdService marketingCampaignAdService = new MarketingCampaignAdService();
            MarketingCampaignAd marketingCampaignAd = marketingCampaignAdService.Get( (int)e.RowKeyValue );

            marketingCampaignAdService.Delete( marketingCampaignAd, CurrentPersonId );
            marketingCampaignAdService.Save( marketingCampaignAd, CurrentPersonId );
            BindMarketingCampaignAdsGrid();
        }