protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { int BoxNewsID = Convert.ToInt16(ConfigurationManager.AppSettings["BoxNewsID"]); int BoxNewsSize = Convert.ToInt16(ConfigurationManager.AppSettings["BoxNewsSize"]); Int32.TryParse(Request.Params["Id"], out this.id); BLL.Blog bll = BLL.Blog.Instance; BlogView = bll.GetModel(this.id, -1, 1, -1, 1, 1); if (null != BlogView && BlogView.BlogId > 0) { this.Title = BlogView.Title; this.MetaKeywords = BlogView.Title; this.MetaDescription = BlogView.Intro; } } } catch (Exception ex) { PTSLog.Error("ContentDetail", ex); } }
private void GetRSS() { string rssUri = ConfigurationManager.AppSettings["BlogSpot"]; var doc = System.Xml.Linq.XDocument.Load(rssUri); var rssFeed = (from el in doc.Elements("rss").Elements("channel").Elements("item") select new { Title = el.Element("title").Value, Link = el.Element("link").Value, Description = el.Element("description").Value }).Take(10); if (rssFeed.Any()) { foreach (var item in rssFeed) { Model.Blog iBlog = new Model.Blog(); iBlog.Title = item.Title; iBlog.TitleUrl = item.Link; iBlog.Intro = item.Description; FeedList.Add(iBlog); } } }
protected void Page_Load(object sender, EventArgs e) { try { int BoxNewsID = Convert.ToInt16(ConfigurationManager.AppSettings["BoxNewsID"]); int BoxNewsSize = Convert.ToInt16(ConfigurationManager.AppSettings["BoxNewsLeftBox"]); BLL.Video bll_video = BLL.Video.Instance; VideoItem = bll_video.GetModel(-1, 1, 1, 1); BLL.Content bll_content = BLL.Content.Instance; NewsList = bll_content.GetList(-1, BoxNewsID, 1, -1, 1, BoxNewsSize); BLL.Blog bll_blog = BLL.Blog.Instance; TopBlog = bll_blog.GetModel(-1, -1, 1, 1, 1, 1); this.ToggleLang(this.CultureNum); } catch (Exception ex) { PTSLog.Error(ex); } }
protected void btnSend_Click(object sender, EventArgs e) { CheckLogin(); int MemberId = Convert.ToInt16(Session["memberid"]); string Email = Session["email"].ToString(); string blogTitle = txtTitle.Text.Trim(); string blogTitleUrl = Utils.GenURL(blogTitle); string blogIntro = txtIntro.Value; string blogContent = txtContent.Value; BLL.Blog bll_blog = BLL.Blog.Instance; Model.Blog model = new Model.Blog(); model.MemberId = MemberId; model.Title = blogTitle; model.TitleUrl = blogTitleUrl; model.Image = string.Empty; model.Intro = blogIntro; model.Content = blogContent; model.BlogStatus = 0; model.CreateBy = Email; model.IsHot = 0; int rows = 0; bll_blog.Update(model, ref rows); if (rows > 0) { ShowModal("Bài viết của bạn đã gởi đến hệ thống, BQT sẽ duyệt bài viết trong thời gian sớm nhất có thể !"); } else { ShowModal("Lỗi xảy ra, vui lòng thử lại !"); } }