protected void btnAdd_Click(object sender, EventArgs e) { if (tbxAddproname.Text != "") { Property property = new Property(); GA gAdmin = new GA(); ThirdClassDm thirdclassdm = new ThirdClassDm(); thirdclassdm.ThirdClassDmName = this.drpThirdclass.SelectedItem.Text; thirdclassdm.ThirdClassDmID = gAdmin.TcNameGetID(thirdclassdm); property.PropertyName = this.tbxAddproname.Text; property.PropertyID = gAdmin.PoNameGetID(property); if (gAdmin.PoIsRepeat(property) == true) //判断属性名字是否重复 TRUE为不重复 { if (gAdmin.AddProperty(thirdclassdm, property) == true) //判断添加属性和绑定关系是否成功 { this.lblCheck.Text = "添加成功!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加成功" + "');</script>"); } else { this.lblCheck.Text = "添加失败!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加失败" + "');</script>"); } } else { if (gAdmin.IsTcPoComb(property, thirdclassdm) == true) //判断存不存在绑定关系 TRUE为不存在 { if (gAdmin.AddTcPoComb(property, thirdclassdm) == true) //判断添加绑定关系是否成功 { this.lblCheck.Text = "添加成功"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加成功" + "');</script>"); } else { this.lblCheck.Text = "添加失败"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加失败" + "');</script>"); } } else { this.lblCheck.Text = "三级类目已经绑定了该属性!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "三级类目已经绑定了该属性" + "');</script>"); } } } else { this.lblCheck.Text = "添加不能为空!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加不能为空" + "');</script>"); } }