//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); if (this.txtop.Value == "add") { //先判断这个模块编号是否已经存在 DataTable dt = Hyoa_mudel.Getmudel(this.txtmudelid.Value); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该模块编号已存在,请重新填写!');history.back();</script>"); return; } if(this.txtid.Text.Length<6) { Response.Write("<script>alert('模块编号长度必须大于5位!');history.back();</script>"); return; } if (this.txtid.Text.Substring(0, 5) != "Mudel") { Response.Write("<script>alert('模块编号必须以Mudel开头!');history.back();</script>"); return; } Hyoa_mudel.hy_mudelid = this.txtid.Text; Hyoa_mudel.hy_mudelname = this.txtname.Value; Hyoa_mudel.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_mudel.hy_isenabled = this.ddlisenabled.SelectedValue; Hyoa_mudel.hy_roleid = this.ddlrole.SelectedValue; Hyoa_mudel.hy_qqroleid = this.ddlqqrole.SelectedValue; Hyoa_mudel.Insert(); } else { Hyoa_mudel.hy_mudelid = this.txtid.Text; Hyoa_mudel.hy_mudelname = this.txtname.Value; Hyoa_mudel.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_mudel.hy_isenabled = this.ddlisenabled.SelectedValue; Hyoa_mudel.hy_roleid = this.ddlrole.SelectedValue; Hyoa_mudel.hy_qqroleid = this.ddlqqrole.SelectedValue; Hyoa_mudel.Update(); } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }