protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (this.FormCheck())
            {
                try
                {
                    string sqlCheck = string.Format("select count(*) from TB_GoodsSmType where GoodTypeSmName='{0}' and Id<>{1}", txtInvName.Text, Request["Id"]);
                    if (Convert.ToInt32(DBHelp.ExeScalar(sqlCheck)) > 0)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('小类[{0}],已经存在!');</script>", txtInvName.Text));
                        return;
                    }

                    TB_GoodsSmType per = getModel();
                    if (this.invSer.Update(per))
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>");
                    }
                    else
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                TB_GoodsTypeService typeSer = new TB_GoodsTypeService();
                List <TB_GoodsType> allType = typeSer.GetListArray("");
                ddlGoodType.DataSource = allType;
                ddlGoodType.DataBind();
                ddlGoodType.DataTextField  = "GoodTypeName";
                ddlGoodType.DataValueField = "GoodTypeName";

                if (base.Request["Id"] != null)
                {
                    this.btnAdd.Visible = false;
                    TB_GoodsSmType model = this.invSer.GetModel(Convert.ToInt32(base.Request["Id"]));


                    this.txtInvName.Text = model.GoodTypeSmName;
                    if (model.GoodTypeName != null)
                    {
                        ddlGoodType.SelectedValue = model.GoodTypeName.ToString();
                    }
                }
                else
                {
                    this.btnUpdate.Visible = false;
                }
            }
        }