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_Products_SySEmailEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {        string lx, id;
        lx=Request.QueryString["lx"];
        switch (lx)
        { 
            case "1":
                this.title.Text = "会员注册";
                break;
            case "2":
                this.title.Text = "找回密码";
                break;
            case "3":
                this.title.Text = "修改用户信息";
                break;
            case "4":
                this.title.Text = "下单完成";
                break;
            case "5":
                this.title.Text = "发货通知";
                break;
            case "6":
                this.title.Text = "好友推荐";
                break;
            case "7":
                this.title.Text = "留言回复";
                break;

        }
        if (!IsPostBack)
        {
            this.databind();
        }
    }
    protected void databind()
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd = new SqlCommand("select * from email where lx='"+Request.QueryString["lx"]+"' and id="+Request.QueryString["id"],conn);
        SqlDataReader sdr = smd.ExecuteReader();
        sdr.Read();
        this.zt.Text = sdr.GetString(10);
        this.Content.Text = Server.HtmlDecode(sdr.GetString(6));

        sdr.Close();
        conn.Close();
    }

    protected void goemail_Click(object sender, EventArgs e)
    {
        string sqlstr = "update email set title='" + this.zt.Text + "',content='" + (Server.HtmlEncode(this.Content.Text.Replace("'", "''"))).Replace("\n", "<br />")+ "'  where lx='" + Request.QueryString["lx"] + "' and id=" + Request.QueryString["id"];
        if (Doadmin.Exec(sqlstr))
        {
            Response.Write("<script>alert('操作成功');window.location.href='../email/SYSemail.aspx'</script>");
        }
    }
}
