Esempio n. 1
0
        public List <CommunityNews> GetNotifications(List <Guid> notificationsID, int UserLanguageID, int DefaultLanguageID)
        {
            List <CommunityNews> iResponse = new List <CommunityNews>();

            using (ISession session = NHSessionHelper.GetSession())
            {
                try
                {
                    foreach (Guid ID in notificationsID)
                    {
                        NotificationBase notification = (from nb in session.Linq <NotificationBase>()
                                                         where nb.UniqueNotifyID == ID && nb.LanguageID == UserLanguageID
                                                         select nb).FirstOrDefault <NotificationBase>();
                        if (notification.UniqueNotifyID != System.Guid.Empty)
                        {
                            CommunityNews news = new CommunityNews(notification.UniqueNotifyID, notification.CommunityID, notification.SentDate, notification.Day, notification.Message, notification.ModuleID);
                            iResponse.Add(news);
                        }
                    }
                }
                catch (Exception ex)
                {
                    iResponse = new List <CommunityNews>();
                }
            }

            return(iResponse);
        }
Esempio n. 2
0
        private void OnNewsReceived(CommunityNews news)
        {
            var now = DateTime.UtcNow;

            _news.RemoveWhere(n => n.EndDate <= now);

            if (GetContent(news).IsEmpty())
            {
                return;
            }

            _news.Add(news);

            _index = 0;
            ShowNews();
        }
        private void OnNewsReceived(CommunityNews news)
        {
            var now = DateTime.UtcNow;

            lock (_news.SyncRoot)
            {
                _news.RemoveWhere(n => n.EndDate <= now);

                if (GetContent(news).IsEmpty())
                {
                    return;
                }

                _news.Add(news);
                _index = 0;
            }

            this.GuiAsync(() => ShowNews(news));
        }
Esempio n. 4
0
        private static string GetContent(CommunityNews news)
        {
            var isRu = LocalizedStrings.ActiveLanguage == Languages.Russian;

            return(isRu ? news.RussianBody : news.EnglishBody);
        }
 private void ShowNews(CommunityNews news)
 {
     HtmlPanel.Text = _parser.ToHtml(GetContent(news));
 }