public void getDataPhai(string nguonPhai) { DataTable dt, dtTemp; string catName, catLink; zClass ob = new zClass(); dt = ob.nsHOME(nguonPhai, out dtTemp, out catName, out catLink); rbPhai.Text = catName; if (Settings["TieuDePhai"] != null) rbPhai.Text = Settings["TieuDePhai"].ToString(); if (rbPhai.Text == "") rbPhai.Text = catName; rbPhai.NavigateUrl = catLink; GridView3.DataSource = dtTemp; GridView3.DataBind(); try { lkTieuDePhai.Text = dt.Rows[0][1].ToString(); lkTieuDePhai.NavigateUrl = dt.Rows[0][4].ToString(); ImagePhai.ImageUrl = dt.Rows[0][2].ToString(); lbContentPhai.Text = dt.Rows[0][3].ToString(); } catch { lkTieuDePhai.Text = ""; ImagePhai.Width = 0; } }
protected void Page_Load(object sender, EventArgs e) { string newsID = Request.QueryString["id"]; try { zClass ob = new zClass(); //DataTable dt = ob.zGetNews(newsID, out dtTinKhac); DataTable dtTemp; DataTable dt = ob.ASP_nsVIEW(newsID, out dtTemp); if ((dt.Rows[0][8].ToString() == "False") && (UserInfo.IsInRole("DuyetTin") == false) && (UserInfo.IsInRole("DangTin") == false)) { lbHeadline.Text = "Không tìm thấy bài viết!"; return; } hlCatName.Text = dt.Rows[0][1].ToString(); hlCatName.NavigateUrl = ob.GET_CAT_LINK(dt.Rows[0][0].ToString()); lbHeadline.Text = dt.Rows[0][2].ToString(); lbDate.Text = dt.Rows[0][5].ToString(); lbContent.Text = dt.Rows[0][7].ToString(); if (dt.Rows[0][4].ToString() != "") lbSource.Text = "Theo " + dt.Rows[0][4].ToString(); lbTotalView.Text = dt.Rows[0][6].ToString() + " lượt xem."; GridView1.DataSource = dtTemp; GridView1.DataBind(); } catch { lbHeadline.Text = "Không tìm thấy bài viết."; } }
public override void LoadSettings() { zClass ob = new zClass(); DataTable dt = ob.GET_CAT_LIST(""); DataRow dr = dt.NewRow(); dr[0] = "HOT"; dr[1] = "Tin nổi bật"; dt.Rows.InsertAt(dr, 0); dr = dt.NewRow(); dr[0] = "VIEW"; dr[1] = "Tin đọc nhiều"; dt.Rows.InsertAt(dr, 0); dr = dt.NewRow(); dr[0] = "NEW"; dr[1] = "Tin mới nhất"; dt.Rows.InsertAt(dr, 0); DropDownList1.DataSource = dt; DropDownList1.DataTextField = "CatName"; DropDownList1.DataValueField = "CatID"; DropDownList1.DataBind(); DropDownList2.DataSource = dt; DropDownList2.DataTextField = "CatName"; DropDownList2.DataValueField = "CatID"; DropDownList2.DataBind(); try { if (ModuleSettings["Nguon"] != null) DropDownList1.SelectedValue = ModuleSettings["Nguon"].ToString(); if (ModuleSettings["TieuDe"] != null) TextBox1.Text = ModuleSettings["TieuDe"].ToString(); if (ModuleSettings["NguonPhai"] != null) DropDownList2.SelectedValue = ModuleSettings["NguonPhai"].ToString(); if (ModuleSettings["TieuDePhai"] != null) TextBox2.Text = ModuleSettings["TieuDePhai"].ToString(); } catch { } }
public override void LoadSettings() { try { if (ModuleSettings["SQL"] != null) tbSQL.Text = ModuleSettings["SQL"].ToString(); if (ModuleSettings["Nguon"] != null) DropDownList1.SelectedValue = ModuleSettings["Nguon"].ToString(); if (ModuleSettings["Trang"] != null) TextBox1.Text = ModuleSettings["Trang"].ToString(); zClass ob = new zClass(); const string st = "SELECT CatID, CatName FROM News_Category"; SqlParameter[] para = new SqlParameter[0]; DataTable dt = ob.CMD_SELECT(st, para).Tables[0]; DataRow dr = dt.NewRow(); dr[0] = "URL"; dr[1] = "[Default] Lấy từ URL"; dt.Rows.InsertAt(dr, 0); dr = dt.NewRow(); dr[0] = "SQL"; dr[1] = "* T-SQL"; dt.Rows.Add(dr); DropDownList1.DataSource = dt; DropDownList1.DataTextField = "CatName"; DropDownList1.DataValueField = "CatID"; DropDownList1.DataBind(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { catID = "URL"; if (Settings["Nguon"] != null) catID = Settings["Nguon"].ToString(); if (catID == "URL") catID = Request.QueryString["categoryid"].ToString(); zClass ob = new zClass(); string catName = "-"; //DataTable dt = ob.zGetNewsCat(catID, out catName); DataTable dt = ob.ASP_nsLIST(catID, out catName); lbCatName.Text = catName; page = 10; if (Settings["Trang"] != null) page = Convert.ToInt32(Settings["Trang"].ToString()); GridView1.PageSize = page; GridView1.DataSource = dt; GridView1.DataBind(); if (UserInfo.IsInRole("DangTin") || UserInfo.IsInRole("DuyetTin")) { hlAddNews.Visible = true; hlAddNews.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "nsQLTT", "mid/" + this.ModuleId.ToString()); hlYahoo.Visible = true; } else { hlAddNews.Visible = false; hlYahoo.Visible = false; } } catch { } }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; zClass ob = new zClass(); string catName = ""; //DataTable dt = ob.zGetNewsCat(catID, out catName); DataTable dt = ob.ASP_nsLIST(catID, out catName); GridView1.PageSize = page; GridView1.DataSource = dt; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string catID = ""; if (Settings["Nguon"] != null) try { Int32.Parse(Settings["Nguon"].ToString()); catID = Settings["Nguon"].ToString(); } catch { } if (catID != "") catID = "and N.catid=" + catID; int maxNews = 5; if (Settings["Trang"] != null) try { maxNews = Int32.Parse(Settings["Trang"].ToString()); } catch { } string cmdTxt = string.Format(@"select top {0} ID, Headline, N.Description, ImageUrl, CONVERT(CHAR(11), CreatedDate, 103)+CONVERT(CHAR(5), CreatedDate, 108) AS Date, DesktopViewID, CatName from news_news N join news_category C on N.catid=C.catid where N.published=1 {1} order by createddate desc", maxNews, catID); // Thực thi T-SQL đã nhập if (Settings["Nguon"].ToString() == "SQL" && Settings["SQL"] != null) cmdTxt = Settings["SQL"].ToString(); DataSet ds; zClass ob = new zClass(); catID = ob.zSelectNone(cmdTxt, out ds); try { DataColumn dc = new DataColumn("Link"); ds.Tables[0].Columns.Add(dc); ds.Tables[0].AcceptChanges(); foreach (DataRow dr in ds.Tables[0].Rows) { dr.BeginEdit(); dr["Link"] = DotNetNuke.Common.Globals.NavigateURL(Convert.ToInt32(dr[5].ToString()), "", "id/" + dr[0].ToString()); dr.EndEdit(); } lbCatName.Text = ds.Tables[0].Rows[0][6].ToString(); gvCatList.DataSource = ds; gvCatList.DataBind(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { // Get Data DataTable dt, dtTemp; string nguon = "NEW", catName, catLink; if (Settings["Nguon"] != null) nguon = Settings["Nguon"].ToString(); zClass ob = new zClass(); //dt = ob.nsHOME(nguon, out dtTemp, out catName, out catLink); dt = ob.news_getNewsByCatID(nguon, out dtTemp, out catName, out catLink); // Bind Data try { txtCAT.Text = catName; txtCAT.NavigateUrl = catLink; txtIMG.ImageUrl = dt.Rows[0][2].ToString(); txtTITLE.Text = dt.Rows[0][1].ToString(); txtTITLE.NavigateUrl = dt.Rows[0][4].ToString(); txtDESCRIP.Text = dt.Rows[0][3].ToString(); imgNew.Visible = Int32.Parse(dt.Rows[0]["DD"].ToString()) <= 3; if (dtTemp.Rows.Count > 0) { hl1st.Text = dtTemp.Rows[0][1].ToString(); hl1st.NavigateUrl = dtTemp.Rows[0][2].ToString(); imgNew1.Visible = Int32.Parse(dtTemp.Rows[0]["DD"].ToString()) <= 3; } if (dtTemp.Rows.Count > 1) { hl2nd.Text = dtTemp.Rows[1][1].ToString(); hl2nd.NavigateUrl = dtTemp.Rows[1][2].ToString(); imgNew2.Visible = Int32.Parse(dtTemp.Rows[1]["DD"].ToString()) <= 3; } if (dtTemp.Rows.Count > 2) { hl3rd.Text = dtTemp.Rows[2][1].ToString(); hl3rd.NavigateUrl = dtTemp.Rows[2][2].ToString(); imgNew3.Visible = Int32.Parse(dtTemp.Rows[2]["DD"].ToString()) <= 3; } if (dtTemp.Rows.Count > 3) { hl4th.Text = dtTemp.Rows[3][1].ToString(); hl4th.NavigateUrl = dtTemp.Rows[3][2].ToString(); imgNew4.Visible = Int32.Parse(dtTemp.Rows[3]["DD"].ToString()) <= 3; } } catch { } }
public override void LoadSettings() { zClass ob = new zClass(); DataTable dt = ob.GET_CAT_LIST(""); DataRow dr = dt.NewRow(); dr[0] = "ALL"; dr[1] = "All News - Tất cả tin bài"; dt.Rows.InsertAt(dr, 0); DropDownList1.DataSource = dt; DropDownList1.DataTextField = "CatName"; DropDownList1.DataValueField = "CatID"; DropDownList1.DataBind(); try { if (ModuleSettings["Nguon"] != null) DropDownList1.SelectedValue = ModuleSettings["Nguon"].ToString(); if (ModuleSettings["TuyChon"] != null) RadioButtonList1.SelectedValue = ModuleSettings["TuyChon"].ToString(); } catch { } }
public string bind_jFlow() { string jFlow = @"<div id='slides'>"; string rowText = ""; string catID = "ALL"; if (Settings["Nguon"] != null) catID = Settings["Nguon"].ToString(); string option = "0"; if (Settings["TuyChon"] != null) option = Settings["TuyChon"].ToString(); zClass ob = new zClass(); DataSet ds = ob.nsGetNews(catID, option); foreach (DataRow dr in ds.Tables[0].Rows) { rowText = "<div class='slide-wrapper'><div class='slide-thumbnail'><img src='" + dr[2].ToString() + "' /></div><div class='slide-details'><h2><a href='" + dr[1].ToString() + "' class='notLink'>" + dr[0].ToString() + "</a></h2><div class='description'>" + dr[3].ToString() + "</div></div><div class='clear'></div></div>"; jFlow += rowText; } jFlow += "</div>"; return jFlow; }
protected void Page_Load(object sender, EventArgs e) { try { string catID = "ALL", option = "0"; ; if (Settings["Nguon"] != null) catID = Settings["Nguon"].ToString(); if (Settings["TuyChon"] != null) option = Settings["TuyChon"].ToString(); zClass ob = new zClass(); DataTable dt = ob.nsHOT(catID, option); // Row 0 hl1.Text = dt.Rows[0][1].ToString(); hl1.NavigateUrl = dt.Rows[0][4].ToString(); img1.ImageUrl = dt.Rows[0][2].ToString(); hl11.Text = dt.Rows[0][1].ToString(); hl11.NavigateUrl = dt.Rows[0][4].ToString(); img11.ImageUrl = dt.Rows[0][2].ToString(); // Row 1 hl2.Text = dt.Rows[1][1].ToString(); hl2.NavigateUrl = dt.Rows[1][4].ToString(); img2.ImageUrl = dt.Rows[1][2].ToString(); hl22.Text = dt.Rows[1][1].ToString(); hl22.NavigateUrl = dt.Rows[1][4].ToString(); img22.ImageUrl = dt.Rows[1][2].ToString(); // Row 2 hl3.Text = dt.Rows[2][1].ToString(); hl3.NavigateUrl = dt.Rows[2][4].ToString(); img3.ImageUrl = dt.Rows[2][2].ToString(); hl33.Text = dt.Rows[2][1].ToString(); hl33.NavigateUrl = dt.Rows[2][4].ToString(); img33.ImageUrl = dt.Rows[2][2].ToString(); // Row 3 hl4.Text = dt.Rows[3][1].ToString(); hl4.NavigateUrl = dt.Rows[3][4].ToString(); img4.ImageUrl = dt.Rows[3][2].ToString(); hl44.Text = dt.Rows[3][1].ToString(); hl44.NavigateUrl = dt.Rows[3][4].ToString(); img44.ImageUrl = dt.Rows[3][2].ToString(); } catch { } }