Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var header = "Hittade inte nyheten";
            var body = "";
            var newsId = this.GetRedirectParameter("id",true);
            if (!String.IsNullOrEmpty(newsId))
            {
                try
                {
                    var newsGuid = new Guid(newsId);
                    var newsItem = new NewsManagement(Global.ConnectionString, SessionProps).GetNewsItem(newsGuid);
                    if (newsItem != null)
                    {
                        header = newsItem.Header;
                        body = ParseOutput(newsItem.Body);
                    }
                }
                catch (Exception)
                {

                    //do nothing - bad input data - can't find news item
                }

            }

            Header.Text = header;
            Body.Text = body;
        }
Exemplo n.º 2
0
        private void GetTopThreeNews()
        {
            var newsList = new NewsManagement(Global.ConnectionString, SessionProps).GetTopThreeNews();

            lblNews.Text = "";

            foreach(var news in newsList)
            {
                lblNews.Text += "<h4>" + news.Header + "</h4>";
                lblNews.Text += "<p>" + news.Body.Replace("\n", "<br>") + "</p>";
                lblNews.Text += "<br><br>";
            }
        }
Exemplo n.º 3
0
        private void LoadNews()
        {
            var page = this.GetRedirectParameter("page", true);
            var pageNumber = 0;
            if (!String.IsNullOrEmpty(page))
                int.TryParse(page, out pageNumber);

            PageNumber = pageNumber;

            //var newsCount = new NewsManagement(SessionProps).GetNumberOfNews();
            var news = new NewsManagement(Global.ConnectionString, SessionProps).GetNews(25, PageNumber);

            LastPage = news.Count < 25;

            rptNews.DataSource = news.Select(n => new NewsDto(n));
            rptNews.DataBind();

            //grdNews.DataSource = news.ToList();
            //grdNews.DataBind();
        }
Exemplo n.º 4
0
        private void EditNewsItems(Guid newsGuid)
        {
            pnlNewsEditor.Visible = true;

            var newsItem = new NewsManagement(Global.ConnectionString, SessionProps).GetNewsItem(newsGuid);

            Id = newsGuid;

            Header.Text = newsItem.Header;
            Body.Text = newsItem.Body;
            ValidFrom.Text = newsItem.ValidFrom.ToString();
            ValidTo.Text = newsItem.ValidTo.ToString() ?? "";

            btnTweet.Visible = true;

            newsChangeLog.LoadChangeLog(Id);
        }