예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        string  ST_cmd_sql  = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_date desc";
        string  ST_top_sql  = "select top 10 * from ST_news order by ST_n_hit desc";
        string  personindex = "select top 10* from ST_news order by ST_n_id desc";
        string  TitleClass  = "select ST_c_id, ST_c_name from ST_class order by ST_date desc";
        DataSet ST_classds  = myobj.GetDataSet(TitleClass, "ST_class");
        DataSet ST_cmdds    = myobj.GetDataSet(ST_cmd_sql, "ST_news");
        DataSet ST_topds    = myobj.GetDataSet(ST_top_sql, "ST_news");
        DataSet mypersonds  = myobj.GetDataSet(personindex, "ST_class");

        //绑定博客文章类型列表
        ClassList.DataSource = new DataView(ST_classds.Tables[0]);
        ClassList.DataBind();

        //绑定推荐文章列表
        CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
        CmdList.DataBind();

        //绑定热点文章列表
        TopList.DataSource = new DataView(ST_topds.Tables[0]);
        TopList.DataBind();


        //绑定最新个人最新发表的博客文章
        ClassList0.DataSource = new DataView(mypersonds.Tables[0]);
        ClassList0.DataBind();
        if (Request.QueryString["c_id"] == null)
        {
            person_BindData();
        }
        else
        {
            NewsBlogList_Bind();
        }


        if (Request.Cookies["colors"] != null)
        {
            string   ST_test      = Request.Cookies["colors"].Value;
            String[] ST_colorList = ST_test.Split(new[] { ',' });
            ST_bgcolor = ST_colorList[0];
            ST_tcolor  = ST_colorList[1];
        }
        else
        {
            ST_bgcolor = "#FFFFFF";
            ST_tcolor  = "#cccccc";
        }
        Page.DataBind();
        string rd = DateTime.Now.Ticks.ToString();

        str = "imgFile/1.jpg?rd=" + rd + "|imgFile/2.jpg?rd=" + rd + "|imgFile/3.jpg?rd=" + rd + "|imgFile/4.jpg?rd=" +
              rd + "";
        string path = Server.MapPath("./") + "imgFile/LoopId.txt";

        loopId = File.ReadAllText(path);
        loopId = loopId.Replace(',', '|');
    }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (IsSafe(Request.QueryString["id"], 2) == false)
            {
                Response.Write("非法参数,<a href=BlogIndex.aspx>点此返回</a>");
                Response.End();
            }
            string ST_dns = ConfigurationSettings.AppSettings["conStr"];
            string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + "";
            //最新推荐文章
            string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc";

            ST_myConn = new SqlConnection(ST_dns);
            SqlDataAdapter ST_myCmd    = new SqlDataAdapter(ST_sql, ST_myConn);
            SqlDataAdapter ST_classCmd = new SqlDataAdapter("select ST_c_id,ST_c_name from ST_class", ST_myConn);
            SqlDataAdapter ST_cmdCmd   = new SqlDataAdapter(ST_cmd_sql, ST_myConn);

            DataSet ST_ds = new DataSet();

            ST_myCmd.Fill(ST_ds, "新闻查看");

            DataSet ST_classds = new DataSet();

            ST_classCmd.Fill(ST_classds, "类别列表");

            DataSet ST_cmdds = new DataSet();

            ST_cmdCmd.Fill(ST_cmdds, "推荐文章");

            NewsShow.DataSource = ST_ds.Tables[0];
            NewsShow.DataBind();

            ClassList.DataSource = new DataView(ST_classds.Tables[0]);
            ClassList.DataBind();

            CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
            CmdList.DataBind();
            //调用ST_UpdateHit()方法
            ST_UpdateHit();
            if (Request.Cookies["colors"] != null)
            {
                string   ST_test      = Request.Cookies["colors"].Value;
                String[] ST_colorList = ST_test.Split(new char[] { ',' });
                ST_bgcolor = ST_colorList[0];
                ST_tcolor  = ST_colorList[1];
            }
            else
            {
                ST_bgcolor = "#FFDE94";
                ST_tcolor  = "#efe3ce";
            }
            Page.DataBind();
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (IsSafe(Request.QueryString["id"], 2) == false)
            {
                Response.Write("错误页面,<a href=BlogIndex.aspx>点此返回</a>");
                Response.End();
            }
            string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + "";
            //最新推荐文章
            string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc";

            string  sqlstr = "select ST_c_id,ST_c_name from ST_class";
            DataSet ST_ds  = myobj.GetDataSet(ST_sql, "ST_news");

            DataSet ST_classds = myobj.GetDataSet(sqlstr, "ST_class");

            DataSet ST_cmdds = myobj.GetDataSet(ST_cmd_sql, "ST_news");

            NewsShow.DataSource = ST_ds.Tables[0];
            NewsShow.DataBind();

            ClassList.DataSource = new DataView(ST_classds.Tables[0]);
            ClassList.DataBind();

            CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
            CmdList.DataBind();
            //调用ST_UpdateHit()方法
            ST_UpdateHit();
            if (Request.Cookies["colors"] != null)
            {
                string   ST_test      = Request.Cookies["colors"].Value;
                String[] ST_colorList = ST_test.Split(new[] { ',' });
                ST_bgcolor = ST_colorList[0];
                ST_tcolor  = ST_colorList[1];
            }
            else
            {
                ST_bgcolor = "#FFFFFF";
                ST_tcolor  = "#cccccc";
            }
            Page.DataBind();
        }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        string ST_dns = ConfigurationSettings.AppSettings["conStr"];
        //最新推荐文章
        string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_date desc";

        ST_myConn = new SqlConnection(ST_dns);
        SqlDataAdapter ST_classCmd = new SqlDataAdapter("select ST_c_id, ST_c_name from ST_class ", ST_myConn);
        SqlDataAdapter ST_cmdCmd   = new SqlDataAdapter(ST_cmd_sql, ST_myConn);
        DataSet        ST_classds  = new DataSet();

        ST_classCmd.Fill(ST_classds, "类别列表");
        DataSet ST_cmdds = new DataSet();

        ST_cmdCmd.Fill(ST_cmdds, "推荐文章");

        ClassList.DataSource = new DataView(ST_classds.Tables[0]);
        ClassList.DataBind();

        CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
        CmdList.DataBind();
        //调用自定义NewsBlogList_Bind方法
        NewsBlogList_Bind();
        if (Request.Cookies["colors"] != null)
        {
            string   ST_test      = Request.Cookies["colors"].Value;
            String[] ST_colorList = ST_test.Split(new char[] { ',' });
            ST_bgcolor = ST_colorList[0];
            ST_tcolor  = ST_colorList[1];
        }
        else
        {
            ST_bgcolor = "#FFDE94";
            ST_tcolor  = "#efe3ce";
        }
        Page.DataBind();
    }