示例#1
0
    public List <liuyan> viewAll()
    {
        List <liuyan> list = new List <liuyan>();

        con.Open();
        cmd = new SqlCommand("select * from liuyantable order by liuyan_time desc", con);
        SqlDataReader sdr = cmd.ExecuteReader();
        liuyan        ac;

        while (sdr.Read())
        {
            ac    = new liuyan();
            ac.id = sdr["ID"].ToString();

            ac.author = sdr["CNAME"].ToString();

            ac.content = sdr["liuyan_content"].ToString();

            ac.huifu = sdr["LIUYAN_HUIFU"].ToString();

            ac.huifutime = Convert.ToDateTime(sdr["LIUYAN_HUIFU_TIME"]);
            ac.time      = Convert.ToDateTime(sdr["LIUYAN_TIME"]);

            list.Add(ac);
        }
        sdr.Close();
        con.Close();
        return(list);
    }
示例#2
0
 protected void Btn_summit_Click(object sender, EventArgs e)
 {
     liuyan ly = new liuyan();
     LiuyanOperation lyop = new LiuyanOperation();
     ly.author = TextBox1.Text.ToString();
     ly.content = FCKeditor1.Value.ToString();
     lyop.insert_ly(ly);
     this.Data_list_liuyan.DataBind();
     Response.Redirect("liuyan.aspx");
 }
示例#3
0
    protected void Btn_summit_Click(object sender, EventArgs e)
    {
        liuyan          ly   = new liuyan();
        LiuyanOperation lyop = new LiuyanOperation();

        ly.author  = TextBox1.Text.ToString();
        ly.content = FCKeditor1.Value.ToString();
        lyop.insert_ly(ly);
        this.Data_list_liuyan.DataBind();
        Response.Redirect("liuyan.aspx");
    }
示例#4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     id = Request.QueryString["id"].ToString();
     liuyan ly = new liuyan();
     LiuyanOperation lyo = new LiuyanOperation();
     ly = lyo.getByAid(id);
     string t = TextBox1.Text.ToString();
     ly.huifu = t;
     bool b=lyo.update(ly);
     if (b)
         Response.Write("回复更新成功!");
     Response.Redirect("../Liuyan.aspx");
 }
示例#5
0
 //获取文章内容
 public liuyan getByAid(string aid)
 {
     con.Open();
     cmd = new SqlCommand("select * from liuyantable where id='" + aid + "'", con);
     SqlDataReader dr = cmd.ExecuteReader();
     liuyan ac = null;
     while (dr.Read())
     {
         ac = new liuyan(dr);
     }
     con.Close();
     return ac;
 }
示例#6
0
    public liuyan getByAid(string aid)//获取文章内容
    {
        con.Open();
        cmd = new SqlCommand("select * from liuyantable where id='" + aid + "'", con);
        SqlDataReader dr = cmd.ExecuteReader();
        liuyan        ac = null;

        while (dr.Read())
        {
            ac = new liuyan(dr);
        }
        con.Close();
        return(ac);
    }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             id = Request.QueryString["id"].ToString();
             liuyan          ly  = new liuyan();
             LiuyanOperation lyo = new LiuyanOperation();
             ly            = lyo.getByAid(id);
             TextBox1.Text = ly.huifu;
         }
         catch
         { }
     }
 }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {

                id = Request.QueryString["id"].ToString();
                liuyan ly = new liuyan();
                LiuyanOperation lyo = new LiuyanOperation();
                ly = lyo.getByAid(id);
                TextBox1.Text = ly.huifu;
            }
            catch
            { }
        }
    }
示例#9
0
 public bool insert_ly(liuyan at)//插入留言函数!
 {
     con.Open();
     cmd = new SqlCommand("insert into liuyantable(CNAME,LIUYAN_CONTENT) values(@author,@content)", con);
     cmd.Parameters.Add(new SqlParameter("@content", at.content));
     cmd.Parameters.Add(new SqlParameter("@author", at.author));
     if (cmd.ExecuteNonQuery() > 0)
     {
         con.Close();
         return(true);
     }
     else
     {
         con.Close();
         return(false);
     }
 }
示例#10
0
 //插入留言函数!
 public bool insert_ly(liuyan at)
 {
     con.Open();
     cmd = new SqlCommand("insert into liuyantable(CNAME,LIUYAN_CONTENT) values(@author,@content)", con);
     cmd.Parameters.Add(new SqlParameter("@content", at.content));
     cmd.Parameters.Add(new SqlParameter("@author", at.author));
     if (cmd.ExecuteNonQuery() > 0)
     {
         con.Close();
         return true;
     }
     else
     {
         con.Close();
         return false;
     }
 }
示例#11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        id = Request.QueryString["id"].ToString();
        liuyan          ly  = new liuyan();
        LiuyanOperation lyo = new LiuyanOperation();

        ly = lyo.getByAid(id);
        string t = TextBox1.Text.ToString();

        ly.huifu = t;
        bool b = lyo.update(ly);

        if (b)
        {
            Response.Write("回复更新成功!");
        }
        Response.Redirect("../Liuyan.aspx");
    }
示例#12
0
 public bool update(liuyan ac)
 {
     con.Open();
     cmd = new SqlCommand("update liuyantable set liuyan_huifu=@huifu where id=@aid", con);
     cmd.Parameters.Add(new SqlParameter("@aid", ac.id));
     cmd.Parameters.Add(new SqlParameter("@huifu", ac.huifu));
     // cmd.Parameters.Add(new SqlParameter("@huifu_time", ac.huifutime));
     if (cmd.ExecuteNonQuery() > 0)
     {
         con.Close();
         return(true);
     }
     else
     {
         con.Close();
         return(false);
     }
 }
示例#13
0
 public bool update(liuyan ac)
 {
     con.Open();
     cmd = new SqlCommand("update liuyantable set liuyan_huifu=@huifu where id=@aid", con);
     cmd.Parameters.Add(new SqlParameter("@aid", ac.id));
     cmd.Parameters.Add(new SqlParameter("@huifu", ac.huifu));
        // cmd.Parameters.Add(new SqlParameter("@huifu_time", ac.huifutime));
     if (cmd.ExecuteNonQuery() > 0)
     {
         con.Close();
         return true;
     }
     else
     {
         con.Close();
         return false;
     }
 }
示例#14
0
    public List<liuyan> viewAll()
    {
        List<liuyan> list = new List<liuyan>();
        con.Open();
        cmd = new SqlCommand("select * from liuyantable order by liuyan_time desc", con);
        SqlDataReader sdr = cmd.ExecuteReader();
        liuyan ac;
        while (sdr.Read())
        {
            ac = new liuyan();
            ac.id = sdr["ID"].ToString();

            ac.author = sdr["CNAME"].ToString();

            ac.content = sdr["liuyan_content"].ToString();

            ac.huifu = sdr["LIUYAN_HUIFU"].ToString();

            ac.huifutime = Convert.ToDateTime(sdr["LIUYAN_HUIFU_TIME"]);
            ac.time = Convert.ToDateTime(sdr["LIUYAN_TIME"]);

            list.Add(ac);
        }
        sdr.Close();
        con.Close();
        return list;
    }