Пример #1
0
        protected void rptProjects_ItemCommand(object Sender, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Close")
            {
                var notificationRecipientGuid = e.CommandArgument.ToString().AsGuidOrNull();
                if (notificationRecipientGuid.HasValue)
                {
                    var rockContext = new RockContext();
                    var notificationRecipientService = new NotificationRecipientService(rockContext);
                    var notificationItem             = notificationRecipientService.Get(notificationRecipientGuid.Value);
                    if (notificationItem != null)
                    {
                        notificationRecipientService.Delete(notificationItem);
                    }

                    var toHide = e.Item.FindControl("rptNotificationAlert");
                    if (toHide != null)
                    {
                        toHide.Visible = false;
                    }

                    rockContext.SaveChanges();

                    NotificationCount--;
                    if (NotificationCount == 0)
                    {
                        HidePanel();
                    }
                }
            }
        }
Пример #2
0
        protected void rptProjects_ItemCommand( object Sender, RepeaterCommandEventArgs e )
        {
            if ( e.CommandName == "Close" )
            {
                var notificationRecipientGuid = e.CommandArgument.ToString().AsGuidOrNull();
                if ( notificationRecipientGuid.HasValue )
                {
                    var rockContext = new RockContext();
                    var notificationRecipientService = new NotificationRecipientService( rockContext );
                    var notificationItem = notificationRecipientService.Get( notificationRecipientGuid.Value );
                    if ( notificationItem != null )
                    {
                        notificationRecipientService.Delete( notificationItem );
                    }

                    var toHide = e.Item.FindControl( "rptNotificationAlert" );
                    if ( toHide != null )
                    {
                        toHide.Visible = false;
                    }

                    rockContext.SaveChanges();

                    NotificationCount--;
                    if (NotificationCount == 0 )
                    {
                        HidePanel();
                    }
                }
            }
        }