index.aspx.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:8k
源码类别:

Email客户端

开发平台:

Visual C++

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;
  10. using System.Data.SqlClient;
  11. public partial class _Default : System.Web.UI.Page 
  12. {
  13.     BaseClass bc = new BaseClass();
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (Session["changeDate"] != String.Empty)
  17.         {
  18.             //    //时政要闻fff
  19.             //    dlSZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时政要闻'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  20.             //    dlSZ.DataKeyField = "id";
  21.             //    dlSZ.DataBind();
  22.             //    //经济动向
  23.             //    dlJJ.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '经济动向'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  24.             //    dlJJ.DataKeyField = "id";
  25.             //    dlJJ.DataBind();
  26.             //    //世界军事
  27.             //    dlJS.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '世界军事'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  28.             //    dlJS.DataKeyField = "id";
  29.             //    dlJS.DataBind();
  30.             //    //科学教育
  31.             //    dlJY.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '科学教育'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  32.             //    dlJY.DataKeyField = "id";
  33.             //    dlJY.DataBind();
  34.             //    //法制道德
  35.             //    dlFZ.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '法治道德'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  36.             //    dlFZ.DataKeyField = "id";
  37.             //    dlFZ.DataBind();
  38.             //    //社会现象
  39.             //    dlSH.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '社会现象'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  40.             //    dlSH.DataKeyField = "id";
  41.             //    dlSH.DataBind();
  42.             //    //体育世界
  43.             //    dlTY.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '体育世界'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  44.             //    dlTY.DataKeyField = "id";
  45.             //    dlTY.DataBind();
  46.             //    //时尚娱乐
  47.             //    dlYL.DataSource = bc.GetDataSet("SELECT TOP 8 * FROM tbNews WHERE (Style = '时尚娱乐'and issueDate='" + Session["changeDate"].ToString() + "')", "tbNews");
  48.             //    dlYL.DataKeyField = "id";
  49.             //    dlYL.DataBind();
  50.             //    Session["changeDate"]= String.Empty;
  51.             //    return;
  52.             //}
  53.             //时政要闻
  54.             dlSZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时政要闻'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  55.             dlSZ.DataKeyField = "id";
  56.             dlSZ.DataBind();
  57.             //经济动向
  58.             dlJJ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '经济动向'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  59.             dlJJ.DataKeyField = "id";
  60.             dlJJ.DataBind();
  61.             //世界军事
  62.             dlJS.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '世界军事'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  63.             dlJS.DataKeyField = "id";
  64.             dlJS.DataBind();
  65.             //科学教育
  66.             dlJY.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '科学教育'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  67.             dlJY.DataKeyField = "id";
  68.             dlJY.DataBind();
  69.             //法制道德
  70.             dlFZ.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '法治道德'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  71.             dlFZ.DataKeyField = "id";
  72.             dlFZ.DataBind();
  73.             //社会现象
  74.             dlSH.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '社会现象'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  75.             dlSH.DataKeyField = "id";
  76.             dlSH.DataBind();
  77.             //体育世界
  78.             dlTY.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '体育世界'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  79.             dlTY.DataKeyField = "id";
  80.             dlTY.DataBind();
  81.             //时尚娱乐
  82.             dlYL.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbNews WHERE (Style = '时尚娱乐'and issueDate='" + DateTime.Today.ToString() + "')", "tbNews");
  83.             dlYL.DataKeyField = "id";
  84.             dlYL.DataBind();
  85.         }
  86.     }
  87.     protected void dlSZ_ItemCommand(object source, DataListCommandEventArgs e)
  88.     {
  89.         string id = dlSZ.DataKeys[e.Item.ItemIndex].ToString();
  90.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  91.     }
  92.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  93.     {
  94.         if (e.Row.RowType == DataControlRowType.DataRow)
  95.        {
  96.           // e.Row.RowType == DataControlCellType.DataCell;
  97.            if (e.Row.Cells[0].Text == "时尚娱乐")
  98.            {
  99.               string str = e.Row.Cells[1].Text;
  100.               e.Row.Cells[1].Text = bc.SubStr(str, 8);
  101.            }
  102.            else
  103.            {
  104.               e.Row.Cells[1].Text = "<font color=red>已审核</font>";
  105.             }
  106.         }
  107.     }
  108.     protected void dlJJ_ItemCommand(object source, DataListCommandEventArgs e)
  109.     {
  110.         string id = dlJJ.DataKeys[e.Item.ItemIndex].ToString();
  111.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  112.     }
  113.     protected void dlJS_ItemCommand(object source, DataListCommandEventArgs e)
  114.     {
  115.         string id = dlJS.DataKeys[e.Item.ItemIndex].ToString();
  116.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  117.     }
  118.     protected void dlJY_ItemCommand(object source, DataListCommandEventArgs e)
  119.     {
  120.         string id = dlJY.DataKeys[e.Item.ItemIndex].ToString();
  121.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  122.     }
  123.     protected void dlFZ_ItemCommand(object source, DataListCommandEventArgs e)
  124.     {
  125.         string id = dlFZ.DataKeys[e.Item.ItemIndex].ToString();
  126.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  127.     }
  128.     protected void dlTY_ItemCommand(object source, DataListCommandEventArgs e)
  129.     {
  130.         string id = dlTY.DataKeys[e.Item.ItemIndex].ToString();
  131.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  132.     }
  133.     protected void dlYL_ItemCommand(object source, DataListCommandEventArgs e)
  134.     {
  135.         string id = dlYL.DataKeys[e.Item.ItemIndex].ToString();
  136.         Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
  137.     }
  138. }