index.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:8k
源码类别:
Email客户端
开发平台:
Visual C++
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class _Default : System.Web.UI.Page
- {
- BaseClass bc = new BaseClass();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["changeDate"] != String.Empty)
- {
- // //时政要闻fff
- // dlSZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时政要闻'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlSZ.DataKeyField = "id";
- // dlSZ.DataBind();
- // //经济动向
- // dlJJ.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '经济动向'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlJJ.DataKeyField = "id";
- // dlJJ.DataBind();
- // //世界军事
- // dlJS.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '世界军事'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlJS.DataKeyField = "id";
- // dlJS.DataBind();
- // //科学教育
- // dlJY.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '科学教育'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlJY.DataKeyField = "id";
- // dlJY.DataBind();
- // //法制道德
- // dlFZ.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '法治道德'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlFZ.DataKeyField = "id";
- // dlFZ.DataBind();
- // //社会现象
- // dlSH.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '社会现象'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlSH.DataKeyField = "id";
- // dlSH.DataBind();
- // //体育世界
- // dlTY.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '体育世界'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlTY.DataKeyField = "id";
- // dlTY.DataBind();
- // //时尚娱乐
- // dlYL.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '时尚娱乐'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
- // dlYL.DataKeyField = "id";
- // dlYL.DataBind();
- // Session["changeDate"]= String.Empty;
- // return;
- //}
- //时政要闻
- dlSZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时政要闻'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlSZ.DataKeyField = "id";
- dlSZ.DataBind();
- //经济动向
- dlJJ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '经济动向'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlJJ.DataKeyField = "id";
- dlJJ.DataBind();
- //世界军事
- dlJS.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '世界军事'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlJS.DataKeyField = "id";
- dlJS.DataBind();
- //科学教育
- dlJY.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '科学教育'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlJY.DataKeyField = "id";
- dlJY.DataBind();
- //法制道德
- dlFZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '法治道德'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlFZ.DataKeyField = "id";
- dlFZ.DataBind();
- //社会现象
- dlSH.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '社会现象'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlSH.DataKeyField = "id";
- dlSH.DataBind();
- //体育世界
- dlTY.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '体育世界'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlTY.DataKeyField = "id";
- dlTY.DataBind();
- //时尚娱乐
- dlYL.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时尚娱乐'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
- dlYL.DataKeyField = "id";
- dlYL.DataBind();
- }
- }
- protected void dlSZ_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlSZ.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- // e.Row.RowType == DataControlCellType.DataCell;
- if (e.Row.Cells[0].Text == "时尚娱乐")
- {
- string str = e.Row.Cells[1].Text;
- e.Row.Cells[1].Text = bc.SubStr(str, 8);
- }
- else
- {
- e.Row.Cells[1].Text = "<font color=red>已审核</font>";
- }
- }
- }
- protected void dlJJ_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlJJ.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void dlJS_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlJS.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void dlJY_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlJY.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void dlFZ_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlFZ.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void dlTY_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlTY.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void dlYL_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dlYL.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- }