using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 WTOSYSadmin_System_SysUserHeYue : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WtoRightName"] == null)
        {
            Response.Redirect("~/SYSADMIN/main/error.aspx?err=非法登陆!或系统超时，请刷新后重新登录");
        }
        if (!IsPostBack)
        {
            this.databind();
        }
    }
    protected void databind()
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd = new SqlCommand("select AgreementTitle,Agreement from SystemBasicInformation", conn);
        SqlDataReader sdr = smd.ExecuteReader();
        sdr.Read();
        this.AgreementTitle.Text = sdr.GetString(0);
        this.Agreement.Text =Server.HtmlDecode(sdr.GetString(1));

    }

    protected void LinkButton1_Click1(object sender, EventArgs e)
    {
        //设置值
        string AgreementTitle, Agreement;
        //文本框取值

        AgreementTitle = this.AgreementTitle.Text;
        Agreement = Server.HtmlEncode(this.Agreement.Text.Replace("'", "''")).Replace("\n", "<br />");

        string sqlstr = "update SystemBasicInformation set AgreementTitle='" + AgreementTitle + "',Agreement='" + Agreement + "'";
        if (Doadmin.Exec(sqlstr))
        {
            Response.Write("<script>alert('更改成功!');window.location.href='SysUserHeYue.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('操作失败');window.location.href='SysUserHeYue.aspx'</script>");
        }
    }
}
