protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { //找到字段配置信息 DataTable dt = Hyoa_flowfield.Getflowfield(v_uids[i]); //删除SQL中的字段 string sql = "ALTER TABLE hyc_" + this.txttableid.Value; sql += " DROP COLUMN hyc_" + dt.Rows[0]["hy_fieldid"].ToString(); Hyoa_global.ExcuteSQL(sql); Hyoa_flowfield.ID = v_uids[i]; Hyoa_flowfield.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
private void DataPlay() { //加载可选择的表 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 //判断当前用户是否有保存的权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; //保存 } else { this.btn_submit.Visible = false; //保存 } //旧文档 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); if (this.Request.QueryString["op"] == "modify") { this.txtdocid.Value = this.Request.QueryString["docid"].ToString(); DataTable dt = Hyoa_flowfield.Getflowfield(this.txtdocid.Value); if (dt.Rows.Count > 0) { this.txttableid.Text = dt.Rows[0]["hy_tableid"].ToString(); this.txtmudelid.Text = dt.Rows[0]["hy_mudelid"].ToString(); //得到流程编号(如果当前字段所在的表单是流程表单,则需要读取FLOWID) DataTable dt_table = Hyoa_tableconfig.GetTable(this.txttableid.Text); if (dt_table.Rows.Count > 0) { if (dt_table.Rows[0]["hy_ifflowdoc"].ToString() == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.txtmudelid.Text); if (dt_flow.Rows.Count > 0) { this.txtflowid.Text = dt_flow.Rows[0]["hy_flowid"].ToString(); } } else { this.txtflowid.Text = ""; } } this.txtfieldid.Text = dt.Rows[0]["hy_fieldid"].ToString(); this.txtfieldid.Enabled = false; this.txtfieldname.Text = dt.Rows[0]["hy_fieldname"].ToString(); this.ddlfieldtype.SelectedValue = dt.Rows[0]["hy_fieldtype"].ToString(); this.txtfieldtype_old.Text = dt.Rows[0]["hy_fieldtype"].ToString(); this.ddlifreadonly.SelectedValue = dt.Rows[0]["hy_ifreadonly"].ToString(); this.ddldefaultvaluetype.SelectedValue = dt.Rows[0]["hy_defaultvaluetype"].ToString(); this.txtdefaultvalue.Text = dt.Rows[0]["hy_defaultvalue"].ToString(); this.ddloptiontype.SelectedValue = dt.Rows[0]["hy_optiontype"].ToString(); this.txtoptions.Text = dt.Rows[0]["hy_options"].ToString(); this.txtonclick.Text = dt.Rows[0]["hy_onclick"].ToString(); this.txtondblclick.Text = dt.Rows[0]["hy_ondblclick"].ToString(); this.txtonchange.Text = dt.Rows[0]["hy_onchange"].ToString(); this.txtonkeydown.Text = dt.Rows[0]["hy_onkeydown"].ToString(); this.txtonkeyup.Text = dt.Rows[0]["hy_onkeyup"].ToString(); this.txtonfocus.Text = dt.Rows[0]["hy_onfocus"].ToString(); this.txtonblur.Text = dt.Rows[0]["hy_onblur"].ToString(); this.txtclass.Text = dt.Rows[0]["hy_class"].ToString(); this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString(); this.txtheight.Text = dt.Rows[0]["hy_height"].ToString(); this.ddltdnums.SelectedValue = dt.Rows[0]["hy_tdnums"].ToString(); this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString(); this.txtwordlimit.Text = dt.Rows[0]["hy_wordlimit"].ToString(); this.ddlrequired.SelectedValue = dt.Rows[0]["hy_required"].ToString(); this.ddlalign.SelectedValue = dt.Rows[0]["hy_align"].ToString(); this.ddlifhiddle.SelectedValue = dt.Rows[0]["hy_ifhiddle"].ToString(); this.ddlifdbsybt.SelectedValue = dt.Rows[0]["hy_ifdbsybt"].ToString(); } dt.Clear(); } else { //得到模块ID DataTable dt = Hyoa_tableconfig.GetTable(this.txttableid.Text); if (dt.Rows.Count > 0) { this.txtmudelid.Text = dt.Rows[0]["hy_mudelid"].ToString(); } else { Response.Write("<script>alert('读取表单信息出错!');history.back();</script>"); } //得到流程编号(如果当前字段所在的表单是流程表单,则需要读取FLOWID) if (dt.Rows[0]["hy_ifflowdoc"].ToString() == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.txtmudelid.Text); if (dt_flow.Rows.Count > 0) { this.txtflowid.Text = dt_flow.Rows[0]["hy_flowid"].ToString(); } } else { this.txtflowid.Text = ""; } //自动获取最大排序号,然后+2 DataTable dt_maxsort = Hyoa_flowfield.GetMaxfieldsortbytable(this.txttableid.Text); if (dt_maxsort.Rows.Count > 0) txtsort.Text = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString(); else txtsort.Text = "1"; } } }
private void DataPlay() { //加载可选择的表 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dt_tableconfig = Hyoa_tableconfig.GetTables(); this.ddlwhichtable.DataSource = dt_tableconfig; this.ddlwhichtable.DataTextField = "hy_name"; this.ddlwhichtable.DataValueField = "ID"; this.ddlwhichtable.DataBind(); this.ddlwhichtable.Items.Insert(0, "--请选择--"); if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 //判断当前用户是否有保存的权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; //保存 } else { this.btn_submit.Visible = false; //保存 } //旧文档 if (this.Request.QueryString["op"] == "modify") { this.txtdocid.Value = this.Request.QueryString["docid"].ToString(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dt = Hyoa_flowfield.Getflowfield(this.txtdocid.Value); if (dt.Rows.Count > 0) { this.txttableid.Text = dt.Rows[0]["hy_tableid"].ToString(); this.txtmudelid.Text = dt.Rows[0]["hy_mudelid"].ToString(); //this.txtflowid.Text = dt.Rows[0]["hy_flowid"].ToString(); //得到流程编号(如果当前字段所在的表单是流程表单,则需要读取FLOWID) DataTable dt_table = Hyoa_tableconfig.GetTable(this.txttableid.Text); if (dt_table.Rows.Count > 0) { if (dt_table.Rows[0]["hy_ifflowdoc"].ToString() == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.txtmudelid.Text); if (dt_flow.Rows.Count > 0) { this.txtflowid.Text = dt_flow.Rows[0]["hy_flowid"].ToString(); } } else { this.txtflowid.Text = ""; } } this.txtfieldid.Text = dt.Rows[0]["hy_fieldid"].ToString(); this.txtfieldname.Text = dt.Rows[0]["hy_fieldname"].ToString(); this.ddlfieldtype.SelectedValue = dt.Rows[0]["hy_fieldtype"].ToString(); this.ddlifreadonly.SelectedValue = dt.Rows[0]["hy_ifreadonly"].ToString(); this.ddldefaultvaluetype.SelectedValue = dt.Rows[0]["hy_defaultvaluetype"].ToString(); this.txtdefaultvalue.Text = dt.Rows[0]["hy_defaultvalue"].ToString(); this.ddloptiontype.SelectedValue = dt.Rows[0]["hy_optiontype"].ToString(); this.txtoptions.Text = dt.Rows[0]["hy_options"].ToString(); this.txtonclick.Text = dt.Rows[0]["hy_onclick"].ToString(); this.txtondblclick.Text = dt.Rows[0]["hy_ondblclick"].ToString(); this.txtonchange.Text = dt.Rows[0]["hy_onchange"].ToString(); this.txtonkeydown.Text = dt.Rows[0]["hy_onkeydown"].ToString(); this.txtonkeyup.Text = dt.Rows[0]["hy_onkeyup"].ToString(); this.txtsqlfield.Text = dt.Rows[0]["hy_sqlfield"].ToString(); this.txtclass.Text = dt.Rows[0]["hy_class"].ToString(); this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString(); this.txtheight.Text = dt.Rows[0]["hy_height"].ToString(); this.ddltdnums.SelectedValue = dt.Rows[0]["hy_tdnums"].ToString(); this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString(); this.txtwordlimit.Text = dt.Rows[0]["hy_wordlimit"].ToString(); this.ddlrequired.SelectedValue = dt.Rows[0]["hy_required"].ToString(); this.ddlalign.SelectedValue = dt.Rows[0]["hy_align"].ToString(); this.ddlifhiddle.SelectedValue = dt.Rows[0]["hy_ifhiddle"].ToString(); } dt.Clear(); } else { //得到模块ID DataTable dt = Hyoa_tableconfig.GetTable(this.txttableid.Text); if (dt.Rows.Count > 0) { this.txtmudelid.Text = dt.Rows[0]["hy_mudelid"].ToString(); } else { Response.Write("<script>alert('读取表单信息出错!');history.back();</script>"); } //得到流程编号(如果当前字段所在的表单是流程表单,则需要读取FLOWID) if (dt.Rows[0]["hy_ifflowdoc"].ToString() == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.txtmudelid.Text); if (dt_flow.Rows.Count > 0) { this.txtflowid.Text = dt_flow.Rows[0]["hy_flowid"].ToString(); } } else { this.txtflowid.Text = ""; } ////得到流程编号 //HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); //DataTable dt_flow = Hyoa_flowinfor.Getflowinforbymudelid(this.txtmudelid.Text); //if (dt_flow.Rows.Count > 0) //{ // this.txtflowid.Text = dt_flow.Rows[0]["hy_flowid"].ToString(); //} } //加载未分配的SQL字段 HyoaClass.DAO db = new HyoaClass.DAO(); DataTable dt_flowmain = db.GetDataTable("exec sp_mshelpcolumns 'hyp_flowmain'"); int j = 0; for (int i = 0; i < dt_flowmain.Rows.Count; i++) { //hy_field60作为了是否提醒的固定标志位 if (dt_flowmain.Rows[i]["col_name"].ToString() != "DOCID" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_mudelid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_tableid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_flowid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_flowname" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_curtacheid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_curtachename" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_curclrid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_curclrname" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_djrid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_djrbmid" && dt_flowmain.Rows[i]["col_name"].ToString() != "hy_field60") { //判断该当前字段是否已经配置过了,配置过了就不加载了。 DataTable dtjudeg_flowfield = db.GetDataTable("select * from hyt_flowfield where hy_mudelid='" + this.txtmudelid.Text + "' and hy_tableid='" + this.txttableid.Text + "' and hy_sqlfield='" + dt_flowmain.Rows[i]["col_name"].ToString() + "'"); if (dtjudeg_flowfield.Rows.Count > 0) { } else { this.ddlsqlfield.Items.Insert(j, new ListItem(dt_flowmain.Rows[i]["col_name"].ToString(), dt_flowmain.Rows[i]["col_name"].ToString())); j += 1; } } } //旧文档加载当前字段对应的SQL,添加到第一项 if (this.Request.QueryString["op"] == "modify") { this.ddlsqlfield.Items.Insert(0, new ListItem(this.txtsqlfield.Text, this.txtsqlfield.Text)); } else { this.ddlsqlfield.Items.Insert(0, new ListItem("--请选择--","")); } db.Close(); } }