Exemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                if (CurrentPersonAliasId != null)
                {
                    var rockContext = new RockContext();
                    var notificationRecipientService = new NotificationRecipientService(rockContext);
                    var notificationItems            = notificationRecipientService
                                                       .Queryable()
                                                       .AsNoTracking()
                                                       .Where(n => n.PersonAliasId == CurrentPersonAliasId && n.Read == false)
                                                       .OrderByDescending(n => n.Notification.SentDateTime)
                                                       .ToList();

                    ViewState["NotificationCount"] = notificationItems.Count;

                    if (notificationItems.Count == 0)
                    {
                        HidePanel();
                    }

                    rptNotifications.DataSource = notificationItems;
                    rptNotifications.DataBind();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad( EventArgs e )
        {
            base.OnLoad( e );

            if ( !Page.IsPostBack )
            {
                if ( CurrentPersonAliasId != null )
                {
                    var rockContext = new RockContext();
                    var notificationRecipientService = new NotificationRecipientService( rockContext );
                    var notificationItems = notificationRecipientService
                        .Queryable()
                        .AsNoTracking()
                        .Where( n => n.PersonAliasId == CurrentPersonAliasId && n.Read == false )
                        .OrderByDescending( n => n.Notification.SentDateTime )
                        .ToList();

                    ViewState["NotificationCount"] = notificationItems.Count;

                    if ( notificationItems.Count == 0 )
                    {
                        HidePanel();
                    }

                    rptNotifications.DataSource = notificationItems;
                    rptNotifications.DataBind();
                }
            }
        }