protected void btn_add_Click_more(object sender, EventArgs e) { try { NewsGroup newsgroup = ReceiveHtml(); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); int _newsgroupID = newsgroupBSO.CreateNewsGroupGet(newsgroup); //Add NewsCate add_NewsCate(_newsgroupID); NewsLogBSO newsLogBSO = new NewsLogBSO(); NewsLog _newsLog = newsLogBSO.GetNewsLog(newsgroup, Session["Admin_UserName"].ToString(), DateTime.Now, 0); int _newsLogID = newsLogBSO.CreateNewsLog(_newsLog); clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; AspNetCache.Reset(); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
//private void ViewRegister(int Id) //{ // NewsRegisterBSO newsregisterBSO = new NewsRegisterBSO(); // NewsRegister newsregister = newsregisterBSO.GetNewsRegisterByParentNewsId(Id); // if (newsregister == null) // ltlNewsRegister_link.Visible = false; // else // ltlNewsRegister_link.Text = "<div style='text-align:center;'><a href='" + ResolveUrl("~/") + "dang-ky/" + GetString(newsregister.Title) + "-" + newsregister.GroupCate + "-" + newsregister.NewsRegisterID + ".aspx'><img src='" + ResolveUrl("~/") + "images/btn_dangky.png' style='border-width:0px;'></a></div>"; //} private void NewsGroupRelation(int Id) { DataTable table = new DataTable(); string strID = GetNewsID(Id); if (strID != String.Empty && strID != "") { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); table = newsGroupBSO.GetNewsGroupByListNewsID(Language.language, strID, "1", "1"); if (table.Rows.Count > 0) { newsRelation.Visible = true; } else { newsRelation.Visible = false; } } else { newsRelation.Visible = false; } rptNewsRelation.DataSource = table; rptNewsRelation.DataBind(); }
protected void grvRelation_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); NewsRelationBSO _newsRelationBSO = new NewsRelationBSO(); NewsRelation _newsRelation = _newsRelationBSO.GetNewsRelationByID(Id, Convert.ToInt32(hddNewsID.Value)); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsgroup = newsGroupBSO.GetNewsGroupById(Id); string nName = e.CommandName.ToLower(); AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); switch (nName) { case "_view": break; case "_edit": Response.Redirect("~/Admin/editnewsbyuser/" + newsgroup.GroupCate + "/" + Id + "/Default.aspx"); break; case "_delete": _newsRelationBSO.DeleteNewsRelation(_newsRelation.Id); ViewNewsReleation(Convert.ToInt32(hddNewsID.Value)); AspNetCache.Reset(); break; } }
protected void btn_add_Click(object sender, EventArgs e) { try { NewsGroup newsgroup = ReceiveHtml(); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); int _newsgroupID = newsgroupBSO.CreateNewsGroupGet(newsgroup); add_NewsCate(_newsgroupID); NewsLogBSO newsLogBSO = new NewsLogBSO(); NewsLog _newsLog = newsLogBSO.GetNewsLog(newsgroup, Session["Admin_UserName"].ToString(), DateTime.Now, 0); int _newsLogID = newsLogBSO.CreateNewsLog(_newsLog); clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; initControl(_newsgroupID); AspNetCache.Reset(); ViewNewsLog(_newsgroupID); //Response.Redirect("~/Admin/Group/listnewsgroup/" + hddGroup.Value + "/Default.aspx"); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
private void GetCateParentNewsGroup(int cId, int gId) { _page = new PagingInfo(15, Convert.ToInt32(hdnPage.Value), true); string strCate = this.GetCateParentIDArrayByID(cId, gId); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable newsGroupPaging = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(hddGroupCate.Value), strCate, _page, 1, 1, 0, 1); if (newsGroupPaging.Rows.Count > 0) { TotalRecord = Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString())); rptListNewsGroup.DataSource = newsGroupPaging; rptListNewsGroup.DataBind(); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString())) <= 1L) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); Paging.Visible = false; panelDate.Visible = false; } CateNewsBSO cateNewsBSO = new CateNewsBSO(); DataTable cateClientGroup = cateNewsBSO.getCateClientGroup(cId, Language.language, gId, 5); if (cateClientGroup.Rows.Count > 0) { tintuc_col1.Attributes.Add("class", "tintuc-col1"); ViewListCate(cId, gId); } else { tintuc_col1.Attributes.Add("class", "tintuc-col-main"); listNewsCatePanel.Visible = false; } PagingInfo paging = new PagingInfo(15, (Convert.ToInt32(hdnPage.Value) + 1), true); DataTable newsGroupPaging2 = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(hddGroupCate.Value), strCate, paging, 1, 1, 0, 1); if (newsGroupPaging2.Rows.Count > 0) { newsOther.Visible = true; rptListNewsOther.DataSource = newsGroupPaging2; rptListNewsOther.DataBind(); return; } newsOther.Visible = false; }
private void ViewNewsHot(int groupcate) { // string strCate = GetCateParentIDArrayByID(cateID, groupcate); DataTable tableLeft = new DataTable(); if (AspNetCache.CheckCache("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); //table = newsGroupBSO.GetNewsGroupHot(Convert.ToInt32(hddRecord.Value), Language.language, "1"); tableLeft = newsGroupBSO.GetNewsGroupHot(Language.language, Convert.ToInt32(hddRecord.Value), "1", groupcate); AspNetCache.SetCacheWithTime("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), tableLeft, 150); } else { tableLeft = (DataTable)AspNetCache.GetCache("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_")); } DataTable tableRight = new DataTable(); if (AspNetCache.CheckCache("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); //table = newsGroupBSO.GetNewsGroupHot(Convert.ToInt32(hddRecord.Value), Language.language, "1"); //tableRight = newsGroupBSO.GetNewsNoGroupCateHot(Language.language, Convert.ToInt32(hddRecord.Value), groupcate); AspNetCache.SetCacheWithTime("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), tableRight, 150); } else { tableRight = (DataTable)AspNetCache.GetCache("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_")); } // string strHotNewsSlider = ""; //DataTable table01 = table.Clone(); //DataTable table02 = table.Clone(); //if (table.Rows.Count > 0) //{ // for (int j = 0; j < table.Rows.Count; j++) // { // DataRow dataRow = table.Rows[j]; // if (j < Convert.ToInt32(hddRecord.Value) - 3) // table01.ImportRow(dataRow); // else // table02.ImportRow(dataRow); // } rptLListNews.DataSource = tableLeft; rptLListNews.DataBind(); rptHotNews.DataSource = tableRight; rptHotNews.DataBind(); //} }
protected void Page_Load(object sender, EventArgs e) { int cId = 0; if (!String.IsNullOrEmpty(Request["cid"])) { int.TryParse(Request["cid"], out cId); } int gId = 0; if (!String.IsNullOrEmpty(Request["g"])) { int.TryParse(Request["g"], out gId); } int nId = 0; if (!String.IsNullOrEmpty(Request["id"])) { int.TryParse(Request["id"], out nId); } if (!IsPostBack) { if (gId == 0) { panel_menutree.Visible = false; } else { panel_menutree.Visible = true; if (cId == 0 && nId != 0) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup _newsgroup = newsGroupBSO.GetNewsGroupById(nId); if (_newsgroup != null) { cId = _newsgroup.CateNewsID; } } string strMenu = ""; if (AspNetCache.CheckCache("HTML_MenuVer_" + gId + "_" + cId) == false) { strMenu += BindMenuVer("", gId, cId); AspNetCache.SetCacheWithTime("HTML_MenuVer_" + gId + "_" + cId, strMenu, 150); MenuNews.Text = strMenu; } else { MenuNews.Text = (string)AspNetCache.GetCache("HTML_MenuVer_" + gId + "_" + cId); } } } }
protected void btn_disable_Click(object sender, EventArgs e) { if (NewsGroupID() != "") { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); newsGroupBSO.UpdateNewsGroup(NewsGroupID(), "0"); } ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue)); AspNetCache.Reset(); }
protected void btn_disable_approval_Click(object sender, EventArgs e) { if (NewsGroupID() != "") { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); newsGroupBSO.UpdateNewsGroupApproval(NewsGroupID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now); } ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue)); AspNetCache.Reset(); }
protected void ddlCateNewsSearch_SelectedIndexChanged(object sender, EventArgs e) { commonBSO commonBSO = new commonBSO(); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable table = new DataTable(); _page = new PagingInfo(20, Convert.ToInt32(hdnPage.Value), true); if (ddlCateNewsSearch.SelectedValue == "0") { if (!Session["Admin_UserName"].Equals("administrator")) { string strCate = GetCateParentIDArrayByID(Convert.ToInt32(ddlCateNewsGroup.SelectedValue)); if (strCate != "") { table = newsGroupBSO.GetNewsGroupPagingbyUser(Language.language, Convert.ToInt32(ddlCateNewsGroup.SelectedValue), strCate, _page, Session["Admin_UserName"].ToString(), 0, -1); } } else { table = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(ddlCateNewsGroup.SelectedValue), "", _page, 0, -1); } } else { table = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(ddlCateNewsGroup.SelectedValue), Convert.ToInt32(ddlCateNewsSearch.SelectedValue), _page, 0, -1); } if (table.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table.Rows[0]["Total"].ToString())); commonBSO.FillToGridView(grvNewsGroup, table); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); grvNewsGroup.DataSource = null; grvNewsGroup.DataBind(); Paging.Visible = false; } }
private void GetNewsGroup() { string value = ""; if (hddValue.Value.Length > 25) { value = hddValue.Value.ToString().Replace(",", "_").Substring(0, 25); } else { value = hddValue.Value.ToString().Replace(",", "_"); } if (AspNetCache.CheckCache("HTML_ltlBlockNewsbystrID_" + hddValue.Value) == false) { NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); DataTable table = newsgroupBSO.GetNewsGroupByListNewsID(Language.language, hddValue.Value, "1", "1"); string strNewsCateSlider = ""; string text1 = ""; if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { DataRow dataRow = table.Rows[i]; text1 += "<div class='news-list'>"; text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>"; text1 += "<span>"; if (dataRow["ImageThumb"].ToString() != "") { text1 += "<img class='is_img' src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 65) + "' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>"; } else { text1 += "<img class='is_img' src='" + ResolveUrl("~/") + "images/img_logo.jpg' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>"; } text1 += dataRow["Title"]; text1 += "</span>" + "</a>"; text1 += "<div class='clear'></div>" + "</div>"; } } AspNetCache.SetCacheWithTime("HTML_ltlBlockNewsbyCateID_" + hddValue.Value, text1, 150); ltlHotNewsSlider.Text = strNewsCateSlider; } else { ltlHotNewsSlider.Text = (string)AspNetCache.GetCache("HTML_ltlBlockNewsbyCateID" + hddValue.Value); } }
void GetNewsGroup(int cateID, int groupcate) { string strCate = GetCateParentIDArrayByID(cateID, groupcate); DataTable table = new DataTable(); if (AspNetCache.CheckCache("HTML_ltlNews_MainHome_by_cate_list1_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false) { NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); table = newsgroupBSO.GetNewsGroupByCateHomeList(strCate, groupcate, "1", Convert.ToInt32(hddRecord.Value), "1"); AspNetCache.SetCacheWithTime("HTML_ltlNews_MainHome_by_cate_list1_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), table, 150); } else { table = (DataTable)AspNetCache.GetCache("HTML_ltlNews_MainHome_by_cate_list1_" + hddValue.Value + "_" + Language.language.Replace("-", "_")); } string strHotNewsCate = ""; if (table.Rows.Count > 0) { DateTime dtNow = DateTime.Now; DataRow dataRow0 = table.Rows[0]; strHotNewsCate += "<div class='thumbnail no-thumbnail'>"; strHotNewsCate += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow0["Title"]) + "-" + dataRow0["GroupCate"] + "-" + dataRow0["NewsGroupID"].ToString() + ".aspx' title='" + dataRow0["Title"] + "'>"; strHotNewsCate += "<div class='embed-image ratio-16-9'>"; if (dataRow0["ImageThumb"].ToString() != "") { strHotNewsCate += "<img class='img-responsive' src='" + Utils.getURLThumbImage(dataRow0["ImageThumb"].ToString(), 330) + "' alt='" + dataRow0["Title"] + "'>"; } else { strHotNewsCate += "<img class='img-responsive' src='" + Utils.getURLThumbImage(ResolveUrl("~/") + "images/img_logo.jpg", 330) + "' alt='" + dataRow0["Title"] + "'>"; } strHotNewsCate += "</div>"; strHotNewsCate += "</a>"; strHotNewsCate += "<div class='caption'>"; strHotNewsCate += "<h3 class='title-news'>"; strHotNewsCate += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow0["Title"]) + "-" + dataRow0["GroupCate"] + "-" + dataRow0["NewsGroupID"].ToString() + ".aspx' title='" + dataRow0["Title"] + "'>"; strHotNewsCate += dataRow0["Title"].ToString(); strHotNewsCate += "</a>"; strHotNewsCate += "<span style='color: #6D6D6D; font-size: 12px;'> (" + Convert.ToDateTime(dataRow0["PostDate"]).ToString("dd/MM/yyyy") + ")</span>"; strHotNewsCate += "</h3>"; strHotNewsCate += "</div>"; strHotNewsCate += "</div>"; } ltlNewsCateMainHome.Text = strHotNewsCate; }
private void ViewNewsGroup(int group) { commonBSO commonBSO = new commonBSO(); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable table = new DataTable(); _page = new PagingInfo(20, Convert.ToInt32(hdnPage.Value), true); if (!Session["Admin_UserName"].Equals("administrator")) { string strCate = GetCateParentIDArrayByID(); if (strCate != "") { table = newsGroupBSO.GetNewsGroupPaging(Language.language, group, strCate, _page); } } else { table = newsGroupBSO.GetNewsGroupPaging(Language.language, group, _page); } if (table.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table.Rows[0]["Total"].ToString())); // commonBSO.FillToGridView(grvNewsGroup, table); grvNewsGroup.DataSource = table; grvNewsGroup.DataBind(); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); grvNewsGroup.DataSource = null; grvNewsGroup.DataBind(); Paging.Visible = false; } }
private void NewsGroupFollow(DateTime postDateID, int id, int cId) { NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); DataTable table = newsgroupBSO.NewsGroupFollow(postDateID, id, cId, 10, "1"); if (table.Rows.Count > 0) { newsOther.Visible = true; } else { newsOther.Visible = false; } DataListNews.DataSource = table; DataListNews.DataBind(); }
private void ViewNews(int Id) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsGroup = newsGroupBSO.GetNewsGroupById(Id); if (newsGroup != null) { ltlTitle.Text = newsGroup.Title; LabelDate.Text = newsGroup.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(newsGroup.PostDate); ltlDescribe.Text = newsGroup.ShortDescribe; FullDescirbe.Text = newsGroup.FullDescribe; LabelAuthor.Text = newsGroup.Author; //if (newsGroup.ImageThumb != "") // ltlImageThumb.Text = @"<img src='" + ResolveUrl("~/") + "Upload/NewsGroup/NewsGroupThumb/" + newsGroup.ImageThumb + "' align='left' class='border_image' width='250' >"; } }
protected void btn_add_Click(object sender, EventArgs e) { try { NewsGroup newsgroup = ReceiveHtml(); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); // MessageBox.Show(); //if (Tool.CountWords2(Tool.StripTagsCharArray(newsgroup.ShortDescribe)) > 60) //{ // String csname = "PopupScript"; // Type cstype = this.GetType(); // ClientScriptManager cs = Page.ClientScript; // if (!cs.IsStartupScriptRegistered(cstype, csname)) // { // String cstext = "Confirmation();"; // cs.RegisterStartupScript(cstype, csname, cstext, true); // } // if (hnd.Value != "") // { int _newsgroupID = newsgroupBSO.CreateNewsGroupGet(newsgroup); //Add NewsCate add_NewsCate(_newsgroupID); NewsLogBSO newsLogBSO = new NewsLogBSO(); NewsLog _newsLog = newsLogBSO.GetNewsLog(newsgroup, Session["Admin_UserName"].ToString(), DateTime.Now, 0); int _newsLogID = newsLogBSO.CreateNewsLog(_newsLog); clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; initControl(_newsgroupID); AspNetCache.Reset(); ViewNewsLog(_newsgroupID); //Response.Redirect("~/Admin/Group/listnewsgroup/" + hddGroup.Value + "/Default.aspx"); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void initPrint(int Id) { NewsGroupBSO newsBSO = new NewsGroupBSO(); NewsGroup news = newsBSO.GetNewsGroupById(Id); if (news != null) { ltlTitle.Text = news.Title; LabelDate.Text = news.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(news.PostDate); //ltlDescribe.Text = news.ShortDescribe; FullDescirbe.Text = news.FullDescribe; LabelAuthor.Text = news.Author; txtNewsGroupID.Value = Convert.ToString(news.NewsGroupID); //if (news.ImageThumb != "") // ltlImageThumb.Text = @"<img src='../Upload/NewsGroup/NewsGroupThumb/" + news.ImageThumb + "' align='left' class='border_image' width='250' >"; Page.Title = GetString(news.Title); } }
void GetNewsGroup(int cateID, int groupcate) { string strCate = GetCateParentIDArrayByID(cateID, groupcate); if (AspNetCache.CheckCache("HTML_ltlBlockNewsbyCateID_" + hddValue.Value) == false) { NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); DataTable table = newsgroupBSO.GetNewsGroupByCateHot(strCate, groupcate, "1", Convert.ToInt32(hddRecord.Value), "1", "1"); string text1 = ""; if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { DataRow dataRow = table.Rows[i]; text1 += "<div class='news-list'>"; text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>"; text1 += "<span>"; if (dataRow["ImageThumb"].ToString() != "") { text1 += "<img class='is_img' src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 65) + "' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>"; } else { text1 += "<img class='is_img' src='" + ResolveUrl("~/") + "images/img_logo.jpg' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>"; } text1 += dataRow["Title"]; text1 += "</span>" + "</a>"; text1 += "<div class='clear'></div>" + "</div>"; } } AspNetCache.SetCacheWithTime("HTML_ltlBlockNewsbyCateID_" + hddValue.Value, text1, 150); ltlHotNewsSlider.Text = text1; } else { ltlHotNewsSlider.Text = (string)AspNetCache.GetCache("HTML_ltlBlockNewsbyCateID_" + hddValue.Value); } }
protected void ddlGroupCate_SelectedIndexChanged(object sender, EventArgs e) { commonBSO commonBSO = new commonBSO(); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable table = new DataTable(); _page = new PagingInfo(20, Convert.ToInt32(hdnPage.Value), true); if (ddlGroupCate.SelectedValue == "0") { table = newsGroupBSO.GetNewsGroupPaging(Language.language, -1, _page); } else { table = newsGroupBSO.GetNewsGroupPaging(Language.language, Convert.ToInt32(ddlGroupCate.SelectedValue), _page); } if (table.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table.Rows[0]["Total"].ToString())); commonBSO.FillToGridView(grvNewsGroup, table); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); grvNewsGroup.DataSource = null; grvNewsGroup.DataBind(); Paging.Visible = false; } BindCateNews(Convert.ToInt32(ddlGroupCate.SelectedValue)); }
protected void btn_Send_Click(object sender, EventArgs e) { int Id = 0; if (!String.IsNullOrEmpty(Request["Id"])) { int.TryParse(Request["Id"], out Id); } NewsGroupBSO newsBSO = new NewsGroupBSO(); NewsGroup news = newsBSO.GetNewsGroupById(Id); ConfigBSO configBSO = new ConfigBSO(); Config config = configBSO.GetAllConfig(Language.language); string email = txtEmail.Text.Trim(); string strBody = "Bản tin từ Website " + config.WebName + " (" + config.WebDomain + ") : <br>"; strBody += "<b>" + news.Title + "</b> <br>"; strBody += "<img src='" + config.WebDomain + "/Upload/NewsGroup/NewsGroupThumb/" + news.ImageThumb + "' align='left' border='0' hspace='5'>"; strBody += "<b>" + news.ShortDescribe + "</b> <br>"; strBody += news.FullDescribe + "<br>"; strBody += news.Author + "<br>"; strBody += "<b>Liên kết đến bản tin : </b> <a href='" + config.WebDomain + "/News/" + news.GroupCate + "/" + news.NewsGroupID + "/" + GetString(news.Title) + ".aspx'>" + news.Title + "</a><br>"; MailBSO mailBSO = new MailBSO(); mailBSO.EmailFrom = config.Email_from; string strObj = "Bản tin từ Website " + config.WebName + " (" + config.WebDomain + ") - Ngày: " + DateTime.Now.ToString("dd:MM:yyyy"); mailBSO.SendMail(email, strObj, strBody); Response.Redirect("~/MailNews/" + Id + "/" + email + "/Default.aspx"); }
private void GetNewsTagsList(int Id) { DataTable table1 = new DataTable(); DateTime dtNow = DateTime.Now; _page = new PagingInfo(20, Convert.ToInt32(hdnPage.Value), true); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); table1 = newsgroupBSO.GetNewsGroupPagingbyTagsApproved(Id, _page); if (table1.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table1.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table1.Rows[0]["Total"].ToString())); rptListNewsGroup.DataSource = table1; rptListNewsGroup.DataBind(); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table1.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); Paging.Visible = false; } // ltlListCateNews.Text = text1; //title_cate.Text = " "; }
//Strip font HTML protected void btn_html_click(object sender, EventArgs e) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsGroup = new NewsGroup(); DataTable table = newsGroupBSO.GetNewsGroupAll(Language.language); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { newsGroup = newsGroupBSO.GetNewsGroupById(Convert.ToInt32(table.Rows[i]["NewsGroupID"].ToString())); //if (newsGroup.FullDescribe.IndexOf("<!--more-->") != -1) //{ // newsGroup.ShortDescribe = newsGroup.FullDescribe.Substring(0, newsGroup.FullDescribe.IndexOf("<!--more-->")); //} //newsGroup.FullDescribe = newsGroup.FullDescribe.Replace("^<p> </p>", ""); //string regex = @"<p[^>]*>(\s|& nbsp;)*</p>"; //string regex = @" "; //newsGroup.FullDescribe = Regex.Replace(newsGroup.FullDescribe, regex, "").Trim(); //newsGroup.FullDescribe = Regex.Match(newsGroup.FullDescribe, "^<p> </p>").ToString(); //newsGroup.ShortDescribe = Regex.Replace(newsGroup.ShortDescribe, regex, "").Trim(); // string text = x; string patternfont = @"font-size\s*?:.*?(;|(?=""|'|;))"; string cleanedHtmlfontFull = Regex.Replace(newsGroup.FullDescribe, patternfont, string.Empty); //cleanedHtmlfontFull = Regex.Replace(cleanedHtmlfontFull, "(line-height|font-family|font-size)\\s:.*?;?", String.Empty); cleanedHtmlfontFull = Regex.Replace(cleanedHtmlfontFull, @"font-family\s*?:.*?(;|(?=""|'|;))", String.Empty); newsGroup.FullDescribe = cleanedHtmlfontFull; string cleanedHtmlfontDes = Regex.Replace(newsGroup.ShortDescribe, patternfont, string.Empty); cleanedHtmlfontDes = Regex.Replace(cleanedHtmlfontDes, @"font-family\s*?:.*?(;|(?=""|'|;))", String.Empty); newsGroup.ShortDescribe = cleanedHtmlfontDes; //newsGroup.ShortDescribe = Tool.StripTagsCharArray(newsGroup.ShortDescribe); newsGroupBSO.UpdateNewsGroup(newsGroup); } clientview.Text = "Xử lý OK"; ViewNewsGroup(-1); } }
protected void Send_Click(object sender, EventArgs e) { NewsComment newsComment = ReceiveHtml(); if (txtCapcha.Text.ToLower() == Session["Random"].ToString().ToLower()) { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.CreateNewsComment(newsComment); ConfigBSO configBSO = new ConfigBSO(); Config config = configBSO.GetAllConfig(Language.language); string strBody = Resources.resource.T_Comment_email_title + config.WebName + " (" + config.WebDomain + ") : <br>"; strBody += "<b>" + Resources.resource.T_Comment_Title + ": </b> " + newsComment.Title + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Name + " : </b> " + newsComment.FullName + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Email + " : </b> " + newsComment.Email + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_ID + " : </b> " + newsComment.NewsID + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Content + " : </b> <br>" + newsComment.Content + "<br>"; NewsGroupBSO newsBSO = new NewsGroupBSO(); NewsGroup news = newsBSO.GetNewsGroupById(newsComment.NewsID); strBody += "<b>Title : </b> <a href='" + config.WebDomain + "/d4/news/" + GetString(news.Title) + "-" + hddGroupCate.Value + "-" + newsComment.NewsID + ".aspx'>" + news.Title + "</a><br>"; MailBSO mailBSO = new MailBSO(); mailBSO.EmailFrom = newsComment.Email; mailBSO.EmailFrom = config.Email_from; string strObj = Resources.resource.T_Comment_email_title + config.WebName + " (" + config.WebDomain + ") - Date: " + DateTime.Now.ToString("dd:MM:yyyy"); mailBSO.SendMail(config.Email_to, strObj, strBody); int Id = Convert.ToInt32(txtNewsGroupID.Value); Response.Redirect("~/d5/news/" + GetString(news.Title) + "-" + hddGroupCate.Value + "-" + Id + "-2.aspx"); } }
protected void btn_img_click(object sender, EventArgs e) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsGroup = new NewsGroup(); DataTable table = newsGroupBSO.GetNewsGroupAll(Language.language); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { newsGroup = newsGroupBSO.GetNewsGroupById(Convert.ToInt32(table.Rows[i]["NewsGroupID"].ToString())); // newsGroup.ShortDescribe = newsGroup.ShortDescribe.Replace("src=\"/Portals/0/", "src=\"/UserFile/images/"); newsGroup.FullDescribe = newsGroup.FullDescribe.Replace("src=\"/upload/image/", "src=\"/UserFile/images/"); newsGroupBSO.UpdateNewsGroup(newsGroup); } clientview.Text = "Xử lý OK"; ViewNewsGroup(-1); } }
private void ViewNewsHot(int groupcate) { DataTable tableRight = new DataTable(); if (AspNetCache.CheckCache("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); //table = newsGroupBSO.GetNewsGroupHot(Convert.ToInt32(hddRecord.Value), Language.language, "1"); tableRight = newsGroupBSO.GetNewsLatest(Language.language, Convert.ToInt32(hddRecord.Value), "1"); AspNetCache.SetCacheWithTime("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), tableRight, 150); } else { tableRight = (DataTable)AspNetCache.GetCache("Table_Mainhome_HotNewsRight_" + hddValue.Value + "_" + Language.language.Replace("-", "_")); } rptHotNews.DataSource = tableRight; rptHotNews.DataBind(); //} }
private void ViewNewsHot(int groupcate) { // string strCate = GetCateParentIDArrayByID(cateID, groupcate); DataTable tableLeft = new DataTable(); if (AspNetCache.CheckCache("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); tableLeft = newsGroupBSO.GetNewsGroupHot(Convert.ToInt32(hddRecord.Value), Language.language, "1"); //tableLeft = newsGroupBSO.GetNewsGroupHot(Language.language, Convert.ToInt32(hddRecord.Value), "1", groupcate); AspNetCache.SetCacheWithTime("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), tableLeft, 150); } else { tableLeft = (DataTable)AspNetCache.GetCache("Table_Mainhome_ltlHotNewsSlider_" + hddValue.Value + "_" + Language.language.Replace("-", "_")); } rptHotNews.DataSource = tableLeft; rptHotNews.DataBind(); //} }
protected void btn_img1_click(object sender, EventArgs e) { NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsGroup = new NewsGroup(); DataTable table = newsGroupBSO.GetNewsGroupAll(Language.language); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { newsGroup = newsGroupBSO.GetNewsGroupById(Convert.ToInt32(table.Rows[i]["NewsGroupID"].ToString())); newsGroup.ShortDescribe = newsGroup.ShortDescribe.Replace("[img src", "<br/><img src"); newsGroup.FullDescribe = newsGroup.FullDescribe.Replace("[img src", "<br/><img src"); newsGroup.ShortDescribe = newsGroup.ShortDescribe.Replace("\"]", "\"/><br/>"); newsGroup.FullDescribe = newsGroup.FullDescribe.Replace("\"]", "\"/><br/>"); newsGroupBSO.UpdateNewsGroup(newsGroup); } clientview.Text = "Xử lý OK"; ViewNewsGroup(-1); } }
private void ViewNewsGroup(int group) { commonBSO commonBSO = new commonBSO(); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable table = new DataTable(); _page = new PagingInfo(20, Convert.ToInt32(hdnPage.Value), true); table = newsGroupBSO.GetNewsGroupPaging(Language.language, group, _page); if (table.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table.Rows[0]["Total"].ToString())); commonBSO.FillToGridView(grvNewsGroup, table); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); grvNewsGroup.DataSource = null; grvNewsGroup.DataBind(); Paging.Visible = false; } }
protected void btn_search_Click(object sender, EventArgs e) { commonBSO commonBSO = new commonBSO(); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); string _finter = ""; _page = new PagingInfo(15, Convert.ToInt32(hdnPage.Value), true); System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); _finter += " And Language = '" + Language.language + "'"; if (hddGroupCate.Value != "") { _finter += " And GroupCate = " + hddGroupCate.Value; } if (hddCateID.Value != "" && hddCateID.Value != "0") { string strCate = this.GetCateParentIDArrayByID(Convert.ToInt32(hddCateID.Value), Convert.ToInt32(hddGroupCate.Value)); _finter += " And CateNewsID in ('" + strCate.Remove(strCate.LastIndexOf(",")).Replace(",", "','") + "')"; } // DateTime TheDateFrom; if (dateFrom.Text != "" && dateFrom.Text != string.Empty) { _finter += " AND PostDate >= '" + DateTime.Parse(dateFrom.Text).ToString("M/d/yyyy hh:mm:ss tt", ci) + "'"; } // DateTime TheDateTo; if (dateTo.Text != "" && dateTo.Text != string.Empty) { _finter += " AND PostDate <= '" + DateTime.Parse(dateTo.Text).ToString("M/d/yyyy hh:mm:ss tt", ci) + "'"; } DataTable table = newsGroupBSO.NewsGroupSearchPaging(_finter, _page); newsOther.Visible = false; if (table.Rows.Count > 0) { TotalRecord = Convert.ToInt32(table.Rows[0]["Total"].ToString()); SetAttributeGvArticle(Convert.ToInt32(table.Rows[0]["Total"].ToString())); rptListNewsGroup.DataSource = table; rptListNewsGroup.DataBind(); Paging.DataLoad(); if (TotalPage(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1) { Paging.Visible = false; } else { Paging.Visible = true; } } else { SetAttributeGvArticle(0); rptListNewsGroup.DataSource = null; rptListNewsGroup.DataBind(); Paging.Visible = false; } }
private void initControl(int Id) { AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; btn_add2.Visible = false; btn_add1.Visible = false; btn_edit1.Visible = true; try { NewsGroup newsgroup = new NewsGroup(); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); newsgroup = newsgroupBSO.GetNewsGroupById(Id); hddNewsGroupID.Value = Convert.ToString(newsgroup.NewsGroupID); ddlCateNews.SelectedValue = Convert.ToString(newsgroup.CateNewsID); hddParentNewsID.Value = Convert.ToString(newsgroup.ParentNewsID); //rdbGroupCate.SelectedValue = Convert.ToString(newsgroup.GroupCate); //Thêm txtTitle.Text = newsgroup.Title; txtRadShort.Text = System.Net.WebUtility.HtmlDecode(newsgroup.ShortDescribe); txtRadFull.Text = newsgroup.FullDescribe; hddImageThumb.Value = newsgroup.ImageThumb; hddImageLarge.Value = newsgroup.ImageLarge; txtimage4_3.Text = newsgroup.ImageThumb; txtimage16_9.Text = newsgroup.ImageLarge; if (newsgroup.ImageThumb != "") { img_thumb.Text = "<img src='" + newsgroup.ImageThumb + "' width='48px' valign='middle'>"; } if (newsgroup.ImageLarge != "") { img_large.Text = "<img src='" + newsgroup.ImageLarge + "' width='48px' valign='middle'>"; } hddFileName.Value = newsgroup.FileName; txtAuthor.Text = newsgroup.Author; txtRadDate.Text = String.Format("{0:dd/MM/yyyy HH:mm}", newsgroup.PostDate); //DateTime.Parse(newsgroup.PostDate.ToString()).ToString("dd/MM/yyyy hh:mm", ci); // newsgroup.PostDate.ToString(); hddPostDate.Value = String.Format("{0:dd/MM/yyyy HH:mm}", newsgroup.PostDate); // "9/3/2008 16:05:07" .ToString(); hddRelationTotal.Value = Convert.ToString(newsgroup.RelationTotal); rdbStatus.Checked = newsgroup.Status; rdbIshot.Checked = newsgroup.Ishot; rdbIshome.Checked = newsgroup.Ishome; hddCommentTotal.Value = Convert.ToString(newsgroup.CommentTotal); hddIsView.Value = Convert.ToString(newsgroup.Isview); hddCreateUserName.Value = newsgroup.CreatedUserName; hddApprovalUserName.Value = newsgroup.ApprovalUserName; hddApprovalDate.Value = Convert.ToString(newsgroup.ApprovalDate); txtKeywords.Text = newsgroup.Keyword; txtTags.Text = newsgroup.Tags; txtSlug.Text = newsgroup.Slug; rdbComment.Checked = newsgroup.IsComment; rdbApproval.Checked = newsgroup.IsApproval; if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.Enabled = true; } else { rdbApproval.Enabled = false; } //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); //if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) //{ // rdbApproval.Checked = newsgroup.IsApproval; // rdbApproval.Enabled = true; //} //else //{ // rdbApproval.Checked = newsgroup.IsApproval; // rdbApproval.Enabled = false; //} hddGroup.Value = newsgroup.GroupCate.ToString(); BindToCateNews(newsgroup.GroupCate); ddlCateNewsGroup.SelectedValue = hddGroup.Value; ddlCateNews.SelectedValue = Convert.ToString(newsgroup.CateNewsID); rdbTypeNews.Checked = newsgroup.TypeNews; txtShortTitle.Text = newsgroup.ShortTitle; chkUrl.Checked = newsgroup.isUrl; txtUrl.Text = newsgroup.Url; if (newsgroup.isUrl) { txtUrl.Visible = true; panelUrl.Visible = true; } else { txtUrl.Visible = false; panelUrl.Visible = false; } hddisDelete.Value = newsgroup.isDelete.ToString(); BindListCate(newsgroup.NewsGroupID); //MultiCate ViewNewsLog(newsgroup.NewsGroupID); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { txtRadDate.Text = String.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Now); //DateTime.Parse(newsgroup.PostDate.ToString()).ToString("dd/MM/yyyy hh:mm", ci); // newsgroup.PostDate.ToString(); hddPostDate.Value = String.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Now); // "9/3/2008 16:05:07" .ToString(); txtUrl.Visible = false; btn_add.Visible = true; btn_edit.Visible = false; btn_add2.Visible = true; btn_add1.Visible = true; btn_edit1.Visible = false; if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.Enabled = true; } else { rdbApproval.Enabled = false; } txtUrl.Visible = false; panelUrl.Visible = false; chkUrl.Checked = false; } }