//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); Hyoa_tableconfig.ID = this.txtdocid.Text; Hyoa_tableconfig.hy_mudelid = this.ddlmudelid.SelectedValue.ToString(); Hyoa_tableconfig.hy_name = this.txtname.Value; Hyoa_tableconfig.hy_onload = this.txthy_onload.Text; Hyoa_tableconfig.hy_sort = float.Parse(this.txtsort.Value); Hyoa_tableconfig.hy_ifflowdoc = this.ddlifflowdoc.SelectedValue; Hyoa_tableconfig.hy_ifdisplayall = this.ddlifdisplayall.SelectedValue; Hyoa_tableconfig.hy_ifcomment = this.ddlifcomment.SelectedValue; Hyoa_tableconfig.hy_ispuballByflowYB = this.ddlispuballByflowYB.SelectedValue; Hyoa_tableconfig.hy_tablerole = this.ddltablerole.SelectedValue; Hyoa_tableconfig.hy_colnum = float.Parse(this.ddldisplaycol.SelectedValue); Hyoa_tableconfig.hy_field1 = ""; Hyoa_tableconfig.hy_field2 = ""; Hyoa_tableconfig.hy_field3 = ""; Hyoa_tableconfig.hy_field4 = ""; Hyoa_tableconfig.hy_field5 = ""; if (this.txtop.Value == "add") { //先判断是否已经存在 DataTable dt = Hyoa_tableconfig.GetTable(this.txtdocid.Text); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该表单编号已存在,请重新填写!');history.back();</script>"); return; } if (this.txtdocid.Text.Length < 6) { Response.Write("<script>alert('表单编号长度必须大于5位!');history.back();</script>"); return; } if (this.txtdocid.Text.Substring(0, 5) != "Table") { Response.Write("<script>alert('表单编号必须以Table开头!');history.back();</script>"); return; } Hyoa_tableconfig.Insert(); //创建SQL表 if (CreateSQLTable()==false) { ls_tip = "生成表结构失败,请联系管理员!"; } } else { Hyoa_tableconfig.Update(); //修改时,保存完成后同时更新对应的字段中FLOWID值(如果非流程则置为空,如果是流程则置为值) HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); if (this.ddlifflowdoc.SelectedValue == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.ddlmudelid.SelectedValue); if (dt_flow.Rows.Count > 0) { Hyoa_flowfield.Updateflowid_For_tacheconfig(dt_flow.Rows[0]["hy_flowid"].ToString(), this.txtdocid.Text); } } else { Hyoa_flowfield.Updateflowid_For_tacheconfig("", this.txtdocid.Text); } //修改后,同时更新对应的字段中的模块ID,为了解决当表单中对应的模块修改后,字段中没有更新的BUG Hyoa_flowfield.Updatemudelid_For_tableconfig(this.ddlmudelid.SelectedValue, this.txtdocid.Text); } //处理完成后的提示及跳转 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>"); } }