using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class goods_newClassification : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {



        }
    }
    protected void Btnok_Click(object sender, EventArgs e)
    {
        SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["constring"].ConnectionString);
        if (Texname.Text == "" || Texname.Text == null)
        {
            Response.Write("<script>alert('分类名称不能为空！')</script>");
            return;

        }
        int intstate;
        string strname;
        strname = Texname.Text;
        if (Radio1.Checked == true)
        {
            intstate = 0;
        }
        else
        {
            intstate = 1;
        }
        string sql = "INSERT INTO tabG_Classification( Classificationname,State ) values( '" + strname + "','" + intstate + "')";

        SqlCommand cmd = new SqlCommand(sql, sqlcon);
        sqlcon.Open();
        cmd.ExecuteNonQuery();
        sqlcon.Close();

        Response.Write("<script>alert('添加成功！')</script>");

        Response.Redirect("goodsClassification.aspx");


    }
    protected void btncz_Click(object sender, EventArgs e)
    {
        Texname.Text = "";
        Radio1.Checked = true;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("goodsClassification.aspx");
    }
}
