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_PackagelbAdd : 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)
        {

            SqlConnection conn = CDatabase.wtoconn();
            conn.Open();
            SqlCommand smd = new SqlCommand("select * from PackageCategory where id="+Request.QueryString["id"], conn);
            SqlDataReader sdr = smd.ExecuteReader();
            sdr.Read();
            this.txtid.Text=sdr["id"].ToString();
            this.txtname.Text = sdr["BigCategory"].ToString();
            TextBox1.Text = sdr["Sort"].ToString();
            sdr.Close();
            conn.Close();
        }

    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        this.txtid.Text = "";
        this.txtname.Text = "";
        this.TextBox1.Text = "";
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        if (Doadmin.Exec("update  PackageCategory set id=" + this.txtid.Text + ",BigCategory='" + this.txtname.Text + "',Sort=" + TextBox1.Text +" where id="+Request.QueryString["id"]))
        {
            Response.Write("<script>alert('修改成功');window.location.href='Packagemag.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('修改失败');window.location.href='PackagelbEDIT.aspx'</script>");
        }
    }
}
