//保存或提交时的JS代码(判断是否必填项),动态架构 Written by xf 20110515 public string CheckfmMainInput() { string ls_mid = ""; if (this.Request.QueryString["mid"] != null) { ls_mid = this.Request.QueryString["mid"].ToString(); if (ls_mid.Contains(",")) ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(",")); } string ls_tableid = ""; if (this.Request.QueryString["tableid"] != null) { ls_tableid = this.Request.QueryString["tableid"].ToString(); if (ls_tableid.Contains(",")) ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(",")); } string ls_return = ""; //如果是“可修改所有文档的权限人员”,则可以修改所有的字段,不需要提示是否必填了。 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9995", Session["hyuid"].ToString())) { } else { HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //根据模块ID和表单ID得到对应的配置字段 DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid); if (dt_gettablecolumns.Rows.Count > 0) { //判断是否必填 for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++) { if (dt_gettablecolumns.Rows[i]["hy_required"].ToString() == "是") { if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}if(isNaN(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value)){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "必须为数值!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".selectedIndex==0){alert(\"请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}}catch(err){}"; //if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框") // ls_return += "try{var ls_select=\"\";var obj1=document.getElementsById(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}"; //if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框") // ls_return += "try{var ls_select=\"\";var obj1=document.getElementsById(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}"; } //哪个字段是待办事宜提醒的字段 edited by xf 20140625 if (dt_gettablecolumns.Rows[i]["hy_ifdbsybt"].ToString() == "是") { ls_return += "try{var d=document.getElementById('" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "');if(d==null||typeof(d.value)=='undefined'){}else{document.getElementById('hy_bt').value=d.value;}}catch(err){}"; } } } } return ls_return; }
protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache(); HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { //删除流程信息 Hyoa_flowinfor.hy_flowid = v_uids[i]; Hyoa_flowinfor.Delete(); //删除环节信息 Hyoa_flowtache.DeleteByflowid(v_uids[i]); //删除流转信息 Hyoa_flowwork.DeleteAllbyflowid(v_uids[i]); //删除流程对应的域 Hyoa_flowfield.DeleteAllbyflowid(v_uids[i]); //删除流程环节对应的域 Hyoa_flowtachefield.DeleteAllbyflowid(v_uids[i]); //删除流程环节对应的用户 Hyoa_flowtacheuser.DeleteAllbyflowid(v_uids[i]); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
protected void btndelinfo_Click(object sender, EventArgs e) { 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] != "") { Hyoa_flowfield.ID = v_uids[i]; Hyoa_flowfield.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
//保存或提交时的JS代码(判断是否必填项),动态架构 Written by xf 20110515 public string CheckfmMainInput() { string ls_mid = ""; if (this.Request.QueryString["mid"] != null) { ls_mid = this.Request.QueryString["mid"].ToString(); if (ls_mid.Contains(",")) ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(",")); } string ls_tableid = ""; if (this.Request.QueryString["tableid"] != null) { ls_tableid = this.Request.QueryString["tableid"].ToString(); if (ls_tableid.Contains(",")) ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(",")); } string ls_return = ""; HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //根据模块ID和表单ID得到对应的配置字段 DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid); if (dt_gettablecolumns.Rows.Count > 0) { //判断是否必填 for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++) { if (dt_gettablecolumns.Rows[i]["hy_required"].ToString() == "是") { if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}if(isNaN(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value)){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "必须为数值!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表") ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.selectedIndex==0){alert(\"请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框") ls_return += "try{var ls_select=\"\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框") ls_return += "try{var ls_select=\"\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}"; } } } return ls_return; }
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)); }
public string hyjs() { //输出查询字段的JS start HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); DataTable dtlistsearch = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.txtmudelid.Value,this.txttableid.Value); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtgetsqlfield; string ls_return = ""; string fieldfz = "";//对应域JS域值 ls_return += "<script>function jssearch()"; //js生成 ls_return += "{fm = document.forms[0];";//js生成 for (int t = 0; t < dtlistsearch.Rows.Count; t++) { //根据模块ID和当前域名和表名id得到SQL字段 ztmztm dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, dtlistsearch.Rows[t]["hy_fieldid"].ToString(), this.txttableid.Value); fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + ".value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.value;"; if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString()=="数值") { fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1.value;"; fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1.value;"; } if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "日期") { fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1.value;"; fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1.value;"; } if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "对话框列表") { //document.forms[0].fNumber(域名).options[document.forms[0].fNumber(域名).selectedIndex].text fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + ".value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.options[fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.selectedIndex].text;"; } ls_return += fieldfz; dtgetsqlfield.Clear(); } ls_return += "fm.btnsearch.click();";//js生成 ls_return += "}</script>";//js生成 return ls_return; }
//得到某一个字段的HTML //pi_flag 0:不赋值 1:需赋值 //ifsearch:是否查询时使用 0:非查询时使用 1:查询时使用 public string GetFieldHtml(string hy_mudelid, string hy_fieldid, string pi_flag, string hy_tableid, string ifsearch) { HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(hy_mudelid, hy_fieldid, hy_tableid); HyoaClass.DAO db = new HyoaClass.DAO(); string lsField = ""; string field_css = ""; string field_value = ""; string field_functionhy_onclick = ""; string field_functionhy_ondblclick = ""; string field_functionhy_onchange = ""; string field_functionhy_onkeydown = ""; string field_functionhy_onkeyup = ""; if (dtfield.Rows.Count > 0) { //得到该字段的样式start if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { if (ifsearch == "0") field_css += " readonly "; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { field_css += " class='" + dtfield.Rows[0]["hy_class"].ToString() + "' "; } if (dtfield.Rows[0]["hy_width"].ToString() != "") { field_css += " style='width:" + dtfield.Rows[0]["hy_width"].ToString() + ";"; } else { field_css += " style='"; } if (dtfield.Rows[0]["hy_height"].ToString() != "") { field_css += " height:" + dtfield.Rows[0]["hy_height"].ToString() + "'"; } else { field_css += "'"; } //默认值 //默认值取值的方式,查询时不使用默认值 if (ifsearch == "0") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0") field_value += dtfield.Rows[0]["hy_defaultvalue"].ToString(); if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1") { DataTable dtdefault = db.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString()); if (dtdefault.Rows.Count > 0) field_value += dtdefault.Rows[0][0].ToString(); } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2") { field_value += Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3") { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") field_value += System.DateTime.Now.ToShortDateString(); else field_value += System.DateTime.Now.ToString(); } } } //事件 if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { field_functionhy_onclick += " onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { field_functionhy_ondblclick += " ondblclick=\"" + dtfield.Rows[0]["hy_ondblclick"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { field_functionhy_onchange += " onchange=\"" + dtfield.Rows[0]["hy_onchange"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { field_functionhy_onkeydown += " onkeydown=\"" + dtfield.Rows[0]["hy_onkeydown"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { field_functionhy_onkeyup += " onkeyup=\"" + dtfield.Rows[0]["hy_onkeyup"].ToString() + "\" "; } //得到该字段的样式end string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //单行文本 if (field_type == "文本") { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + " value=\"" + field_value + "\">"; } //多行文本 if (field_type == "多行文本") { lsField = "<textarea name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_css + " >" + field_value + "</textarea>"; } //日期 if (field_type == "日期") { if (ifsearch == "0") { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + field_value + "\">"; } else { field_css = " style='width:47%;'"; lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" " + "onclick=\"WdatePicker({el:$dp.$('" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1')})\"" +field_css + " value=\"" + field_value + "\">至"; lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" " +"onclick=\"WdatePicker({el:$dp.$('" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1')})\"" +field_css + " value=\"" + field_value + "\">"; } } //数值 if (field_type == "数值") { if (ifsearch == "0") { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + " value=\"" + field_value + "\">"; } else { field_css = " style='width:47%;'"; lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + " value=\"" + field_value + "\">到"; lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + " value=\"" + field_value + "\">"; } } //对话框列表(下拉框 if (field_type == "对话框列表") { lsField = "<select name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onchange + field_css + "> "; //有哪些选项 lsField += "<option value=''></option>"; if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { lsField += "<option value='" + lv_options[ii].ToString() + "'>" + lv_options[ii].ToString() + "</option>"; } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { lsField += "<option value='" + dtoptions.Rows[ii][0].ToString() + "'>" + dtoptions.Rows[ii][0].ToString() + "</option>"; } } } lsField += "</select>"; } //复选框 if (field_type == "复选框") { //有哪些选项 if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { if (field_value == lv_options[ii].ToString()) lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { if (field_value == dtoptions.Rows[ii][0].ToString()) lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } } } } //单选框 if (field_type == "单选框") { //有哪些选项 if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { if (field_value == lv_options[ii].ToString()) lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { if (field_value == dtoptions.Rows[ii][0].ToString()) lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + (ii.ToString()) + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } } } } //口令 if (field_type == "口令") { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=password id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + " value=\"" + field_value + "\">"; } //附件组件 if (field_type == "附件组件") { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_css + " value=\"" + "\"><input type=button id=\"uploadfile1\" text='附件' class=\"text1\" onclick=\"window.open('/ggdy/uploadfile.aspx?id=" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "');\" "; } //说明文字 if (field_type == "说明文字") { lsField = "<span id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\">" + field_value + "</span>"; } //编辑器文本 //if (field_type.Equals("ewebeditor")) //{ // tfile.setField(field_name, field_value); //} db.Close(); } return lsField; }
//输出查询字段的表格(查询输入框) public void GetSearchTableHtml() { HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); DataTable dtlistsearch = new DataTable(); if (this.txtlistid.Value == "") { dtlistsearch = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.txtmudelid.Value, this.txttableid.Value); } else { dtlistsearch = Hyoa_listsearchfield.Getlistsearchfieldsbylistid(this.txtlistid.Value); } HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //得到表单配置信息 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dt_tableconfig = Hyoa_tableconfig.GetTable(this.txttableid.Value); int li_colnums_show = int.Parse(dt_tableconfig.Rows[0]["hy_colnum"].ToString()) / 2; //一行显示几列 int li_rows_show = 0; //一共有几行 int li_ifaddcols = 0; //所有列显示完成后,是否需要补齐显示列 0:否 1:是 int li_addcols = 0; //需要补齐的列数量 if (dtlistsearch.Rows.Count % li_colnums_show == 0) { li_rows_show = dtlistsearch.Rows.Count / li_colnums_show; li_ifaddcols = 0; } else { li_rows_show = (dtlistsearch.Rows.Count / li_colnums_show) + 1; li_ifaddcols = 1; li_addcols = li_colnums_show - (dtlistsearch.Rows.Count % li_colnums_show); } for (int i = 0; i < li_rows_show; i++) { TableRow tRow = new TableRow(); tb_search.Rows.Add(tRow); for (int j = 0; j < li_colnums_show; j++) { //dtlistsearch中的记录行数 int t = i * li_colnums_show + j; if ((t + 1) > dtlistsearch.Rows.Count) { break; } //得到hyt_listsearchfield表中的hy_fieldid, GetFieldHtml(tRow, li_colnums_show, dtlistsearch.Rows[t]["hy_fieldid"].ToString()); } //如果最后一行的列没有显示完整,则补齐 if (li_ifaddcols == 1 && i == (li_rows_show - 1)) { for (int k = 0; k < li_addcols; k++) { TableCell tCell8 = new TableCell(); tRow.Cells.Add(tCell8); tCell8.Height = Unit.Pixel(30); tCell8.CssClass = "Tdcellleft"; tCell8.HorizontalAlign = HorizontalAlign.Center; tCell8.Controls.Add(new LiteralControl(" ")); TableCell tCell9 = new TableCell(); tRow.Cells.Add(tCell9); tCell9.Height = Unit.Pixel(30); tCell9.CssClass = "Tdcellright"; tCell9.HorizontalAlign = HorizontalAlign.Center; tCell9.Controls.Add(new LiteralControl(" ")); } } } //插入查询按钮行 TableRow tRow2 = new TableRow(); tb_search.Rows.Add(tRow2); TableCell tCell3 = new TableCell(); tRow2.Cells.Add(tCell3); tCell3.Height = Unit.Pixel(30); tCell3.CssClass = "Tdcellright"; tCell3.HorizontalAlign = HorizontalAlign.Right; tCell3.ColumnSpan = li_colnums_show * 2; Button btnButton = new Button(); btnButton.ID = "btnsearch_ht"; btnButton.Text = " 查 询"; btnButton.CssClass = "btn7"; btnButton.Click += new EventHandler(btnsearch_Click); tCell3.Controls.Add(btnButton); }
//输出一个字段 //li_tdnums_onerow:当前行已输出了几列 //li_colnums_show:每行显示几列(标准情况下) //pi_isnewdoc 0:新文档 1:旧文档 //ifhavarole:表单上是否有权限 0:lable输出 1:input输出 //ifflowdoc:是否流程表单 0:非流程 1:流程 //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限 public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid) { int li_return = li_tdnums_onerow; string ls_laborinput = "0"; //输出LABLE还是INPUT 0:LABLE 1:INPUT HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text); int li_left = 30; int li_right = 70; if (dtfield.Rows.Count > 0) { string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //字段类型 if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5") //如果设置了不显示左侧说明文字,则不加载左侧列 { li_return += 1; //插入单元格(左侧) TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); tCell.Width = Unit.Percentage((li_left / li_colnums_show)); tCell.Height = Unit.Pixel(30); tCell.CssClass = "Tdcellleft"; tCell.HorizontalAlign = HorizontalAlign.Center; tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString())); } else { li_left = 50; li_right = 50; } //插入单元格(右侧) TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); tCell2.Width = Unit.Percentage((li_right / li_colnums_show)); tCell2.Height = Unit.Pixel(30); tCell2.CssClass = "Tdcellright"; if (dtfield.Rows[0]["hy_align"].ToString() == "left") { tCell2.HorizontalAlign = HorizontalAlign.Left; } if (dtfield.Rows[0]["hy_align"].ToString() == "center") { tCell2.HorizontalAlign = HorizontalAlign.Center; } if (dtfield.Rows[0]["hy_align"].ToString() == "right") { tCell2.HorizontalAlign = HorizontalAlign.Right; } tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); //赋值(新文档取配置的默认值,旧文档取数据库表中的值) string field_docvalue = ""; if (pi_isnewdoc == "0") //新文档 { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0") { field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString(); //手工配置 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1") { DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString()); field_docvalue = dt_getfieldvalue.Rows[0][0].ToString(); //SQL语句 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2") { field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); //SESSION } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3") { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd"); //当前时间 else field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss"); //当前时间 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4") { //自动生成 if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { //得到目前最大的数值,然后+1,未找到则赋值为1 DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text); if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "") field_docvalue += "1"; else field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString(); } else { field_docvalue += System.Guid.NewGuid().ToString(); } } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "5") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } } else { if (field_type == "文本" || field_type == "多行文本" || field_type == "多行文本_TEXT" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器") { string ls_sql = "select hyc_" + hy_fieldid + " from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getdocvalue = Hyoa_global.GetDataTable(ls_sql); if (dt_getdocvalue.Rows.Count > 0) { field_docvalue = dt_getdocvalue.Rows[0][0].ToString(); if (field_type == "日期") { if (field_docvalue.Length > 8) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = " "; } else { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { field_docvalue = System.DateTime.Parse(field_docvalue).ToString("yyyy-MM-dd"); } } } } } } if (field_type == "说明文字") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } //判断是输出LABL还是INPUT if (pi_isnewdoc == "0") //新文档 { if (ifflowdoc == "0") //非流程 { if (ifhavarole == "1") //有权限 { ls_laborinput = "1"; } } else { if (ifhavarole == "1") //有权限 { //有流程(判断当前环节这个字段是否有权限) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); if (ls_laborinput == "0") { field_docvalue = ""; } } else { field_docvalue = ""; } } } else //旧文档 { if (ifflowdoc == "0") //非流程 { if (ifhavarole == "1") //有权限 { ls_laborinput = "1"; //如果文档已经确认,则输出lable string ls_sql = "select hy_ifconfirm from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getifconfirm = Hyoa_global.GetDataTable(ls_sql); if (dt_getifconfirm.Rows.Count > 0) { if (dt_getifconfirm.Rows[0]["hy_ifconfirm"].ToString() == "1") ls_laborinput = "0"; } } } else { if (ifhavarole == "1") //有权限 { //有流程(判断当前环节这个字段是否有权限) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); //如果流程结束了,则输出lable if (hy_curtacheid.Text == "**") { ls_laborinput = "0"; } } } } //如果是输出LABLE,值为空则赋为 不为空时需要转换回车和空格 if (ls_laborinput == "0") { if (field_docvalue == "") { field_docvalue = " "; } else { if (field_type != "编辑器") { field_docvalue = RtfToText(field_docvalue); } } } //单行文本 if (field_type == "文本") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //多行文本 if (field_type == "多行文本") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //多行文本_TEXT if (field_type == "多行文本_TEXT") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //按钮 if (field_type == "按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //一直显示的按钮 if (field_type == "一直显示的按钮") { //-----开始输出字段------ Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } //日期 if (field_type == "日期") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //文本加按钮 if (field_type == "文本加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("60%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //多行文本加按钮 if (field_type == "多行文本加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //意见加按钮 if (field_type == "意见加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } //txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" /><input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_cz' value=' 重 置 ' class=btn3 onclick=\"document.getElementById('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "').value='';\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //数值 if (field_type == "数值") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //对话框列表(下拉框 if (field_type == "对话框列表") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { DropDownList ddlDropDownList = new DropDownList(); ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { ddlDropDownList.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 if (dtfield.Rows[0]["hy_options"].ToString() != "") { //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); ddlDropDownList.DataSource = dt_options; ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataBind(); } } ddlDropDownList.Items.Insert(0, new ListItem("--请选择--", "")); ddlDropDownList.SelectedValue = field_docvalue; tCell2.Controls.Add(ddlDropDownList); } } //复选框(查询时直接显示文本框) if (field_type == "复选框") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { CheckBoxList txtTextBox = new CheckBoxList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } if (field_docvalue != "") { field_docvalue = "," + field_docvalue + ","; foreach (ListItem li in txtTextBox.Items) { if (field_docvalue.Contains(li.Value)) li.Selected = true; } } tCell2.Controls.Add(txtTextBox); } } //单选框(查询时直接显示文本框) if (field_type == "单选框") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { RadioButtonList txtTextBox = new RadioButtonList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //口令 if (field_type == "口令") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.Password; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //附件组件 if (field_type == "附件组件") { //读取附件内容 HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatheridandFatherfield(this.txtdocid.Value, hy_fieldid); field_docvalue = ""; if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { field_docvalue += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a><br />"; } } //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (field_docvalue == "") { field_docvalue = " "; } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue += "<input type=button id='uploadfile1' value='附件管理' class=btn3 onclick=\"window.open('ggdy/main_fileatt.aspx?fatherid=" + this.txtdocid.Value + "&fatherfield=" + hy_fieldid + "','filewindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //说明文字 if (field_type == "说明文字") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //编辑器 if (field_type == "编辑器") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { //隐藏文本框 TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; txtTextBox.Style.Value = "display:none"; tCell2.Controls.Add(txtTextBox); //编辑器 Label txtTextBox2 = new Label(); txtTextBox2.ID = "eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<iframe ID=\"eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_fieldid"].ToString() + "&style=Portal\" frameborder=0 scrolling=no width=" + dtfield.Rows[0]["hy_width"].ToString() + " height=" + dtfield.Rows[0]["hy_height"].ToString() + "></iframe>"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //痕迹保留 if (field_type == "痕迹保留") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; //如果是流程模块,则根据环节判断一下 if (ifflowdoc == "1") { //判断是否为第一环节 HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*"); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text) { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { //判断是否为最后一个环节 dtflowwork.Clear(); dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**") { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } } } } } Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //IFRAME列表 if (field_type == "IFRAME列表") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //子表信息带链接 //子表信息不带链接 } return li_return; }
protected void btnDRToSQL_Click(object sender, EventArgs e) { if (this.selectTable.Value == "") { Response.Write("<script>alert('对不起,请选择合同表名!');</script>"); return; } List<string> lsTablekdjrht = new List<string>(); //宽带接入合同导入字段id if (this.tableid.Value == "Tablekdjrht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //行业分类 lsTablekdjrht.Add("hyfl"); //速率 lsTablekdjrht.Add("dk"); //IP lsTablekdjrht.Add("ipsl"); //合同金额 lsTablekdjrht.Add("htje"); //支付方式 lsTablekdjrht.Add("fkfs"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htqx"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //负责人 lsTablekdjrht.Add("fzr"); //备注 lsTablekdjrht.Add("bz"); //开通日期 lsTablekdjrht.Add("ktrq"); //安装地址 lsTablekdjrht.Add("azdz"); } //境外电视接收协议 else if (this.tableid.Value == "Tablejwdsjsxy") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //行业分类 lsTablekdjrht.Add("hyfl"); //接收频道 lsTablekdjrht.Add("jspd"); //代传频道 lsTablekdjrht.Add("dcpd"); //收视费 lsTablekdjrht.Add("bxje"); //设备工程安装 lsTablekdjrht.Add("szgcazje"); //房间数 lsTablekdjrht.Add("fjsl"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htsy"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //备注 lsTablekdjrht.Add("bz"); //负责人 lsTablekdjrht.Add("fzr"); } //租线合同 else if (this.tableid.Value == "Tablesjcsfwht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //行业分类 lsTablekdjrht.Add("hyfl"); //服务内容 lsTablekdjrht.Add("fwnr"); //带宽(兆数) lsTablekdjrht.Add("dk"); //数量 lsTablekdjrht.Add("xlts"); //设备安装费 lsTablekdjrht.Add("sbazf"); //月租费 lsTablekdjrht.Add("qyje"); //合同总金额 lsTablekdjrht.Add("htje"); //付款方式 lsTablekdjrht.Add("fkfs"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htqx"); //负责人 lsTablekdjrht.Add("fzr"); //安装地址 lsTablekdjrht.Add("azdz"); //备注 lsTablekdjrht.Add("zb"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); } //管道合同 else if (this.tableid.Value == "Tablesjgdcsfwht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //行业分类 lsTablekdjrht.Add("hyfl"); //服务内容 lsTablekdjrht.Add("fwnr"); //设备安装费 lsTablekdjrht.Add("sbazf"); //合同总金额 lsTablekdjrht.Add("htje"); //付款方式 lsTablekdjrht.Add("fkfs"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htqx"); //负责人 lsTablekdjrht.Add("fzr"); //安装地址 lsTablekdjrht.Add("azdz"); //备注 lsTablekdjrht.Add("bz"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); } //DVB安装服务订购 else if (this.tableid.Value == "TableDVBazfwdght") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //连锁名或门户名 lsTablekdjrht.Add("lsm"); //行业分类 lsTablekdjrht.Add("hyfl"); //签订类型 lsTablekdjrht.Add("qdlx"); //终端数 lsTablekdjrht.Add("zds"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htqx"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //备注 lsTablekdjrht.Add("bz"); //负责人 lsTablekdjrht.Add("fzr"); //其他 lsTablekdjrht.Add("htje"); } //付费频道 else if (this.tableid.Value == "Tableffpdfwht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //连锁名或门户名 lsTablekdjrht.Add("lsm"); //行业分类 lsTablekdjrht.Add("hyfl"); //签订类型 lsTablekdjrht.Add("qdlx"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htsy"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //备注 lsTablekdjrht.Add("bz"); //负责人 lsTablekdjrht.Add("fzr"); //国内包 lsTablekdjrht.Add("qyje"); } //商业用户服务协议字段 else if (this.tableid.Value == "Tablesyyhfwxy") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //连锁名或门户名 lsTablekdjrht.Add("lsm"); //行业分类 lsTablekdjrht.Add("hyfl"); //签订类型 lsTablekdjrht.Add("qdlx"); //机顶盒数量 1 lsTablekdjrht.Add("jdhsl1"); //机顶盒数量 2 lsTablekdjrht.Add("jdhsl2"); //机顶盒类型 lsTablekdjrht.Add("jdhlx"); //机顶盒类型 lsTablekdjrht.Add("jdhlx2"); //终端数 lsTablekdjrht.Add("zds"); //其他 lsTablekdjrht.Add("qt"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htsy"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //备注 lsTablekdjrht.Add("htnr"); //负责人 lsTablekdjrht.Add("fzr"); //开户费 lsTablekdjrht.Add("khf"); //视听维护费 lsTablekdjrht.Add("stwhf"); } //VOD合同 else if (this.tableid.Value == "TableVODfwxy") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //连锁名或门户名 lsTablekdjrht.Add("lsm"); //行业分类 lsTablekdjrht.Add("hyfl"); //签订类型 lsTablekdjrht.Add("qdlx"); //机顶盒数量 1 lsTablekdjrht.Add("jdhsl"); //终端数 lsTablekdjrht.Add("dszds"); //其他 lsTablekdjrht.Add("qt"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htsy"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //合同内容 lsTablekdjrht.Add("htnr"); //负责人 lsTablekdjrht.Add("fzr"); //合同金额 lsTablekdjrht.Add("htje"); } //机顶盒合同 else if (this.tableid.Value == "Tablejdhazfwht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //连锁名或门户名 lsTablekdjrht.Add("lsm"); //行业分类 lsTablekdjrht.Add("hyfl"); //签订类型 lsTablekdjrht.Add("qdlx"); //机顶盒数量 1 lsTablekdjrht.Add("szdszds"); //机顶盒数量 2 lsTablekdjrht.Add("szdszds2"); //机顶盒类型 lsTablekdjrht.Add("jdhlx"); //机顶盒类型 lsTablekdjrht.Add("jdhlx2"); //终端数合计 lsTablekdjrht.Add("zdshj"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同期限 lsTablekdjrht.Add("htsy"); //联系人 lsTablekdjrht.Add("jflxr"); //电话 lsTablekdjrht.Add("jflxdh"); //地址 lsTablekdjrht.Add("jfdz"); //合同内容 lsTablekdjrht.Add("htnr"); //负责人 lsTablekdjrht.Add("fzr"); //合同金额 lsTablekdjrht.Add("htje"); //项目实施及材料费 lsTablekdjrht.Add("xmssjclf"); } //信息化工程合同 else if (this.tableid.Value == "Tablezdyht") { //合同编号 lsTablekdjrht.Add("htbh"); //单位名称 lsTablekdjrht.Add("jfmc"); //乙方名称 lsTablekdjrht.Add("yfmc"); //丙方名称 lsTablekdjrht.Add("bfmc"); //合同名称 lsTablekdjrht.Add("htmc"); //合同金额 lsTablekdjrht.Add("htje"); //签订时间 lsTablekdjrht.Add("qdsj"); //起始日期 lsTablekdjrht.Add("htkssj"); //结束日期 lsTablekdjrht.Add("htzzsj"); //合同内容 lsTablekdjrht.Add("htnr"); //负责人 lsTablekdjrht.Add("fzr"); } HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //链接SQL数据库 if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件 { Response.Write("<script>alert('请您选择Excel文件')</script> "); return; //当无文件时,返回 } string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { Response.Write("<script>alert('只可以选择Excel文件')</script>"); return; //当选择的不是Excel文件时,返回 } //根据年份判断在该路径下是否存在以当年年份文件夹 否则将建立以该年份的文件夹 string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); //HttpContext.Current.Server.MapPath(相对路径):把相对路径转为服务器上的绝对路径。File.Exists(绝对路径):检查是否存在绝对路径指向的文件或目录。 if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny)) { //System.IO.Directory.CreateDirectory(文件夹绝对路径):建立绝对路径文件夹。 System.IO.Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny); } string filename = DateTime.Now.ToString("hhMMss") + FileUpload1.FileName; //重新为文件命名,获取Execle文件名 DateTime日期函数 // 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里""必须用"\"代替 string savePath = Server.MapPath(("~\\upload/" + ls_ny + "\\") + filename);//Server.MapPath 获得虚拟服务器相对路径 FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上 DataSet ds = ExecleDs(savePath, filename); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); //定义一个DataRow数组 int rowsnum = ds.Tables[0].Rows.Count; int i_into = 0; if (rowsnum == 0) { Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示 } else { for (int i = 0; i < dr.Length; i++) { try { String sql = ""; String insertstr_left = ""; String insertstr_right = ""; insertstr_left = "insert into hyc_" + this.tableid.Value + " (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj"; insertstr_right = "'" + Hyoa_global.GetRandom() + "','" + this.mudelid.Value + "','" + this.tableid.Value + "','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; int jj = 0; for (int j = 0; j < lsTablekdjrht.Count; j++) { insertstr_left += ",hyc_" + lsTablekdjrht[j]; insertstr_right += ",'" + dr[i][jj].ToString() + "'"; jj += 1; } sql = insertstr_left + ") values (" + insertstr_right + ")"; //Response.Write(sql); //return; Hyoa_global.ExcuteSQL(sql); i_into = i_into + 1; //客户信息导入 string ls_sql = ""; ls_sql = "select * from hyc_Tablekhda where hyc_dwmc='" + dr[i]["单位名称"].ToString() + "'"; DataTable dt = Hyoa_global.GetDataTable(ls_sql); if (dt.Rows.Count <= 0) { string kh_insert = ""; kh_insert += "insert into hyc_Tablekhda(DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hyc_dwmc,hyc_hyfl,hyc_dwdz) values ("; kh_insert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablekhda','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; kh_insert += ",'" + dr[i]["单位名称"].ToString() + "','" + dr[i]["行业类型"].ToString() + "','" + dr[i]["地址"].ToString() + "')"; Hyoa_global.ExcuteSQL(kh_insert); } //联系人信息导入 string lxr_sql = ""; lxr_sql = "select * from hyc_Tablelxr where hyc_dwmc='" + dr[i]["单位名称"].ToString() + "'"; dt = Hyoa_global.GetDataTable(lxr_sql); if (dt.Rows.Count > 0) { string lxr_sql2 = ""; if (dr[i]["联系人"].ToString() != "") { lxr_sql2 = "select * from hyc_Tablelxr where hyc_lxrmc='" + dr[i]["联系人"].ToString() + "'"; dt = Hyoa_global.GetDataTable(lxr_sql2); if (dt.Rows.Count <= 0) { string lxr_insert = ""; lxr_insert += "insert into hyc_Tablelxr(DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hyc_dwmc,hyc_lxrmc,hyc_dh) values ("; lxr_insert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablelxr','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; lxr_insert += ",'" + dr[i]["单位名称"].ToString() + "','" + dr[i]["联系人"].ToString() + "','" + dr[i]["电话"].ToString() + "')"; Hyoa_global.ExcuteSQL(lxr_insert); } } else if (dr[i]["电话"].ToString() != "") { lxr_sql2 = "select * from hyc_Tablelxr where hyc_dh='" + dr[i]["电话"].ToString() + "'"; dt = Hyoa_global.GetDataTable(lxr_sql2); if (dt.Rows.Count <= 0) { string lxr_insert = ""; lxr_insert += "insert into hyc_Tablelxr(DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hyc_dwmc,hyc_lxrmc,hyc_dh) values ("; lxr_insert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablelxr','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; lxr_insert += ",'" + dr[i]["单位名称"].ToString() + "','" + dr[i]["联系人"].ToString() + "','" + dr[i]["电话"].ToString() + "')"; Hyoa_global.ExcuteSQL(lxr_insert); } } } else { if (dr[i]["联系人"].ToString() != "" || dr[i]["电话"].ToString() != "") { string lxr_insert = ""; lxr_insert += "insert into hyc_Tablelxr(DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hyc_dwmc,hyc_lxrmc,hyc_dh) values ("; lxr_insert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablelxr','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; lxr_insert += ",'" + dr[i]["单位名称"].ToString() + "','" + dr[i]["联系人"].ToString() + "','" + dr[i]["电话"].ToString() + "')"; Hyoa_global.ExcuteSQL(lxr_insert); } } //行业类型导入 string ls_hylx = ""; ls_hylx = "select * from hyc_Tablehyfl where hyc_hyfl='" + dr[i]["行业类型"].ToString() + "'"; dt = Hyoa_global.GetDataTable(ls_hylx); if (dt.Rows.Count <= 0) { string hyfl_insert = ""; hyfl_insert += "insert into hyc_Tablehyfl(DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hyc_hyfl) values ("; hyfl_insert += "'" + Hyoa_global.GetRandom() + "','Mudelsjwh','Tablehyfl','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; hyfl_insert += ",'" + dr[i]["行业类型"].ToString() + "')"; Hyoa_global.ExcuteSQL(hyfl_insert); } } catch { } finally { } } //返回页面 Response.Write("<script>alert('已成功导入" + i_into.ToString() + "条记录!');window.location='import_excel_ht.aspx?mid=" + mudelid.Value + "&tableid=" + tableid.Value + "&listid=&rnd=" + Hyoa_global.GetRandom() + "'</script>"); } }
private void DataPlay() { //是否启用 this.ddlifsearch.Items.Insert(0, "是"); this.ddlifsearch.Items.Insert(1, "否"); this.ddlifflowdoc.Items.Insert(0, "是"); this.ddlifflowdoc.Items.Insert(1, "否"); this.ddlifshowsearch.Items.Insert(0, "是"); this.ddlifshowsearch.Items.Insert(1, "否"); //模块编号 //加载模块信息 HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dtmudel = Hyoa_mudel.Getmudels(); if (dtmudel.Rows.Count > 0) { this.ddlmudelid.DataSource = dtmudel; this.ddlmudelid.DataTextField = "hy_mudelname"; this.ddlmudelid.DataValueField = "hy_mudelid"; this.ddlmudelid.DataBind(); this.ddlmudelid.Items.Insert(0, new ListItem("请选择", "请选择")); this.ddlmudelid.SelectedIndex = 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; //保存 } //旧文档 HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); if (this.Request.QueryString["op"] == "modify") { if (this.Request.QueryString["id"] != null) { //根据id得到信息 this.txtdocid.Value = this.Request.QueryString["id"].ToString(); DataTable dt = Hyoa_listconfig.Getlistconfig(this.txtdocid.Value); if (dt.Rows.Count > 0) { this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString(); if (dt.Rows[0]["hy_ifsearch"].ToString() == "是") { this.ddlifsearch.SelectedIndex = 0; } else { this.ddlifsearch.SelectedIndex = 1; } if (dt.Rows[0]["hy_ifshowsearch"].ToString() != "否") { this.ddlifshowsearch.SelectedIndex = 0; } else { this.ddlifshowsearch.SelectedIndex = 1; } this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString(); if (dt.Rows[0]["hy_ifflowdoc"].ToString() == "是") { this.ddlifflowdoc.SelectedIndex = 0; } else { this.ddlifflowdoc.SelectedIndex = 1; } this.txthy_listname.Text = dt.Rows[0]["hy_listname"].ToString(); this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString(); //加载所有列信息 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtflowfield; //dtflowfield = Hyoa_flowfield.Getflowfields(); dtflowfield = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_tableid"].ToString()); if (dtflowfield.Rows.Count > 0) { this.ddlcolumnshow.DataSource = dtflowfield; this.ddlcolumnshow.DataTextField = "hy_fieldname"; this.ddlcolumnshow.DataValueField = "hy_fieldid"; this.ddlcolumnshow.DataBind(); this.ddlcolumnshow.SelectedIndex = 0; } dtflowfield.Clear(); //将列都列出来 string[] lv_columnshowselect; string[] lv_columnshowselectid; lv_columnshowselect = dt.Rows[0]["hy_columnshow"].ToString().Split(','); lv_columnshowselectid = dt.Rows[0]["hy_columnshowid"].ToString().Split(','); for (int j = 0; j < lv_columnshowselect.Length; j++) { this.ddlcolumnshowselect.Items.Insert(j, new ListItem(lv_columnshowselect[j], lv_columnshowselectid[j])); } //根据模块信息得到对应的选择表单值 if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null) { this.ddltableid.Items.Clear(); //根据模块ID得到表单ID HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString()); if (dtgettableid.Rows.Count > 0) { for (var i = 0; i < dtgettableid.Rows.Count; i++) { this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString())); } this.ddltableid.Items.Insert(0, new ListItem("--请选择--", "")); this.ddltableid.Attributes.Add("onchange ", "mudelidonchang() "); //定位 this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString(); } } //排序的字段 //根据模块ID+表单ID+字段ID得到字段中文名 DataTable dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString(), dt.Rows[0]["hy_tableid"].ToString()); if (dt_flowfield.Rows.Count > 0) { this.searchsort1.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString())); } this.ddlsorttype1.SelectedValue = dt.Rows[0]["hy_sorttype1"].ToString(); dt_flowfield.Clear(); dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString(), dt.Rows[0]["hy_tableid"].ToString()); if (dt_flowfield.Rows.Count > 0) { this.searchsort2.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString())); } this.ddlsorttype2.SelectedValue = dt.Rows[0]["hy_sorttype2"].ToString(); dt_flowfield.Clear(); dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString(), dt.Rows[0]["hy_tableid"].ToString()); if (dt_flowfield.Rows.Count > 0) { this.searchsort3.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString())); } this.ddlsorttype3.SelectedValue = dt.Rows[0]["hy_sorttype3"].ToString(); dt_flowfield.Clear(); //分类的字段 this.txthy_field_fl1.Text = dt.Rows[0]["hy_sql_fl1"].ToString(); if (dt.Rows[0]["hy_fieldid_fl1"].ToString() != "") { this.flfield1.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl1"].ToString(), dt.Rows[0]["hy_fieldid_fl1"].ToString())); } this.txthy_field_fl2.Text = dt.Rows[0]["hy_sql_fl2"].ToString(); if (dt.Rows[0]["hy_fieldid_fl2"].ToString() != "") { this.flfield2.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl2"].ToString(), dt.Rows[0]["hy_fieldid_fl2"].ToString())); } this.txthy_field_fl3.Text = dt.Rows[0]["hy_sql_fl3"].ToString(); if (dt.Rows[0]["hy_fieldid_fl3"].ToString() != "") { this.flfield3.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl3"].ToString(), dt.Rows[0]["hy_fieldid_fl3"].ToString())); } } dt.Clear(); HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); DataTable dt5 = Hyoa_listsearchfield.Getlistsearchfieldsbylistid(this.txtdocid.Value); if (dt5.Rows.Count > 0) { for (int m = 0; m < dt5.Rows.Count; m++) { this.searchselect.Items.Insert(m, new ListItem(dt5.Rows[m]["hy_field"].ToString(), dt5.Rows[m]["hy_fieldid"].ToString())); } } } } else { //自动获取最大排序号,然后+2 DataTable dt_maxsort = Hyoa_listconfig.GetMaxlistconfigsort(); if (dt_maxsort.Rows.Count > 0) txtsort.Text = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString(); else txtsort.Text = "1"; } } }
//需要导出的内容 private string getExcelContent() { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //根据表ID和模块ID得到当前传进来的模块是否有流程 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value); //根据表单得到对应的所有字段 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbytableid(dttableconfig.Rows[0]["ID"].ToString()); //循环所有字段 string ls_flowfield = ""; if (dtflowfield.Rows.Count > 0) { for (int i = 0; i < dtflowfield.Rows.Count; i++) { string ls_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString(); if (ls_fieldtype == "文本" || ls_fieldtype == "多行文本" || ls_fieldtype == "文本加按钮" || ls_fieldtype == "多行文本加按钮" || ls_fieldtype == "日期" || ls_fieldtype == "数值" || ls_fieldtype == "对话框列表" || ls_fieldtype == "复选框" || ls_fieldtype == "单选框" || ls_fieldtype == "口令") { ls_flowfield += ",a.hyc_" + dtflowfield.Rows[i]["hy_fieldid"].ToString(); } } } HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); DataTable dtlist = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value); //列表配置 #region ---查询条件--- string cmdStr_Search = ""; if (txtsearchfields.Text != "") { string[] lv_searchfields = txtsearchfields.Text.Split(','); string[] lv_searchfields_sx = txtsearchfields_sx.Text.Split(','); for (int i = 0; i < lv_searchfields.Length; i++) { string ls_fieldid = lv_searchfields[i].ToString(); string ls_fieldid_sx = lv_searchfields_sx[i].ToString(); string ls_searchtext = ""; if (this.Request.Form[ls_fieldid] != null) { ls_searchtext = this.Request.Form[ls_fieldid].ToString(); } if (ls_searchtext != "") { if (ls_fieldid_sx == "0") { cmdStr_Search += " and hyc_" + ls_fieldid + " like '%" + ls_searchtext + "%' "; } else { if (ls_fieldid_sx == "1") { if (Session["conntype"].ToString() == "SQL") { cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) >= '" + ls_searchtext + "' "; } if (Session["conntype"].ToString() == "ORACLE") { cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') >= '" + ls_searchtext + "' "; } } if (ls_fieldid_sx == "2") { if (Session["conntype"].ToString() == "SQL") { cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) <= '" + ls_searchtext + "' "; } if (Session["conntype"].ToString() == "ORACLE") { cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') <= '" + ls_searchtext + "' "; } } if (ls_fieldid_sx == "3") { cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " >= " + ls_searchtext + " "; } if (ls_fieldid_sx == "4") { cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " <= " + ls_searchtext + " "; } } } } } #endregion ---查询条件--- #region ---排序--- string cmdStr_SearchSort = ""; if (dtlist.Rows[0]["hy_sortfield1"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString(); } } if (dtlist.Rows[0]["hy_sortfield2"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString(); } } if (dtlist.Rows[0]["hy_sortfield3"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString(); } } if (cmdStr_SearchSort == "") { //没有配置,则默认按登记日期 cmdStr_SearchSort = " order by hy_djsj desc "; } #endregion ---排序--- #region --根据查询条件得到返回数据集-- DataTable dt = new DataTable(); //单页数据集 DataTable dt_total = new DataTable(); //数据总条数,返回总条数值 DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value); //得到表配置信息查看当前表是否有流程 hy_ifflowdoc string cmdStr = ""; if (dttable.Rows[0]["hy_ifflowdoc"].ToString() == "是") { if (dttable.Rows[0]["hy_ispuballByflowYB"].ToString() == "是") { string ls_from = ""; if (Session["conntype"].ToString() == "SQL") { ls_from = " hyc_" + this.txttableid.Value + " a,hyp_flowhistoryinfo_cl b where a.DOCID=b.DOCID and (','+b.hy_clrid+',' like '%," + Session["hyuid"].ToString() + ",%' or ','+b.hy_cyrid+',' like '%," + Session["hyuid"].ToString() + ",%' or a.hy_curtacheid='**') and b.hy_ifth!='是' " + cmdStr_Search; //cmdStr = "select distinct top 10 a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from; //cmdStr += " and a.DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " a.DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort; cmdStr = "select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,"; cmdStr += "a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,"; cmdStr += "a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + cmdStr_SearchSort; } dt = Hyoa_global.GetDataTable(cmdStr); if (Session["conntype"].ToString() == "SQL") { cmdStr = "select count(*) from (select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + " ) f"; } dt_total = Hyoa_global.GetDataTable(cmdStr); //dt = Hyoa_flowmain.GetflowmainsByIf_jsDisplayAll(); //输出流程的dt } else { string ls_from = ""; if (Session["conntype"].ToString() == "SQL") { ls_from = " hyc_" + this.txttableid.Value + " a,hyp_flowhistoryinfo_cl b where a.DOCID=b.DOCID and (','+b.hy_clrid+',' like '%," + Session["hyuid"].ToString() + ",%' or ','+b.hy_cyrid+',' like '%," + Session["hyuid"].ToString() + ",%') and b.hy_ifth!='是' " + cmdStr_Search; //cmdStr = "select distinct top 10 a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from; //cmdStr += " and a.DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " a.DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort; cmdStr = "select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,"; cmdStr += "a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,"; cmdStr += "a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + cmdStr_SearchSort; } dt = Hyoa_global.GetDataTable(cmdStr); if (Session["conntype"].ToString() == "SQL") { cmdStr = "select count(*) from (select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + " ) f"; } dt_total = Hyoa_global.GetDataTable(cmdStr); //dt = Hyoa_flowmain.GetflowmainsByIf(); //输出流程的dt } } else { if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是") { string ls_from = ""; ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + cmdStr_Search; if (Session["conntype"].ToString() == "SQL") { cmdStr = "select * from " + ls_from + cmdStr_SearchSort; //cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort; } dt = Hyoa_global.GetDataTable(cmdStr); cmdStr = "select count(*) from " + ls_from; dt_total = Hyoa_global.GetDataTable(cmdStr); } else { string ls_from = ""; //ls_from = " hyc_" + this.txttableid.Value + " where hy_djrid='" + Session["hyuid"].ToString() + "' " + cmdStr_Search; ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + cmdStr_Search; if (Session["conntype"].ToString() == "SQL") { cmdStr = "select * from " + ls_from + cmdStr_SearchSort; //cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort; } dt = Hyoa_global.GetDataTable(cmdStr); cmdStr = "select count(*) from " + ls_from; dt_total = Hyoa_global.GetDataTable(cmdStr); } } #endregion --根据查询条件得到返回数据集-- //开始输出----整合成HTML为数据行 StringBuilder sb = new StringBuilder(); string lscolname = ""; string lscolnameid = ""; string lscolwidth = ""; string[] lvcolname; string[] lvcolnameid; string[] lvcolwidth; string lscolwidthper; lscolname = dtlist.Rows[0]["hy_columnshow"].ToString(); //要显示的列名:附件,标题,收文来源 lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString(); //要显示的列名id:uploadfile1,Hy_bt,Hy_swly lscolwidth = dtlist.Rows[0]["hy_width"].ToString(); //要显示的列名id:10,20,30 lvcolname = lscolname.Split(','); lvcolnameid = lscolnameid.Split(','); lvcolwidth = lscolwidth.Split(','); string ls_colspan = (lvcolname.Length + 1).ToString(); sb.Append("<table border='1'>"); sb.Append("<thead><tr><th colSpan='" + ls_colspan + "' class='ztitle'>" + this.lblcurtachenameshow.Text + "</th></tr>"); sb.Append("<tr><th colSpan='" + ls_colspan + "' class='tdheight20'></th></tr>"); sb.Append("<tr>"); sb.Append("<th style='width:70px;' class='tdcenter'>序号</th>"); //如果没有数据则输出表头 for (int n = 0; n < lvcolname.Length; n++) { if (n >= lvcolwidth.Length) { //此判断是为了防止对应宽度没有输入时,会溢出报错。 lscolwidthper = "100"; } else { lscolwidthper = (int.Parse(lvcolwidth[n]) * 20).ToString(); } sb.Append("<th style='width:" + lscolwidthper + "px;' class='tdcenter'>" + lvcolname[n] + "</th>"); } sb.Append("</tr></thead>"); if (dt.Rows.Count <= 0) { sb.Append("</table>"); } else { //如果有数据,则输出数据 sb.Append("<tbody>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<tr>"); sb.Append("<td class='tdcenter'>" + (i + 1).ToString() + "</td>"); //序号 //////开始得到列的值 DataTable dtgetsqlfield; for (int m = 0; m < lvcolname.Length; m++) { //根据字段英文名,得到数据库中对应的字段 dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value); string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString(); //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换) string lsgetputfiled = ""; if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { if (dt.Rows[i][lsgetsqlfield].ToString() != "") lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("yyyy-MM-dd"); } else { //解决Float小数点后面出现N位小数乱码的问题 if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { if (dt.Rows[i][lsgetsqlfield].ToString() != "") { //是否包含小数点,包含的话,取小数点后两位 if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true) { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2"); } else { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString(); } } else { lsgetputfiled = "0"; } //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); } else { lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); } } if (lsgetputfiled == "") lsgetputfiled = " "; sb.Append("<td class='tdcenter'>" + lsgetputfiled + "</td>"); } sb.Append("</tr>"); } sb.Append("</tbody></table>"); } return sb.ToString(); }
//保存 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(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //判断目的表单ID是否重复 DataTable dt_table = Hyoa_tableconfig.GetTable(txttableidbymd.Text); if (dt_table.Rows.Count > 0) { Response.Write("<script>alert('目的表单ID已存在!');</script>"); return; } //插入TABLE配置 DataTable tableconfigdt = Hyoa_tableconfig.GetTablesbymudelid(this.lbmudelidbysource.Text); if (tableconfigdt.Rows.Count > 0) { Hyoa_tableconfig.ID = txttableidbymd.Text; Hyoa_tableconfig.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_tableconfig.hy_name = this.txttablenamebymd.Text; Hyoa_tableconfig.hy_onload = tableconfigdt.Rows[0]["hy_onload"].ToString(); Hyoa_tableconfig.hy_sort = float.Parse(this.txttablesortbymd.Text); Hyoa_tableconfig.hy_ifflowdoc = this.ddlifflowdoc.SelectedValue; Hyoa_tableconfig.hy_ifdisplayall = tableconfigdt.Rows[0]["hy_ifdisplayall"].ToString(); Hyoa_tableconfig.hy_ispuballByflowYB = tableconfigdt.Rows[0]["hy_ispuballByflowYB"].ToString(); Hyoa_tableconfig.hy_tablerole = tableconfigdt.Rows[0]["hy_tablerole"].ToString(); Hyoa_tableconfig.hy_ifcomment = tableconfigdt.Rows[0]["hy_ifcomment"].ToString(); Hyoa_tableconfig.hy_colnum = float.Parse(tableconfigdt.Rows[0]["hy_colnum"].ToString()); Hyoa_tableconfig.hy_field1 = tableconfigdt.Rows[0]["hy_field1"].ToString(); Hyoa_tableconfig.hy_field2 = tableconfigdt.Rows[0]["hy_field2"].ToString(); Hyoa_tableconfig.hy_field3 = tableconfigdt.Rows[0]["hy_field3"].ToString(); Hyoa_tableconfig.hy_field4 = tableconfigdt.Rows[0]["hy_field4"].ToString(); Hyoa_tableconfig.hy_field5 = tableconfigdt.Rows[0]["hy_field5"].ToString(); Hyoa_tableconfig.Insert(); } //插入FIELD配置 int i; DataTable flowfielddt = Hyoa_flowfield.Getflowfieldsbytableid(this.lbtableidbysorce.Text); if (flowfielddt.Rows.Count > 0) { for (i = 0; i < flowfielddt.Rows.Count; i++) { Hyoa_flowfield.ID = Hyoa_global.GetRandom(); Hyoa_flowfield.hy_tableid = txttableidbymd.Text; Hyoa_flowfield.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_flowfield.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowfield.hy_fieldid = flowfielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowfield.hy_fieldname = flowfielddt.Rows[i]["hy_fieldname"].ToString(); Hyoa_flowfield.hy_fieldtype = flowfielddt.Rows[i]["hy_fieldtype"].ToString(); Hyoa_flowfield.hy_ifreadonly = flowfielddt.Rows[i]["hy_ifreadonly"].ToString(); Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(flowfielddt.Rows[i]["hy_defaultvaluetype"].ToString()); Hyoa_flowfield.hy_defaultvalue = flowfielddt.Rows[i]["hy_defaultvalue"].ToString(); Hyoa_flowfield.hy_optiontype = System.Int32.Parse(flowfielddt.Rows[i]["hy_optiontype"].ToString()); Hyoa_flowfield.hy_options = flowfielddt.Rows[i]["hy_options"].ToString(); Hyoa_flowfield.hy_onclick = flowfielddt.Rows[i]["hy_onclick"].ToString(); Hyoa_flowfield.hy_ondblclick = flowfielddt.Rows[i]["hy_ondblclick"].ToString(); Hyoa_flowfield.hy_onchange = flowfielddt.Rows[i]["hy_onchange"].ToString(); Hyoa_flowfield.hy_onkeydown = flowfielddt.Rows[i]["hy_onkeydown"].ToString(); Hyoa_flowfield.hy_onkeyup = flowfielddt.Rows[i]["hy_onkeyup"].ToString(); Hyoa_flowfield.hy_sqlfield = flowfielddt.Rows[i]["hy_sqlfield"].ToString(); Hyoa_flowfield.hy_class = flowfielddt.Rows[i]["hy_class"].ToString(); Hyoa_flowfield.hy_width = flowfielddt.Rows[i]["hy_width"].ToString(); Hyoa_flowfield.hy_height = flowfielddt.Rows[i]["hy_height"].ToString(); Hyoa_flowfield.hy_tdnums = System.Int32.Parse(flowfielddt.Rows[i]["hy_tdnums"].ToString()); Hyoa_flowfield.hy_config = flowfielddt.Rows[i]["hy_config"].ToString(); Hyoa_flowfield.hy_sort = float.Parse(flowfielddt.Rows[i]["hy_sort"].ToString()); Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(flowfielddt.Rows[i]["hy_wordlimit"].ToString()); Hyoa_flowfield.hy_required = flowfielddt.Rows[i]["hy_required"].ToString(); Hyoa_flowfield.hy_align = flowfielddt.Rows[i]["hy_align"].ToString(); Hyoa_flowfield.hy_ifhiddle = flowfielddt.Rows[i]["hy_ifhiddle"].ToString(); Hyoa_flowfield.hy_ifdbsybt = flowfielddt.Rows[i]["hy_ifdbsybt"].ToString(); Hyoa_flowfield.hy_field1 = flowfielddt.Rows[i]["hy_field1"].ToString(); Hyoa_flowfield.hy_field2 = flowfielddt.Rows[i]["hy_field2"].ToString(); Hyoa_flowfield.hy_field3 = flowfielddt.Rows[i]["hy_field3"].ToString(); Hyoa_flowfield.hy_field4 = flowfielddt.Rows[i]["hy_field4"].ToString(); Hyoa_flowfield.hy_field5 = flowfielddt.Rows[i]["hy_field5"].ToString(); Hyoa_flowfield.Insert(); } } //生成SQL/ORACLE中的表 string sql = ""; if (Session["conntype"].ToString() == "SQL") { sql = "select * into hyc_" + txttableidbymd.Text + " from hyc_" + this.lbtableidbysorce.Text + " where 1=0"; } if (Session["conntype"].ToString() == "ORACLE") { sql = "create table hyc_" + txttableidbymd.Text + " as select * from hyc_" + this.lbtableidbysorce.Text + " where 1=2"; } Hyoa_global.ExcuteSQL(sql); //以下为流程模块的功能,非流程模块不需要执行 if (this.ddlifflowdoc.SelectedValue == "是") { HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable flowinfordt = Hyoa_flowinfor.Getflowinforbymudelid(this.lbmudelidbysource.Text); string lssoureceflowid = flowfielddt.Rows[0]["hy_flowid"].ToString();//得到老模块的flowid 后面要用到 //插入流程信息start Hyoa_flowinfor.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowinfor.hy_flowname =this.txtflownamebymd.Text; Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtflowsortbymd.Text); Hyoa_flowinfor.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_flowinfor.Insert(); //插入流程信息end //string lssql3 = "select * from hyt_flowtache where hy_flowid = 'flow0004'";//流程对应的环节 HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache(); DataTable flowtachedt = Hyoa_flowtache.Getflowtachebyflowid(lssoureceflowid); if (flowtachedt.Rows.Count > 0) { for (i = 0; i < flowtachedt.Rows.Count; i++) { Hyoa_flowtache.ID = Hyoa_global.GetRandom(); Hyoa_flowtache.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtache.hy_tacheid = flowtachedt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtache.hy_tachename = flowtachedt.Rows[i]["hy_tachename"].ToString(); Hyoa_flowtache.hy_sort = System.Int32.Parse(flowtachedt.Rows[i]["hy_sort"].ToString()); Hyoa_flowtache.hy_ifshowcurcomp = flowtachedt.Rows[i]["hy_ifshowcurcomp"].ToString(); Hyoa_flowtache.hy_ifshowcurdept = flowtachedt.Rows[i]["hy_ifshowcurdept"].ToString(); Hyoa_flowtache.hy_XValue = flowtachedt.Rows[i]["hy_XValue"].ToString(); Hyoa_flowtache.hy_YValue = flowtachedt.Rows[i]["hy_YValue"].ToString(); Hyoa_flowtache.hy_rdDoIsSendSms = flowtachedt.Rows[i]["hy_rdDoIsSendSms"].ToString(); Hyoa_flowtache.hy_rdDoIsSendMessage = flowtachedt.Rows[i]["hy_rdDoIsSendMessage"].ToString(); Hyoa_flowtache.hy_rdPassIsSendSms = flowtachedt.Rows[i]["hy_rdPassIsSendSms"].ToString(); Hyoa_flowtache.hy_rdPassIsSendMessage = flowtachedt.Rows[i]["hy_rdPassIsSendMessage"].ToString(); Hyoa_flowtache.hy_enablecondition = flowtachedt.Rows[i]["hy_enablecondition"].ToString(); Hyoa_flowtache.Insert(); } } //string lssql4 = "select * from hyt_flowtachefield where hy_flowid='flow0004'";//流程环节对应的域 HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); DataTable flowtachefielddt = Hyoa_flowtachefield.Getflowtachefieldbyflowid(lssoureceflowid); if (flowtachefielddt.Rows.Count > 0) { for (i = 0; i < flowtachefielddt.Rows.Count; i++) { Hyoa_flowtachefield.ID = Hyoa_global.GetRandom(); Hyoa_flowtachefield.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtachefield.hy_tacheid = flowtachefielddt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtachefield.hy_fieldid = flowtachefielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowtachefield.Insert(); } } //string lssql5 = "select * from hyt_flowtacheuser where hy_flowid='flow0004'";//流程环节对应的用户 HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); DataTable flowtacheuserdt = Hyoa_flowtacheuser.Getflowtacheuserbyflowid(lssoureceflowid); if (flowtacheuserdt.Rows.Count > 0) { for (i = 0; i < flowtacheuserdt.Rows.Count; i++) { Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); Hyoa_flowtacheuser.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtacheuser.hy_tacheid = flowtacheuserdt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtacheuser.hy_userid = flowtacheuserdt.Rows[i]["hy_userid"].ToString(); Hyoa_flowtacheuser.Insert(); } } //string lssql6 = "select * from hyt_flowwork where hy_flowid='flow0004'";//流程的下环节对应什么,即工作流 HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable flowworkdt = Hyoa_flowwork.Getflowworksbyflowid(lssoureceflowid); if (flowworkdt.Rows.Count > 0) { for (i = 0; i < flowworkdt.Rows.Count; i++) { Hyoa_flowwork.ID = Hyoa_global.GetRandom(); Hyoa_flowwork.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowwork.hy_curtacheid = flowworkdt.Rows[i]["hy_curtacheid"].ToString(); Hyoa_flowwork.hy_curtachename = flowworkdt.Rows[i]["hy_curtachename"].ToString(); Hyoa_flowwork.hy_nexttacheid = flowworkdt.Rows[i]["hy_nexttacheid"].ToString(); Hyoa_flowwork.hy_nexttachename = flowworkdt.Rows[i]["hy_nexttachename"].ToString(); Hyoa_flowwork.hy_sort = System.Int32.Parse(flowworkdt.Rows[i]["hy_sort"].ToString()); Hyoa_flowwork.hy_actiontype = flowworkdt.Rows[i]["hy_actiontype"].ToString(); Hyoa_flowwork.hy_identity_type = flowworkdt.Rows[i]["hy_identity_type"].ToString(); Hyoa_flowwork.hy_identity_id = flowworkdt.Rows[i]["hy_identity_id"].ToString(); Hyoa_flowwork.hy_jscondition = flowworkdt.Rows[i]["hy_jscondition"].ToString(); Hyoa_flowwork.hy_jscondition1 = flowworkdt.Rows[i]["hy_jscondition1"].ToString(); Hyoa_flowwork.hy_jscondition2 = flowworkdt.Rows[i]["hy_jscondition2"].ToString(); Hyoa_flowwork.hy_zdcyuserids = flowworkdt.Rows[i]["hy_zdcyuserids"].ToString(); Hyoa_flowwork.Insert(); } } } //处理完成后的提示及跳转 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>"); } }
/// <summary> /// 将Web控件导出 /// </summary> /// <param name="source">控件实例</param> /// <param name="type">类型:Excel或Word</param> public void ExpertControl(string ls_ids, DocumentType type) { //设置Http的头信息,编码格式 if (type == DocumentType.Excel) { //Excel Response.AppendHeader("Content-Disposition", "attachment;filename=result.xls"); Response.ContentType = "application/ms-excel"; } else if (type == DocumentType.Word) { //Word Response.AppendHeader("Content-Disposition", "attachment;filename=result.doc"); Response.ContentType = "application/ms-word97"; } Response.Charset = "Default"; Response.ContentEncoding = System.Text.Encoding.Default; //关闭控件的视图状态 //source.Page.EnableViewState = false; //初始化HtmlWriter //System.IO.StringWriter writer = new System.IO.StringWriter(); //System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer); //source.RenderControl(htmlWriter); string ls_mid = ""; if (this.Request.QueryString["mid"] != null) { ls_mid = this.Request.QueryString["mid"].ToString(); } string ls_tableid = ""; if (this.Request.QueryString["tableid"] != null) { ls_tableid = this.Request.QueryString["tableid"].ToString(); } //根据模块ID+表单ID得到对应的域 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dt_flowfield = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid); string[] lv_left = new string[dt_flowfield.Rows.Count]; double[] lv_tatal = new double[dt_flowfield.Rows.Count]; string[] lv_right = new string[dt_flowfield.Rows.Count]; for (int i = 0; i < dt_flowfield.Rows.Count; i++) { if (dt_flowfield.Rows[i]["hy_sqlfield"].ToString().Contains("hy_field")) { if (dt_flowfield.Rows[i]["hy_fieldname"].ToString().IndexOf('(') >= 0 && dt_flowfield.Rows[i]["hy_fieldname"].ToString().IndexOf(')') >= 0) { lv_left[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString().Substring(0, dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('(')); lv_tatal[i] = 0; lv_right[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString().Substring(dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('(') + 1, dt_flowfield.Rows[i]["hy_fieldname"].ToString().Length - dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('(') - 2); } else { lv_left[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString(); lv_tatal[i] = 0; lv_right[i] = ""; } } } //得到数据 HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain(); string[] lv_ids = ls_ids.Split(','); for (var i = 0; i < lv_ids.Length; i++) { if (lv_ids[i] != "") { DataTable dt = Hyoa_flowmain.Getflowmain(lv_ids[i]); if (dt.Rows.Count > 0) { if (dt_flowfield.Rows.Count > 0) { for (var j = 0; j < dt_flowfield.Rows.Count; j++) { if (dt_flowfield.Rows[j]["hy_sqlfield"].ToString().Contains("hy_field")) { if (dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString() == "") lv_tatal[j] = lv_tatal[j]; else lv_tatal[j] = lv_tatal[j] + double.Parse(dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString()); //if (j < dt_flowfield.Rows.Count - 1) //{ // Response.Write(dt_flowfield.Rows[j]["hy_fieldname"].ToString() + ":"); // Response.Write(dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString() + ","); //} } } //Response.Write("\n"); //Response.Write("\n"); } } } } Int32 li_xh = 1; //第一次"其中不合格"不让换行 string ls_flag = "0"; Response.Write(li_xh.ToString() + "."); for (var i = 0; i < lv_tatal.Length; i++) { if (lv_left[i] != null) { //如果是其中受理进出境保税区货物的时候,加“。”换行 if (lv_left[i].ToString() == "检疫查验船舶") { Response.Write("。"); Response.Write("\n"); Response.Write("\n"); li_xh += 1; Response.Write(li_xh.ToString() + "."); } else { if (lv_left[i].ToString() == "查验进境废物原料") { Response.Write("。"); Response.Write("\n"); Response.Write("\n"); li_xh += 1; Response.Write(li_xh.ToString() + "."); } else { if (lv_left[i].ToString() == "规费收入(不包含国航数据)") { Response.Write("。"); Response.Write("\n"); Response.Write("\n"); li_xh += 1; Response.Write(li_xh.ToString() + "."); } else { if (lv_left[i].ToString() == "行政处罚") { Response.Write("。"); Response.Write("\n"); Response.Write("\n"); li_xh += 1; Response.Write(li_xh.ToString() + "."); } else { if (lv_left[i].ToString() == "罚没") { Response.Write("。"); } else { //Response.Write(i.ToString()); if (i != 4) { Response.Write(","); } } } } } } Response.Write(lv_left[i].ToString()); Response.Write(lv_tatal[i].ToString()); Response.Write(lv_right[i].ToString()); } } Response.Write("。"); Response.End(); }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx"); string ls_tip = "保存成功!"; //string lssql1 = "SELECT * FROM hyt_flowfield WHERE hy_tableid = '" + this.lbtableidbysorce.Text + "'"; //得到配置字段 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); int i; DataTable flowfielddt = Hyoa_flowfield.Getflowfieldsbytableid(this.lbtableidbysorce.Text); string newtableid; newtableid = Hyoa_global.GetRandom(); if (flowfielddt.Rows.Count > 0) { for (i = 0; i < flowfielddt.Rows.Count; i++) { Hyoa_flowfield.ID = Hyoa_global.GetRandom(); Hyoa_flowfield.hy_tableid = newtableid; Hyoa_flowfield.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_flowfield.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowfield.hy_fieldid = flowfielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowfield.hy_fieldname = flowfielddt.Rows[i]["hy_fieldname"].ToString(); Hyoa_flowfield.hy_fieldtype = flowfielddt.Rows[i]["hy_fieldtype"].ToString(); Hyoa_flowfield.hy_ifreadonly = flowfielddt.Rows[i]["hy_ifreadonly"].ToString(); Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(flowfielddt.Rows[i]["hy_defaultvaluetype"].ToString()); Hyoa_flowfield.hy_defaultvalue = flowfielddt.Rows[i]["hy_defaultvalue"].ToString(); Hyoa_flowfield.hy_optiontype = System.Int32.Parse(flowfielddt.Rows[i]["hy_optiontype"].ToString()); Hyoa_flowfield.hy_options = flowfielddt.Rows[i]["hy_options"].ToString(); Hyoa_flowfield.hy_onclick = flowfielddt.Rows[i]["hy_onclick"].ToString(); Hyoa_flowfield.hy_ondblclick = flowfielddt.Rows[i]["hy_ondblclick"].ToString(); Hyoa_flowfield.hy_onchange = flowfielddt.Rows[i]["hy_onchange"].ToString(); Hyoa_flowfield.hy_onkeydown = flowfielddt.Rows[i]["hy_onkeydown"].ToString(); Hyoa_flowfield.hy_onkeyup = flowfielddt.Rows[i]["hy_onkeyup"].ToString(); Hyoa_flowfield.hy_sqlfield = flowfielddt.Rows[i]["hy_sqlfield"].ToString(); Hyoa_flowfield.hy_class = flowfielddt.Rows[i]["hy_class"].ToString(); Hyoa_flowfield.hy_width = flowfielddt.Rows[i]["hy_width"].ToString(); Hyoa_flowfield.hy_height = flowfielddt.Rows[i]["hy_height"].ToString(); Hyoa_flowfield.hy_tdnums = System.Int32.Parse(flowfielddt.Rows[i]["hy_tdnums"].ToString()); Hyoa_flowfield.hy_config = flowfielddt.Rows[i]["hy_config"].ToString(); Hyoa_flowfield.hy_sort = System.Int32.Parse(flowfielddt.Rows[i]["hy_sort"].ToString()); Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(flowfielddt.Rows[i]["hy_wordlimit"].ToString()); Hyoa_flowfield.hy_required = flowfielddt.Rows[i]["hy_required"].ToString(); Hyoa_flowfield.hy_align = flowfielddt.Rows[i]["hy_align"].ToString(); Hyoa_flowfield.Insert(); } } HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); //hyt_tableconfig DataTable tableconfigdt = Hyoa_tableconfig.GetTablesbymudelid(this.lbmudelidbysource.Text); if (tableconfigdt.Rows.Count > 0) { Hyoa_tableconfig.ID = newtableid; Hyoa_tableconfig.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_tableconfig.hy_name = this.txttablenamebymd.Text; Hyoa_tableconfig.hy_onload = tableconfigdt.Rows[0]["hy_onload"].ToString(); Hyoa_tableconfig.hy_sort = System.Int32.Parse(this.txttablesortbymd.Text); Hyoa_tableconfig.hy_ifflowdoc = this.ddlifflowdoc.SelectedValue; Hyoa_tableconfig.hy_ifdisplayall = tableconfigdt.Rows[0]["hy_ifdisplayall"].ToString(); Hyoa_tableconfig.hy_ispuballByflowYB = tableconfigdt.Rows[0]["hy_ispuballByflowYB"].ToString(); Hyoa_tableconfig.hy_tablerole = tableconfigdt.Rows[0]["hy_tablerole"].ToString(); Hyoa_tableconfig.Insert(); } //以下为流程模块的功能,非流程模块不需要执行 if (this.ddlifflowdoc.SelectedValue == "是") { //string lssql2 = "SELECT * FROM hyt_flowinfor WHERE hy_mudelid = 'bgyply'";//得到模块对应的流程 HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); DataTable flowinfordt = Hyoa_flowinfor.Getflowinforbymudelid(this.lbmudelidbysource.Text); string lssoureceflowid = flowfielddt.Rows[0]["hy_flowid"].ToString();//得到老模块的flowid 后面要用到 //插入流程信息start Hyoa_flowinfor.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowinfor.hy_flowname =this.txtflownamebymd.Text; Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtflowsortbymd.Text); Hyoa_flowinfor.hy_mudelid = this.ddlmudelidbymd.SelectedValue; Hyoa_flowinfor.Insert(); //插入流程信息end //string lssql3 = "select * from hyt_flowtache where hy_flowid = 'flow0004'";//流程对应的环节 HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache(); DataTable flowtachedt = Hyoa_flowtache.Getflowtachebyflowid(lssoureceflowid); if (flowtachedt.Rows.Count > 0) { for (i = 0; i < flowtachedt.Rows.Count; i++) { Hyoa_flowtache.ID = Hyoa_global.GetRandom(); Hyoa_flowtache.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtache.hy_tacheid = flowtachedt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtache.hy_tachename = flowtachedt.Rows[i]["hy_tachename"].ToString(); Hyoa_flowtache.hy_sort = System.Int32.Parse(flowtachedt.Rows[i]["hy_sort"].ToString()); Hyoa_flowtache.hy_ifshowcurdept = flowtachedt.Rows[i]["hy_ifshowcurdept"].ToString(); Hyoa_flowtache.hy_XValue = flowtachedt.Rows[i]["hy_XValue"].ToString(); Hyoa_flowtache.hy_YValue = flowtachedt.Rows[i]["hy_YValue"].ToString(); Hyoa_flowtache.hy_rdDoIsSendSms = flowtachedt.Rows[i]["hy_rdDoIsSendSms"].ToString(); Hyoa_flowtache.hy_rdDoIsSendMessage = flowtachedt.Rows[i]["hy_rdDoIsSendMessage"].ToString(); Hyoa_flowtache.hy_rdPassIsSendSms = flowtachedt.Rows[i]["hy_rdPassIsSendSms"].ToString(); Hyoa_flowtache.hy_rdPassIsSendMessage = flowtachedt.Rows[i]["hy_rdPassIsSendMessage"].ToString(); Hyoa_flowtache.Insert(); } } //string lssql4 = "select * from hyt_flowtachefield where hy_flowid='flow0004'";//流程环节对应的域 HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); DataTable flowtachefielddt = Hyoa_flowtachefield.Getflowtachefieldbyflowid(lssoureceflowid); if (flowtachefielddt.Rows.Count > 0) { for (i = 0; i < flowtachefielddt.Rows.Count; i++) { Hyoa_flowtachefield.ID = Hyoa_global.GetRandom(); Hyoa_flowtachefield.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtachefield.hy_tacheid = flowtachefielddt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtachefield.hy_fieldid = flowtachefielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowtachefield.Insert(); } } //string lssql5 = "select * from hyt_flowtacheuser where hy_flowid='flow0004'";//流程环节对应的用户 HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); DataTable flowtacheuserdt = Hyoa_flowtacheuser.Getflowtacheuserbyflowid(lssoureceflowid); if (flowtacheuserdt.Rows.Count > 0) { for (i = 0; i < flowtacheuserdt.Rows.Count; i++) { Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); Hyoa_flowtacheuser.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowtacheuser.hy_tacheid = flowtacheuserdt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtacheuser.hy_userid = flowtacheuserdt.Rows[i]["hy_userid"].ToString(); Hyoa_flowtacheuser.Insert(); } } //string lssql6 = "select * from hyt_flowwork where hy_flowid='flow0004'";//流程的下环节对应什么,即工作流 HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable flowworkdt = Hyoa_flowwork.Getflowworksbyflowid(lssoureceflowid); if (flowworkdt.Rows.Count > 0) { for (i = 0; i < flowworkdt.Rows.Count; i++) { Hyoa_flowwork.ID = Hyoa_global.GetRandom(); Hyoa_flowwork.hy_flowid = this.txtflowidbymd.Text; Hyoa_flowwork.hy_curtacheid = flowworkdt.Rows[i]["hy_curtacheid"].ToString(); Hyoa_flowwork.hy_curtachename = flowworkdt.Rows[i]["hy_curtachename"].ToString(); Hyoa_flowwork.hy_nexttacheid = flowworkdt.Rows[i]["hy_nexttacheid"].ToString(); Hyoa_flowwork.hy_nexttachename = flowworkdt.Rows[i]["hy_nexttachename"].ToString(); Hyoa_flowwork.hy_sort = System.Int32.Parse(flowworkdt.Rows[i]["hy_sort"].ToString()); Hyoa_flowwork.hy_actiontype = flowworkdt.Rows[i]["hy_actiontype"].ToString(); Hyoa_flowwork.Insert(); } } } //处理完成后的提示及跳转 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>"); } }
//fy20130801 导入功能 protected void btnDRToSQL_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //链接SQL数据库 if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件 { Response.Write("<script>alert('请您选择Excel文件')</script> "); return; //当无文件时,返回 } string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { Response.Write("<script>alert('只可以选择Excel文件')</script>"); return; //当选择的不是Excel文件时,返回 } //根据年份判断在该路径下是否存在以当年年份文件夹 否则将建立以该年份的文件夹 string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); //HttpContext.Current.Server.MapPath(相对路径):把相对路径转为服务器上的绝对路径。File.Exists(绝对路径):检查是否存在绝对路径指向的文件或目录。 if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny)) { //System.IO.Directory.CreateDirectory(文件夹绝对路径):建立绝对路径文件夹。 System.IO.Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny); } string filename = DateTime.Now.ToString("hhMMss") + FileUpload1.FileName; //重新为文件命名,获取Execle文件名 DateTime日期函数 // 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里""必须用"\"代替 string savePath = Server.MapPath(("~\\upload/" + ls_ny + "\\") + filename);//Server.MapPath 获得虚拟服务器相对路径 FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上 DataSet ds = ExecleDs(savePath, filename); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); //定义一个DataRow数组 int rowsnum = ds.Tables[0].Rows.Count; int i_into = 0; if (rowsnum == 0) { Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示 } else { String ls_zbdocid = ""; //总表的文档id,用于记录到子表中的关联字段中 int li_excelcolumnnum=0; for (int i = 0; i < dr.Length; i++) { try { String sql = ""; String insertstr_left = ""; String insertstr_right = ""; if (dr[i][0].ToString() != "") { //总表 ls_zbdocid = Hyoa_global.GetRandom(); DataTable dt_field = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(mudelid.Text, tableid.Text); if (dt_field.Rows.Count > 0) { insertstr_left = "insert into hyc_" + tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj"; insertstr_right = "'" + ls_zbdocid + "','" + mudelid.Text + "','" + tableid.Text + "','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; li_excelcolumnnum = 0; int jj = 0; for (int j = 0; j < dt_field.Rows.Count; j++) { String field_type = dt_field.Rows[j]["hy_fieldtype"].ToString(); if (field_type == "文本" || field_type == "多行文本" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器") { insertstr_left += ",hyc_" + dt_field.Rows[j]["hy_fieldid"].ToString(); if (j == 0) { insertstr_right += ",'" + Session["hyuname"].ToString() + "'"; //登记人 } else { if (j == 1) { insertstr_right += ",'" + System.DateTime.Now.ToString("yyyy-MM-dd") + "'"; //登记时间 } else { if (j == 2) { insertstr_right += ",'" + Session["hydeptname"].ToString() + "'"; //登记部门 } else { insertstr_right += ",'" + dr[i][jj].ToString() + "'"; li_excelcolumnnum += 1; jj += 1; } } } } } } } else { //子表 DataTable dt_field = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid("Mudeljgyjzxtz_kzgz", "Tableykzgz"); if (dt_field.Rows.Count > 0) { insertstr_left = "insert into hyc_Tableykzgz (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_motherid"; insertstr_right = "'" + Hyoa_global.GetRandom() + "','Mudeljgyjzxtz_kzgz','Tableykzgz','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + ls_zbdocid + "'"; for (int j = 0; j < dt_field.Rows.Count; j++) { String field_type = dt_field.Rows[j]["hy_fieldtype"].ToString(); if (field_type == "文本" || field_type == "多行文本" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器") { insertstr_left += ",hyc_" + dt_field.Rows[j]["hy_fieldid"].ToString(); insertstr_right += ",'" + dr[i][li_excelcolumnnum+j].ToString() + "'"; } } } } sql = insertstr_left + ") values (" + insertstr_right + ")"; //Response.Write(sql + "<br />"); Hyoa_global.ExcuteSQL(sql); i_into = i_into + 1; } catch { } finally { } } //返回页面 Response.Write("<script>alert('已成功导入" + i_into.ToString() + "条记录!');window.location='import_jgyjzx.aspx?mid="+mudelid.Text+"&tableid="+tableid.Text+"&listid=&rnd="+Hyoa_global.GetRandom()+"'</script>"); } }
//保存或提交时的JS代码(赋值),动态架构 Written by xf 20110714 public string ReplaceMainInput() { string ls_mid = ""; if (this.Request.QueryString["mid"] != null) { ls_mid = this.Request.QueryString["mid"].ToString(); if (ls_mid.Contains(",")) ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(",")); } string ls_tableid = ""; if (this.Request.QueryString["tableid"] != null) { ls_tableid = this.Request.QueryString["tableid"].ToString(); if (ls_tableid.Contains(",")) ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(",")); } string ls_return = ""; HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //根据模块ID和表单ID得到对应的配置字段 DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid); if (dt_gettablecolumns.Rows.Count > 0) { //赋值代码 for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++) { if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令") ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value;}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮") ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = RtftoTxt(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value);}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值") ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value;}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表") ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.options[fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.selectedIndex].value;}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框") ls_return += "try{var ls_select=\"\";var ls_flag=\"0\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){ls_flag=\"1\";if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_flag==\"1\"){fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value=ls_select;}}catch(err){}"; if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框") ls_return += "try{var ls_select=\"\";var ls_flag=\"0\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){ls_flag=\"1\";if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_flag==\"1\"){fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value=ls_select;}}catch(err){}"; } } return ls_return; }
private void DataPlay() { //是否启用 this.ddlifsearch.Items.Insert(0, "是"); this.ddlifsearch.Items.Insert(1, "否"); //this.ddlifflowdoc.Items.Insert(0, "是"); //this.ddlifflowdoc.Items.Insert(1, "否"); //模块编号 //加载模块信息 HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dtmudel = Hyoa_mudel.Getmudels(); if (dtmudel.Rows.Count > 0) { this.ddlmudelid.DataSource = dtmudel; this.ddlmudelid.DataTextField = "hy_mudelname"; this.ddlmudelid.DataValueField = "hy_mudelid"; this.ddlmudelid.DataBind(); this.ddlmudelid.Items.Insert(0, new ListItem("请选择", "请选择")); this.ddlmudelid.SelectedIndex = 0; //this.ddlmudelid.Items.Insert(0, new ListItem(lsmudel, lsmudelid)); } //dtmudel.Clear(); //加载列信息 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtflowfield; dtflowfield = Hyoa_flowfield.Getflowfields(); if (dtflowfield.Rows.Count > 0) { this.ddlcolumnshow.DataSource = dtflowfield; this.ddlcolumnshow.DataTextField = "hy_fieldname"; this.ddlcolumnshow.DataValueField = "hy_fieldid"; this.ddlcolumnshow.DataBind(); this.ddlcolumnshow.SelectedIndex = 0; } dtflowfield.Clear(); 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") { string ls_xszd=""; string ls_xszdid=""; if (this.Request.QueryString["id"] != null) { //根据id得到信息 this.txtdocid.Value = this.Request.QueryString["id"].ToString(); HyoaClass.DAO db = new HyoaClass.DAO(); string sql = "select * from hyt_searchconfig where ID='" + this.txtdocid.Value + "'"; DataTable dt = db.GetDataTable(sql); if (dt.Rows.Count > 0) { this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString(); //this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString(); if (dt.Rows[0]["hy_ifsearch"].ToString() == "是") this.ddlifsearch.SelectedIndex = 0; else this.ddlifsearch.SelectedIndex = 1; this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString(); this.hy_field41_1.Value = dt.Rows[0]["hy_kckry"].ToString(); this.hy_field43_1.Value = dt.Rows[0]["hy_kckryid"].ToString(); //将列都列出来 string[] lv_columnshowselect; string[] lv_columnshowselectid; lv_columnshowselect = dt.Rows[0]["hy_columnshow"].ToString().Split(','); lv_columnshowselectid = dt.Rows[0]["hy_columnshowid"].ToString().Split(','); for (int j = 0; j < lv_columnshowselect.Length; j++) { this.ddlcolumnshowselect.Items.Insert(j, new ListItem(lv_columnshowselect[j], lv_columnshowselectid[j])); } //根据模块信息得到对应的选择表单值 if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null) { this.ddltableid.Items.Clear(); //根据模块ID得到表单ID HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString()); if (dtgettableid.Rows.Count > 0) { for (var i = 0; i < dtgettableid.Rows.Count; i++) { this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString())); } this.ddltableid.Items.Insert(0, new ListItem("--请选择--", "")); this.ddltableid.Attributes.Add("onchange ", "mudelidonchang() "); //定位 this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString(); } } //排序的字段 //根据模块ID+表单ID+字段ID得到字段中文名 //DataTable dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield"].ToString(), dt.Rows[0]["hy_tableid"].ToString()); //if(dt_flowfield.Rows.Count>0) // this.searchsort.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield"].ToString())); //this.ddlsorttype.SelectedValue = dt.Rows[0]["hy_sorttype"].ToString(); ls_xszd = dt.Rows[0]["hy_xszd"].ToString(); ls_xszdid = dt.Rows[0]["hy_xszdid"].ToString(); } dt.Clear(); //HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); //DataTable dt5 = Hyoa_listsearchfield.Getlistsearchfieldsbylistid(this.txtdocid.Value); //if (dt5.Rows.Count > 0) //{ // for (int m = 0; m < dt5.Rows.Count; m++) // { // this.searchselect.Items.Insert(m, new ListItem(dt5.Rows[m]["hy_field"].ToString(), dt5.Rows[m]["hy_fieldid"].ToString())); // } //} string[] lv_xszd = ls_xszd.Split(','); string[] lv_xszdid = ls_xszdid.Split(','); for (int jj = 0; jj < lv_xszd.Length; jj++) { this.searchselect.Items.Insert(jj, new ListItem(lv_xszd[jj], lv_xszdid[jj])); } } } } }
protected void Page_Load(object sender, EventArgs e) { string ls_mudelid=""; string ls_colname=""; string ls_colid=""; string ls_colname2=""; string ls_colid2=""; string ls_colname3=""; string ls_colid3=""; string ls_tableid = ""; if (this.Request.QueryString["mudelid"] != null) { ls_mudelid = this.Request.QueryString["mudelid"].ToString(); } if (this.Request.QueryString["tableid"] != null) { ls_tableid = this.Request.QueryString["tableid"].ToString(); } //模块对应的域 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dt4 = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mudelid, ls_tableid); if (dt4.Rows.Count > 0) { for (int i = 0; i < dt4.Rows.Count; i++) { if (ls_colname == "") { ls_colname = dt4.Rows[i]["hy_fieldname"].ToString(); ls_colid = dt4.Rows[i]["hy_fieldid"].ToString(); } else { ls_colname = ls_colname + "+" + dt4.Rows[i]["hy_fieldname"].ToString(); ls_colid = ls_colid + "+" + dt4.Rows[i]["hy_fieldid"].ToString(); } } } dt4.Clear(); string lsid = ""; //HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); //dt4 = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(ls_mudelid,ls_tableid); HyoaClass.DAO db = new HyoaClass.DAO(); string sql = "select *from hyt_searchconfig where hy_mudelid='" + ls_mudelid + "' and hy_tableid='" + ls_tableid + "'"; dt4 = db.GetDataTable(sql); if (dt4.Rows.Count > 0) { ls_colname2 = dt4.Rows[0]["hy_columnshow"].ToString(); ls_colid2 = dt4.Rows[0]["hy_columnshowid"].ToString(); lsid = dt4.Rows[0]["ID"].ToString(); ls_colname3 = dt4.Rows[0]["hy_xszd"].ToString(); ls_colid3 = dt4.Rows[0]["hy_xszdid"].ToString(); } dt4.Clear(); //HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); //dt4 = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndListid(ls_mudelid,lsid); //if (dt4.Rows.Count > 0) //{ // for (int k = 0; k < dt4.Rows.Count; k++) // { // if (ls_colname3 == "") // { // ls_colname3 = dt4.Rows[k]["hy_field"].ToString(); // ls_colid3 = dt4.Rows[k]["hy_fieldid"].ToString(); // } // else // { // ls_colname3 = ls_colname3 + "+" + dt4.Rows[k]["hy_field"].ToString(); // ls_colid3 = ls_colid3 + "+" + dt4.Rows[k]["hy_fieldid"].ToString(); // } // } //} //HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); //this.Response.Write(ls_colname + "*" + ls_colid + "#" + ls_colname2 + "*" + ls_colid2); this.Response.Write(ls_colname + "*" + ls_colid + "#" + ls_colname2 + "*" + ls_colid2 + "#" + ls_colname3 + "*" + ls_colid3); //return ; }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "复制成功!"; try { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache(); HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); #region 生成权限 DataTable dt = Hyoa_role.Getrole("Role" + this.txtmudelid.Text); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该权限编号已存在,请重新填写!');history.back();</script>"); return; } else { Hyoa_role.hy_roleid = "Role" + this.txtmudelid.Text; Hyoa_role.hy_rolename = this.txtmudelname.Text; Hyoa_role.hy_sort = System.Int32.Parse(this.txtno.Value); Hyoa_role.Insert(); } #endregion #region 生成模块 dt = Hyoa_mudel.Getmudel("Mudel" + this.txtmudelid.Text); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该模块编号已存在,请重新填写!');history.back();</script>"); return; } else { Hyoa_mudel.hy_mudelid = "Mudel" + this.txtmudelid.Text; Hyoa_mudel.hy_mudelname = this.txtmudelname.Text; Hyoa_mudel.hy_sort = System.Int32.Parse(this.txtno.Value); Hyoa_mudel.hy_isenabled = "是"; Hyoa_mudel.hy_roleid = "Role" + this.txtmudelid.Text; Hyoa_mudel.hy_qqroleid = "Role" + this.txtmudelid.Text; Hyoa_mudel.Insert(); } #endregion #region 生成表单 DataTable tableconfigdt = Hyoa_tableconfig.GetTablesbymudelid(this.ddlmudelid.SelectedValue); if (tableconfigdt.Rows.Count > 0) { Hyoa_tableconfig.ID = "Table" + this.txtmudelid.Text; Hyoa_tableconfig.hy_mudelid = "Mudel" + this.txtmudelid.Text; Hyoa_tableconfig.hy_name = this.txtmudelname.Text; Hyoa_tableconfig.hy_onload = tableconfigdt.Rows[0]["hy_onload"].ToString(); Hyoa_tableconfig.hy_sort = float.Parse(this.txtno.Value); Hyoa_tableconfig.hy_ifflowdoc = tableconfigdt.Rows[0]["hy_ifflowdoc"].ToString(); Hyoa_tableconfig.hy_ifdisplayall = tableconfigdt.Rows[0]["hy_ifdisplayall"].ToString(); Hyoa_tableconfig.hy_ispuballByflowYB = tableconfigdt.Rows[0]["hy_ispuballByflowYB"].ToString(); Hyoa_tableconfig.hy_tablerole = tableconfigdt.Rows[0]["hy_tablerole"].ToString(); Hyoa_tableconfig.hy_ifcomment = tableconfigdt.Rows[0]["hy_ifcomment"].ToString(); Hyoa_tableconfig.hy_colnum = float.Parse(tableconfigdt.Rows[0]["hy_colnum"].ToString()); Hyoa_tableconfig.hy_field1 = tableconfigdt.Rows[0]["hy_field1"].ToString(); Hyoa_tableconfig.hy_field2 = tableconfigdt.Rows[0]["hy_field2"].ToString(); Hyoa_tableconfig.hy_field3 = tableconfigdt.Rows[0]["hy_field3"].ToString(); Hyoa_tableconfig.hy_field4 = tableconfigdt.Rows[0]["hy_field4"].ToString(); Hyoa_tableconfig.hy_field5 = tableconfigdt.Rows[0]["hy_field5"].ToString(); Hyoa_tableconfig.Insert(); } #endregion #region 生成表单字段 int i; DataTable flowfielddt = Hyoa_flowfield.Getflowfieldsbytableid(this.ddltableid.SelectedValue); if (flowfielddt.Rows.Count > 0) { for (i = 0; i < flowfielddt.Rows.Count; i++) { Hyoa_flowfield.ID = Hyoa_global.GetRandom(); Hyoa_flowfield.hy_tableid = "Table" + this.txtmudelid.Text; Hyoa_flowfield.hy_mudelid = "Mudel" + this.txtmudelid.Text; Hyoa_flowfield.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowfield.hy_fieldid = flowfielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowfield.hy_fieldname = flowfielddt.Rows[i]["hy_fieldname"].ToString(); Hyoa_flowfield.hy_fieldtype = flowfielddt.Rows[i]["hy_fieldtype"].ToString(); Hyoa_flowfield.hy_ifreadonly = flowfielddt.Rows[i]["hy_ifreadonly"].ToString(); Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(flowfielddt.Rows[i]["hy_defaultvaluetype"].ToString()); Hyoa_flowfield.hy_defaultvalue = flowfielddt.Rows[i]["hy_defaultvalue"].ToString(); Hyoa_flowfield.hy_optiontype = System.Int32.Parse(flowfielddt.Rows[i]["hy_optiontype"].ToString()); Hyoa_flowfield.hy_options = flowfielddt.Rows[i]["hy_options"].ToString(); Hyoa_flowfield.hy_onclick = flowfielddt.Rows[i]["hy_onclick"].ToString(); Hyoa_flowfield.hy_ondblclick = flowfielddt.Rows[i]["hy_ondblclick"].ToString(); Hyoa_flowfield.hy_onchange = flowfielddt.Rows[i]["hy_onchange"].ToString(); Hyoa_flowfield.hy_onkeydown = flowfielddt.Rows[i]["hy_onkeydown"].ToString(); Hyoa_flowfield.hy_onkeyup = flowfielddt.Rows[i]["hy_onkeyup"].ToString(); Hyoa_flowfield.hy_onfocus = flowfielddt.Rows[i]["hy_onfocus"].ToString(); Hyoa_flowfield.hy_onblur = flowfielddt.Rows[i]["hy_onblur"].ToString(); Hyoa_flowfield.hy_sqlfield = flowfielddt.Rows[i]["hy_sqlfield"].ToString(); Hyoa_flowfield.hy_class = flowfielddt.Rows[i]["hy_class"].ToString(); Hyoa_flowfield.hy_width = flowfielddt.Rows[i]["hy_width"].ToString(); Hyoa_flowfield.hy_height = flowfielddt.Rows[i]["hy_height"].ToString(); Hyoa_flowfield.hy_tdnums = System.Int32.Parse(flowfielddt.Rows[i]["hy_tdnums"].ToString()); Hyoa_flowfield.hy_config = flowfielddt.Rows[i]["hy_config"].ToString(); Hyoa_flowfield.hy_sort = float.Parse(flowfielddt.Rows[i]["hy_sort"].ToString()); Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(flowfielddt.Rows[i]["hy_wordlimit"].ToString()); Hyoa_flowfield.hy_required = flowfielddt.Rows[i]["hy_required"].ToString(); Hyoa_flowfield.hy_align = flowfielddt.Rows[i]["hy_align"].ToString(); Hyoa_flowfield.hy_ifhiddle = flowfielddt.Rows[i]["hy_ifhiddle"].ToString(); Hyoa_flowfield.hy_ifdbsybt = flowfielddt.Rows[i]["hy_ifdbsybt"].ToString(); Hyoa_flowfield.hy_field1 = flowfielddt.Rows[i]["hy_field1"].ToString(); Hyoa_flowfield.hy_field2 = flowfielddt.Rows[i]["hy_field2"].ToString(); Hyoa_flowfield.hy_field3 = flowfielddt.Rows[i]["hy_field3"].ToString(); Hyoa_flowfield.hy_field4 = flowfielddt.Rows[i]["hy_field4"].ToString(); Hyoa_flowfield.hy_field5 = flowfielddt.Rows[i]["hy_field5"].ToString(); Hyoa_flowfield.Insert(); } } #endregion #region 生成SQL/ORACLE中的表 string sql = ""; if (Session["conntype"].ToString() == "SQL") { sql = "select * into hyc_Table" + this.txtmudelid.Text + " from hyc_" + this.ddltableid.SelectedValue + " where 1=0"; } if (Session["conntype"].ToString() == "ORACLE") { sql = "create table hyc_Table" + this.txtmudelid.Text + " as select * from hyc_" + this.ddltableid.SelectedValue + " where 1=2"; } Hyoa_global.ExcuteSQL(sql); #endregion #region 生成列表 DataTable listconfigdt = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(this.ddlmudelid.SelectedValue, this.ddltableid.SelectedValue); //列表ID string strListId = Hyoa_global.GetRandom(); if (listconfigdt.Rows.Count > 0) { Hyoa_listconfig.hy_mudelid = "Mudel" + this.txtmudelid.Text; Hyoa_listconfig.hy_tableid = "Table" + this.txtmudelid.Text; Hyoa_listconfig.hy_ifflowdoc = listconfigdt.Rows[0]["hy_ifflowdoc"].ToString(); Hyoa_listconfig.hy_sort = System.Int32.Parse(this.txtno.Value); Hyoa_listconfig.hy_columnshowid = listconfigdt.Rows[0]["hy_columnshowid"].ToString(); Hyoa_listconfig.hy_columnshow = listconfigdt.Rows[0]["hy_columnshow"].ToString(); Hyoa_listconfig.hy_ifsearch = listconfigdt.Rows[0]["hy_ifsearch"].ToString(); Hyoa_listconfig.hy_ifshowsearch = listconfigdt.Rows[0]["hy_ifshowsearch"].ToString(); Hyoa_listconfig.hy_width = listconfigdt.Rows[0]["hy_width"].ToString(); Hyoa_listconfig.hy_listname = this.txtmudelname.Text; Hyoa_listconfig.hy_sortfield1 = listconfigdt.Rows[0]["hy_sortfield1"].ToString(); Hyoa_listconfig.hy_sorttype1 = listconfigdt.Rows[0]["hy_sorttype1"].ToString(); Hyoa_listconfig.hy_sortfield2 = listconfigdt.Rows[0]["hy_sortfield2"].ToString(); Hyoa_listconfig.hy_sorttype2 = listconfigdt.Rows[0]["hy_sorttype2"].ToString(); Hyoa_listconfig.hy_sortfield3 = listconfigdt.Rows[0]["hy_sortfield3"].ToString(); Hyoa_listconfig.hy_sorttype3 = listconfigdt.Rows[0]["hy_sorttype3"].ToString(); Hyoa_listconfig.hy_fieldid_fl1 = listconfigdt.Rows[0]["hy_fieldid_fl1"].ToString(); Hyoa_listconfig.hy_fieldname_fl1 = listconfigdt.Rows[0]["hy_fieldname_fl1"].ToString(); Hyoa_listconfig.hy_sql_fl1 = listconfigdt.Rows[0]["hy_sql_fl1"].ToString(); Hyoa_listconfig.hy_fieldid_fl2 = listconfigdt.Rows[0]["hy_fieldid_fl2"].ToString(); Hyoa_listconfig.hy_fieldname_fl2 = listconfigdt.Rows[0]["hy_fieldname_fl2"].ToString(); Hyoa_listconfig.hy_sql_fl2 = listconfigdt.Rows[0]["hy_sql_fl2"].ToString(); Hyoa_listconfig.hy_fieldid_fl3 = listconfigdt.Rows[0]["hy_fieldid_fl3"].ToString(); Hyoa_listconfig.hy_fieldname_fl3 = listconfigdt.Rows[0]["hy_fieldname_fl3"].ToString(); Hyoa_listconfig.hy_sql_fl3 = listconfigdt.Rows[0]["hy_sql_fl3"].ToString(); Hyoa_listconfig.ID = strListId; Hyoa_listconfig.Insert(); } #endregion #region 生成列表查询条件 DataTable listsearchdt = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.ddlmudelid.SelectedValue, this.ddltableid.SelectedValue); for (int m = 0; m < listsearchdt.Rows.Count; m++) { Hyoa_listsearchfield.ID = Hyoa_global.GetRandom(); Hyoa_listsearchfield.hy_listid = strListId; Hyoa_listsearchfield.hy_mudelid = "Mudel" + this.txtmudelid.Text; Hyoa_listsearchfield.hy_tableid = "Table" + this.txtmudelid.Text; Hyoa_listsearchfield.hy_field = listsearchdt.Rows[m]["hy_field"].ToString(); Hyoa_listsearchfield.hy_fieldid = listsearchdt.Rows[m]["hy_fieldid"].ToString(); Hyoa_listsearchfield.hy_sort = m + 2; Hyoa_listsearchfield.Insert(); } #endregion #region 生成流程信息 string lssoureceflowid = ""; if (tableconfigdt.Rows[0]["hy_ifflowdoc"].ToString() == "是") { DataTable flowinfordt = Hyoa_flowinfor.Getflowinforbymudelid(this.ddlmudelid.SelectedValue); if (flowinfordt.Rows.Count > 0) { //得到老模块的flowid 后面要用到 lssoureceflowid = flowfielddt.Rows[0]["hy_flowid"].ToString(); //插入流程信息start Hyoa_flowinfor.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowinfor.hy_flowname = this.txtmudelname.Text; Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtno.Value); Hyoa_flowinfor.hy_mudelid = "Mudel" + this.txtmudelid.Text; // Hyoa_flowinfor.hy_addbyalluser = flowinfordt.Rows[0]["hy_addbyalluser"].ToString(); Hyoa_flowinfor.Insert(); } //插入流程信息end //流程环节 DataTable flowtachedt = Hyoa_flowtache.Getflowtachebyflowid(lssoureceflowid); if (flowtachedt.Rows.Count > 0) { for (i = 0; i < flowtachedt.Rows.Count; i++) { Hyoa_flowtache.ID = Hyoa_global.GetRandom(); Hyoa_flowtache.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowtache.hy_tacheid = flowtachedt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtache.hy_tachename = flowtachedt.Rows[i]["hy_tachename"].ToString(); Hyoa_flowtache.hy_sort = System.Int32.Parse(flowtachedt.Rows[i]["hy_sort"].ToString()); Hyoa_flowtache.hy_ifshowcurcomp = flowtachedt.Rows[i]["hy_ifshowcurcomp"].ToString(); Hyoa_flowtache.hy_ifshowcurdept = flowtachedt.Rows[i]["hy_ifshowcurdept"].ToString(); Hyoa_flowtache.hy_XValue = flowtachedt.Rows[i]["hy_XValue"].ToString(); Hyoa_flowtache.hy_YValue = flowtachedt.Rows[i]["hy_YValue"].ToString(); Hyoa_flowtache.hy_rdDoIsSendSms = flowtachedt.Rows[i]["hy_rdDoIsSendSms"].ToString(); Hyoa_flowtache.hy_rdDoIsSendMessage = flowtachedt.Rows[i]["hy_rdDoIsSendMessage"].ToString(); Hyoa_flowtache.hy_rdPassIsSendSms = flowtachedt.Rows[i]["hy_rdPassIsSendSms"].ToString(); Hyoa_flowtache.hy_rdPassIsSendMessage = flowtachedt.Rows[i]["hy_rdPassIsSendMessage"].ToString(); Hyoa_flowtache.hy_enablecondition = flowtachedt.Rows[i]["hy_enablecondition"].ToString(); Hyoa_flowtache.Insert(); } } //流程环节对应的域 DataTable flowtachefielddt = Hyoa_flowtachefield.Getflowtachefieldbyflowid(lssoureceflowid); if (flowtachefielddt.Rows.Count > 0) { for (i = 0; i < flowtachefielddt.Rows.Count; i++) { Hyoa_flowtachefield.ID = Hyoa_global.GetRandom(); Hyoa_flowtachefield.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowtachefield.hy_tacheid = flowtachefielddt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtachefield.hy_fieldid = flowtachefielddt.Rows[i]["hy_fieldid"].ToString(); Hyoa_flowtachefield.Insert(); } } //流程环节对应的用户 DataTable flowtacheuserdt = Hyoa_flowtacheuser.Getflowtacheuserbyflowid(lssoureceflowid); if (flowtacheuserdt.Rows.Count > 0) { for (i = 0; i < flowtacheuserdt.Rows.Count; i++) { Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); Hyoa_flowtacheuser.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowtacheuser.hy_tacheid = flowtacheuserdt.Rows[i]["hy_tacheid"].ToString(); Hyoa_flowtacheuser.hy_userid = flowtacheuserdt.Rows[i]["hy_userid"].ToString(); Hyoa_flowtacheuser.Insert(); } } //工作流 DataTable flowworkdt = Hyoa_flowwork.Getflowworksbyflowid(lssoureceflowid); if (flowworkdt.Rows.Count > 0) { for (i = 0; i < flowworkdt.Rows.Count; i++) { Hyoa_flowwork.ID = Hyoa_global.GetRandom(); Hyoa_flowwork.hy_flowid = "Flow" + this.txtmudelid.Text; Hyoa_flowwork.hy_curtacheid = flowworkdt.Rows[i]["hy_curtacheid"].ToString(); Hyoa_flowwork.hy_curtachename = flowworkdt.Rows[i]["hy_curtachename"].ToString(); Hyoa_flowwork.hy_nexttacheid = flowworkdt.Rows[i]["hy_nexttacheid"].ToString(); Hyoa_flowwork.hy_nexttachename = flowworkdt.Rows[i]["hy_nexttachename"].ToString(); Hyoa_flowwork.hy_sort = System.Int32.Parse(flowworkdt.Rows[i]["hy_sort"].ToString()); Hyoa_flowwork.hy_actiontype = flowworkdt.Rows[i]["hy_actiontype"].ToString(); Hyoa_flowwork.hy_identity_type = flowworkdt.Rows[i]["hy_identity_type"].ToString(); Hyoa_flowwork.hy_identity_id = flowworkdt.Rows[i]["hy_identity_id"].ToString(); Hyoa_flowwork.hy_jscondition = flowworkdt.Rows[i]["hy_jscondition"].ToString(); Hyoa_flowwork.hy_jscondition1 = flowworkdt.Rows[i]["hy_jscondition1"].ToString(); Hyoa_flowwork.hy_jscondition2 = flowworkdt.Rows[i]["hy_jscondition2"].ToString(); Hyoa_flowwork.hy_zdcyuserids = flowworkdt.Rows[i]["hy_zdcyuserids"].ToString(); Hyoa_flowwork.Insert(); } } } #endregion } catch { ls_tip = "复制失败!"; } finally { Response.Write("<script>alert('" + ls_tip + "');window.location.href='" + txturl.Text + "';</script>"); } }
//得到表单的HTML //pi_isnewdoc 0:新文档 1:旧文档 //ifhavarole:表单上是否有权限 0:lable输出 1:input输出 //ifflowdoc:是否流程表单 0:非流程 1:流程 //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限 public void GetMainTableHtml(string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid) { //////////////////////////////////输出显示字段/////////////////////////////////////// //得到所有需要显示的字段 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield_show = Hyoa_flowfield.Getflowfields_show_bytableid(this.hy_tableid.Text); //得到表单配置信息 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dt_tableconfig = Hyoa_tableconfig.GetTable(this.hy_tableid.Text); int li_tdnums_onerow = int.Parse(dt_tableconfig.Rows[0]["hy_colnum"].ToString()); //一行有几个TD int li_tdnums_total = 0; //所有字段的tdnums总和 int li_colnums_show = li_tdnums_onerow / 2; int li_rows_show = 0; //一共有几行 int li_ifaddcols = 0; //所有列显示完成后,是否需要补齐显示列 0:否 1:是 int li_addcols = 0; //需要补齐的列数量 for (int i = 0; i < dtfield_show.Rows.Count; i++) { if (dtfield_show.Rows[i]["hy_defaultvaluetype"].ToString() == "5") //不显示左侧列 { li_tdnums_total += int.Parse(dtfield_show.Rows[i]["hy_tdnums"].ToString()); } else { li_tdnums_total += int.Parse(dtfield_show.Rows[i]["hy_tdnums"].ToString()) + 1; } } if (li_tdnums_total % li_tdnums_onerow == 0) { li_rows_show = li_tdnums_total / li_tdnums_onerow; li_ifaddcols = 0; } else { li_rows_show = (li_tdnums_total / li_tdnums_onerow) + 1; li_ifaddcols = 1; li_addcols = li_tdnums_onerow - (li_tdnums_total % li_tdnums_onerow); } int t = 0; //dtlistsearch中的记录行数 int li_tdnums_currows = 0; //当前行已经输出了多少个TD了 for (int i = 0; i < li_rows_show; i++) { TableRow tRow = new TableRow(); tb_main.Rows.Add(tRow); li_tdnums_currows = 0; for (int j = 0; j < li_tdnums_onerow; j++) { //dtlistsearch中的记录行数超出总行数时,结束循环 if ((t + 1) > dtfield_show.Rows.Count) { break; } //当前行输出的TD列数超出每行的总列数时,结束循环 if (li_tdnums_currows >= li_tdnums_onerow) { break; } li_tdnums_currows = GetFieldHtml(tRow, li_tdnums_currows, li_colnums_show, dtfield_show.Rows[t]["hy_fieldid"].ToString(), pi_isnewdoc, ifhavarole, ifflowdoc, curtacheid); t += 1; } //如果最后一行的列没有显示完整,则补齐 if (li_ifaddcols == 1 && i == (li_rows_show - 1)) { for (int k = 0; k < (li_addcols / 2); k++) { TableCell tCell8 = new TableCell(); tRow.Cells.Add(tCell8); tCell8.Height = Unit.Pixel(30); tCell8.CssClass = "Tdcellleft"; tCell8.HorizontalAlign = HorizontalAlign.Center; tCell8.Controls.Add(new LiteralControl(" ")); TableCell tCell9 = new TableCell(); tRow.Cells.Add(tCell9); tCell9.Height = Unit.Pixel(30); tCell9.CssClass = "Tdcellright"; tCell9.HorizontalAlign = HorizontalAlign.Center; tCell9.Controls.Add(new LiteralControl(" ")); } } } //////////////////////////////////最后输出隐藏字段/////////////////////////////////////// //得到所有需要显示的字段 dtfield_show.Clear(); dtfield_show = Hyoa_flowfield.Getflowfields_hidden_bytableid(this.hy_tableid.Text); li_tdnums_total = 0; //所有字段的tdnums总和 li_rows_show = 0; //一共有几行 li_ifaddcols = 0; //所有列显示完成后,是否需要补齐显示列 0:否 1:是 li_addcols = 0; //需要补齐的列数量 for (int i = 0; i < dtfield_show.Rows.Count; i++) { if (dtfield_show.Rows[i]["hy_defaultvaluetype"].ToString() == "5") //不显示左侧列 { li_tdnums_total += int.Parse(dtfield_show.Rows[i]["hy_tdnums"].ToString()); } else { li_tdnums_total += int.Parse(dtfield_show.Rows[i]["hy_tdnums"].ToString()) + 1; } } if (li_tdnums_total % li_tdnums_onerow == 0) { li_rows_show = li_tdnums_total / li_tdnums_onerow; li_ifaddcols = 0; } else { li_rows_show = (li_tdnums_total / li_tdnums_onerow) + 1; li_ifaddcols = 1; li_addcols = li_tdnums_onerow - (li_tdnums_total % li_tdnums_onerow); } t = 0; //dtlistsearch中的记录行数 li_tdnums_currows = 0; //当前行已经输出了多少个TD了 for (int i = 0; i < li_rows_show; i++) { TableRow tRow = new TableRow(); tRow.Style.Value = "display:none"; tb_main.Rows.Add(tRow); li_tdnums_currows = 0; for (int j = 0; j < li_tdnums_onerow; j++) { //dtlistsearch中的记录行数超出总行数时,结束循环 if ((t + 1) > dtfield_show.Rows.Count) { break; } //当前行输出的TD列数超出每行的总列数时,结束循环 if (li_tdnums_currows >= li_tdnums_onerow) { break; } li_tdnums_currows = GetFieldHtml(tRow, li_tdnums_currows, li_colnums_show, dtfield_show.Rows[t]["hy_fieldid"].ToString(), pi_isnewdoc, ifhavarole, ifflowdoc, curtacheid); t += 1; } //如果最后一行的列没有显示完整,则补齐 if (li_ifaddcols == 1 && i == (li_rows_show - 1)) { for (int k = 0; k < (li_addcols / 2); k++) { TableCell tCell8 = new TableCell(); tRow.Cells.Add(tCell8); tCell8.Height = Unit.Pixel(30); tCell8.CssClass = "Tdcellleft"; tCell8.HorizontalAlign = HorizontalAlign.Center; tCell8.Controls.Add(new LiteralControl(" ")); TableCell tCell9 = new TableCell(); tRow.Cells.Add(tCell9); tCell9.Height = Unit.Pixel(30); tCell9.CssClass = "Tdcellright"; tCell9.HorizontalAlign = HorizontalAlign.Center; tCell9.Controls.Add(new LiteralControl(" ")); } } } }
//fy20130801 导入功能 protected void btnDRToSQL_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //链接SQL数据库 if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件 { Response.Write("<script>alert('请您选择Excel文件')</script> "); return; //当无文件时,返回 } string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { Response.Write("<script>alert('只可以选择Excel文件')</script>"); return; //当选择的不是Excel文件时,返回 } //根据年份判断在该路径下是否存在以当年年份文件夹 否则将建立以该年份的文件夹 string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); //HttpContext.Current.Server.MapPath(相对路径):把相对路径转为服务器上的绝对路径。File.Exists(绝对路径):检查是否存在绝对路径指向的文件或目录。 if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny)) { //System.IO.Directory.CreateDirectory(文件夹绝对路径):建立绝对路径文件夹。 System.IO.Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny); } string filename = DateTime.Now.ToString("hhMMss") + FileUpload1.FileName; //重新为文件命名,获取Execle文件名 DateTime日期函数 // 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里""必须用"\"代替 string savePath = Server.MapPath(("~\\upload/" + ls_ny + "\\") + filename);//Server.MapPath 获得虚拟服务器相对路径 FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上 DataSet ds = ExecleDs(savePath, filename); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); //定义一个DataRow数组 int rowsnum = ds.Tables[0].Rows.Count; int i_into = 0; if (rowsnum == 0) { Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示 } else { for (int i = 0; i < dr.Length; i++) { string lsHyfl = dr[i]["行业分类"].ToString(); string lsJtfl = dr[i]["具体分类"].ToString(); string lsDw = dr[i]["单位"].ToString(); string lsWhjb = dr[i]["维护级别"].ToString(); string lsZrbm = dr[i]["责任部门/责任人"].ToString(); string lsXzbm = dr[i]["协助部门/协助人"].ToString(); string lsQt = dr[i]["其他"].ToString(); string lsBz = dr[i]["备注"].ToString(); string lsBgdz = dr[i]["办公(单位)地址"].ToString(); string lsXm = dr[i]["姓名"].ToString(); string lsCs = dr[i]["处室"].ToString(); string lsZw = dr[i]["职位"].ToString(); string lsXb = dr[i]["性别"].ToString(); string lsSr = dr[i]["生日"].ToString(); string lsSj = dr[i]["手机"].ToString(); string lsBgdh = dr[i]["办公室电话"].ToString(); string lsZzdh = dr[i]["住宅电话"].ToString(); string lsDzyx = dr[i]["电子邮箱"].ToString(); string lsQQ = dr[i]["QQ"].ToString(); string lsWx = dr[i]["微信"].ToString(); string lsJtzz = dr[i]["家庭住址"].ToString(); //先插入客户表 string SqlInsert = "insert into hyc_Tablekhda (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,"; SqlInsert += " hyc_hyfl,hyc_jtfl,hyc_dwmc,hyc_whjb,hyc_khjl,hyc_xzbm,hyc_bz,hyc_qt,hyc_dwdz) values("; SqlInsert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablekhda','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', "; SqlInsert += " '" + lsHyfl + "','" + lsJtfl + "','" + lsDw + "','" + lsWhjb + "','" + lsZrbm + "','" + lsXzbm + "','" + lsBz + "','" + lsQt + "','"+lsBgdz+"')"; Hyoa_global.ExcuteSQL(SqlInsert); //插入联系人表 if (lsXm.Contains(",")) { string[] arryLxrxm = lsXm.Split(','); string[] arryLxrcs = lsCs.Split(','); string[] arryLxrzw = lsZw.Split(','); string[] arryLxrxb= lsXb.Split(','); string[] arryLxrsr = lsSr.Split(','); string[] arryLxrsj = lsSj.Split(','); string[] arryLxrbgdh = lsBgdh.Split(','); string[] arryLxrzzdh = lsZzdh.Split(','); string[] arryLxrdzyx = lsDzyx.Split(','); string[] arryLxrqq = lsQQ.Split(','); string[] arryLxrwx = lsWx.Split(','); string[] arryLxrjtzz = lsJtzz.Split(','); for (int j = 0; j< arryLxrxm.Length;j++ ) { SqlInsert = "insert into hyc_Tablelxr (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,"; SqlInsert += " hyc_dwmc,hyc_cs,hyc_lxrmc,hyc_zw,hyc_xb,hyc_sr,hyc_sjhm,hyc_dh,hyc_zzdh,hyc_dzyx,hyc_qq,hyc_wx,hyc_dz,hyc_jtdz) values("; SqlInsert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablelxr','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', "; SqlInsert += " '" + lsDw + "','" + arryLxrcs[j] + "','" + arryLxrxm[j] + "','" + arryLxrzw[j] + "','" + arryLxrxb[j] + "','" + arryLxrsr[j] + "','" + arryLxrsj[j] + "','" + arryLxrbgdh[j] + "','" + arryLxrzzdh[j] + "','" + arryLxrdzyx[j] + "','" + arryLxrqq[j] + "','" + arryLxrwx[j] + "','" + lsBgdz + "','" + arryLxrjtzz[j] + "')"; Response.Write(SqlInsert); Hyoa_global.ExcuteSQL(SqlInsert); } } else { SqlInsert = "insert into hyc_Tablelxr (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,"; SqlInsert += " hyc_dwmc,hyc_cs,hyc_lxrmc,hyc_zw,hyc_xb,hyc_sr,hyc_sjhm,hyc_dh,hyc_zzdh,hyc_dzyx,hyc_qq,hyc_wx,hyc_dz,hyc_jtdz) values("; SqlInsert += "'" + Hyoa_global.GetRandom() + "','Mudelkhda','Tablelxr','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', "; SqlInsert += " '" + lsDw + "','" + lsCs + "','" + lsXm + "','" + lsZw + "','" + lsXb + "','" + lsSr + "','" + lsSj + "','" + lsBgdh + "','" + lsZzdh + "','" + lsDzyx + "','" + lsQQ + "','" + lsWx + "','" + lsBgdz + "','" + lsJtzz + "')"; Hyoa_global.ExcuteSQL(SqlInsert); } } // Response.Write("<script>alert('导入成功!');</script>"); } }
//输出一个字段 public void GetFieldHtml(TableRow tRow, int li_colnums_show, string hy_fieldid) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //得到字段属性 DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, hy_fieldid, this.txttableid.Value); if (dtfield.Rows.Count > 0) { string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //插入单元格(左侧) TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); tCell.Width = Unit.Percentage((30 / li_colnums_show)); tCell.Height = Unit.Pixel(30); tCell.CssClass = "Tdcellleft"; tCell.HorizontalAlign = HorizontalAlign.Center; tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString())); //插入单元格(右侧) TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); tCell2.Width = Unit.Percentage((70 / li_colnums_show)); tCell2.Height = Unit.Pixel(30); tCell2.CssClass = "Tdcellright"; tCell2.HorizontalAlign = HorizontalAlign.Left; //单行文本 if (field_type == "文本") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); //if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") //{ // txtTextBox.ReadOnly = true; //} if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //多行文本 if (field_type == "多行文本") { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); //if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") //{ // txtTextBox.ReadOnly = true; //} if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //日期 if (field_type == "日期") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_s"; if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("45%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Attributes.Add("onclick", "WdatePicker({el:$dp.$('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_s" + "')})"); tCell2.Controls.Add(txtTextBox); tCell2.Controls.Add(new LiteralControl("至")); TextBox txtTextBox2 = new TextBox(); txtTextBox2.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_e"; if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox2.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox2.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox2.Width = Unit.Parse("45%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox2.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox2.Attributes.Add("onclick", "WdatePicker({el:$dp.$('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_e" + "')})"); tCell2.Controls.Add(txtTextBox2); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString() + "_s", "1"); addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString() + "_e", "2"); } //文本加按钮 if (field_type == "文本加按钮") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); //if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") //{ // txtTextBox.ReadOnly = true; //} if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("60%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox); Button btnButton = new Button(); btnButton.ID = "btn_" + dtfield.Rows[0]["hy_fieldid"].ToString(); btnButton.CssClass = "btn3"; btnButton.Text = " 选 择 "; btnButton.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); tCell2.Controls.Add(btnButton); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //多行文本加按钮 if (field_type == "多行文本加按钮") { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); //if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") //{ // txtTextBox.ReadOnly = true; //} if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("60%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox); Button btnButton = new Button(); btnButton.ID = "btn_" + dtfield.Rows[0]["hy_fieldid"].ToString(); btnButton.CssClass = "btn3"; btnButton.Text = " 选 择 "; btnButton.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); tCell2.Controls.Add(btnButton); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //数值 if (field_type == "数值") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_s"; if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("45%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox); tCell2.Controls.Add(new LiteralControl("至")); TextBox txtTextBox2 = new TextBox(); txtTextBox2.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_e"; if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox2.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox2.Width = Unit.Parse("45%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox2.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox2); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString() + "_s", "3"); addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString() + "_e", "4"); } //对话框列表(下拉框 if (field_type == "对话框列表") { DropDownList ddlDropDownList = new DropDownList(); ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { ddlDropDownList.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); ddlDropDownList.DataSource = dt_options; ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataBind(); } } ddlDropDownList.Items.Insert(0, new ListItem("--请选择--", "")); tCell2.Controls.Add(ddlDropDownList); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //复选框(查询时直接显示文本框) if (field_type == "复选框") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } //单选框(查询时直接显示文本框) if (field_type == "单选框") { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个查询条件 addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0"); } } }
//fy20130801 导入功能 protected void btnDRToSQL_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //链接SQL数据库 if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件 { Response.Write("<script>alert('请您选择Excel文件')</script> "); return; //当无文件时,返回 } string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { Response.Write("<script>alert('只可以选择Excel文件')</script>"); return; //当选择的不是Excel文件时,返回 } //根据年份判断在该路径下是否存在以当年年份文件夹 否则将建立以该年份的文件夹 string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); //HttpContext.Current.Server.MapPath(相对路径):把相对路径转为服务器上的绝对路径。File.Exists(绝对路径):检查是否存在绝对路径指向的文件或目录。 if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny)) { //System.IO.Directory.CreateDirectory(文件夹绝对路径):建立绝对路径文件夹。 System.IO.Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny); } string filename = DateTime.Now.ToString("hhMMss") + FileUpload1.FileName; //重新为文件命名,获取Execle文件名 DateTime日期函数 // 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里""必须用"\"代替 string savePath = Server.MapPath(("~\\upload/" + ls_ny + "\\") + filename);//Server.MapPath 获得虚拟服务器相对路径 FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上 DataSet ds = ExecleDs(savePath, filename); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); //定义一个DataRow数组 int rowsnum = ds.Tables[0].Rows.Count; int i_into = 0; string sqlInsert = ""; string strDocid = ""; string sqlSelect = ""; string strUserid = ""; string strUserDeptid = ""; string strUserDeptName = ""; string strYwxf = ""; string strZcl = ""; if (rowsnum == 0) { Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示 } else { for (int i = 0; i < dr.Length; i++) { /* 导入整体思路:数据来自一个excel表,导入的时候先导主表,后导字表。主表按照常规来导,指定哪些字段导入到数据库中,字表依据主表的docid作为父id, * 进行导入,导入之前先判断是excel表中有没有数据,如果有数据,而且不是一些特定的不需要导入的数据,就导入 */ sqlSelect = " select u.hy_userid,d.hy_deptid,d.hy_deptname from hyt_user u join hyt_dept d on u.hy_deptid=d.hy_deptid where u.hy_username='******' "; DataTable dt = Hyoa_global.GetDataTable_USER(sqlSelect); if (dt.Rows.Count > 0) { strUserid = dt.Rows[0]["hy_userid"].ToString(); strUserDeptid = dt.Rows[0]["hy_deptid"].ToString(); strUserDeptName = dt.Rows[0]["hy_deptname"].ToString(); } else { Response.Write("<script>alert('这条数据导错了" + i_into + dr[i][0].ToString() + "');</script>"); Response.Write(sqlSelect); return; } strDocid = System.Guid.NewGuid().ToString(); //导入主表 sqlInsert = " insert into hyc_Tablefpbd( DOCID,hy_bt,hy_clrylist,hy_curclrid,hy_curclrname,hy_curtacheid"; sqlInsert += " ,hy_curtachename,hy_cyrylist,hy_djrbmid,hy_djrbmname,hy_djrid,hy_djrname,hy_djsj"; sqlInsert += " ,hy_flowid,hy_flowname,hy_ifconfirm,hy_iftx,hy_motherid,hy_mudelid,hy_readdatelist"; sqlInsert += " ,hy_readuserlist,hy_tableid,hy_zhtxsj,hyc_bxje,hyc_bxjedx,hyc_djr,hyc_djsj"; sqlInsert += " ,hyc_djz,hyc_fatherid,hyc_fplx,hyc_fplxx,hyc_cpmc1,hyc_fptt,hyc_htkp,hyc_kpsj"; sqlInsert += " ,hyc_muild,hyc_sfbf,hyc_skrq,hyc_tableid,hyc_yf) values ( '" + strDocid + "','',''"; sqlInsert += " ,'" + strUserid + "','" + dr[i][0].ToString() + "','**','流程已结束','," + strUserid + ",'"; sqlInsert += " ,'" + strUserDeptid + "','" + strUserDeptName + "','" + strUserid + "','" + dr[i][0].ToString() + "',getdate(),'Flowfp','发票管理'"; sqlInsert += " ,'','','','Mudelfp','',''"; sqlInsert += " ,'Tablefpbd','','" + dr[i][53].ToString() + "','','" + dr[i][0].ToString() + "',getdate(),'" + strUserDeptName + "'"; sqlInsert += " ,'','" + dr[i][2].ToString() + "','普通增值税发票','" + dr[i][3].ToString() + "','" + dr[i][1].ToString() + "','否','" + dr[i][54].ToString() + "'"; sqlInsert += " ,'','','" + dr[i][55].ToString() + "','','') "; Hyoa_global.ExcuteSQL(sqlInsert); //开始导字表 for (int j = 4; j < 57; j++) { if (dr[i][j].ToString() != "" && (j != 5 || j != 7 || j != 9) && dr[i][j].ToString() != "0") { strYwxf = getChildTable(j); if (strYwxf != "") { //先将“增量”这两个字去掉 if (strYwxf.Contains("增量")) { //将“增量”特定的给一个字符串 strZcl = "增量"; strYwxf = strYwxf.Replace("增量", ""); } else if (strYwxf.Contains("存量")) { strZcl = "存量"; strYwxf = strYwxf.Replace("存量", ""); } else { strZcl = "增量"; } sqlInsert = " insert into hyc_Tablejemx( DOCID,hy_bt,hy_clrylist,hy_curclrid,hy_curclrname,hy_curtacheid"; sqlInsert += " ,hy_curtachename,hy_cyrylist,hy_djrbmid,hy_djrbmname,hy_djrid,hy_djrname,hy_djsj"; sqlInsert += " ,hy_flowid,hy_flowname,hy_ifconfirm,hy_iftx,hy_motherid,hy_mudelid,hy_readdatelist"; sqlInsert += " ,hy_readuserlist,hy_tableid,hy_zhtxsj,hyc_bxje,hyc_bxjedx,hyc_bz,hyc_sl"; sqlInsert += " ,hyc_ywxf,hyc_zcl) values ( '" + System.Guid.NewGuid().ToString() + "','','','',''"; sqlInsert += " ,'','','','" + strUserDeptid + "','" + strUserDeptName + "','" + strUserid + "'"; sqlInsert += " ,'" + dr[i][0].ToString() + "',getdate(),'','','','','" + strDocid + "'"; sqlInsert += " ,'Mudelfp','','','Tablejemx',''"; if (strYwxf == "基本型" || strYwxf == "交互型") { sqlInsert += " ,'" + dr[i][j + 1].ToString() + "','','" + dr[i][56].ToString() + "','" + dr[i][j].ToString() + "','" + strYwxf + "','" + strZcl + "') "; } else { sqlInsert += " ,'" + dr[i][j].ToString() + "','','" + dr[i][56].ToString() + "','','" + strYwxf + "','" + strZcl + "') "; } Hyoa_global.ExcuteSQL(sqlInsert); } } } i_into = i_into + 1; } } Response.Write("<script>alert('导入成功!共导入" + i_into + "条数据');</script>"); }
private void DataPlay(int PageNo) { //根据表ID和模块ID得到当前传进来的模块是否有流程 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value); //根据表单得到对应的所有字段 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbytableid(dttableconfig.Rows[0]["ID"].ToString()); //循环所有字段 string ls_flowfield = ""; if (dtflowfield.Rows.Count > 0) { for (int i = 0; i < dtflowfield.Rows.Count; i++) { string ls_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString(); if (ls_fieldtype == "文本" || ls_fieldtype == "多行文本" || ls_fieldtype == "文本加按钮" || ls_fieldtype == "多行文本加按钮" || ls_fieldtype == "日期" || ls_fieldtype == "数值" || ls_fieldtype == "对话框列表" || ls_fieldtype == "复选框" || ls_fieldtype == "单选框" || ls_fieldtype == "口令") { ls_flowfield += ",a.hyc_" + dtflowfield.Rows[i]["hy_fieldid"].ToString(); } } } HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); DataTable dtlist = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value); //列表配置 this.lbdisplaytitle.Text = ""; //得到当前页号 this.curpage.Text = PageNo.ToString(); //---查询条件---开始 string cmdStr_Search = ""; if (txtsearchfields.Text != "") { string[] lv_searchfields = txtsearchfields.Text.Split(','); string[] lv_searchfields_sx = txtsearchfields_sx.Text.Split(','); for (int i = 0; i < lv_searchfields.Length; i++) { string ls_fieldid = lv_searchfields[i].ToString(); string ls_fieldid_sx = lv_searchfields_sx[i].ToString(); string ls_searchtext = ""; if (this.Request.Form[ls_fieldid] != null) { ls_searchtext = this.Request.Form[ls_fieldid].ToString(); } if (ls_searchtext != "") { if (ls_fieldid_sx == "0") { cmdStr_Search += " and hyc_" + ls_fieldid + " like '%" + ls_searchtext + "%' "; } else { if (ls_fieldid_sx == "1") { if (Session["conntype"].ToString() == "SQL") { cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) >= '" + ls_searchtext + "' "; } if (Session["conntype"].ToString() == "ORACLE") { cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') >= '" + ls_searchtext + "' "; } } if (ls_fieldid_sx == "2") { if (Session["conntype"].ToString() == "SQL") { cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) <= '" + ls_searchtext + "' "; } if (Session["conntype"].ToString() == "ORACLE") { cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') <= '" + ls_searchtext + "' "; } } if (ls_fieldid_sx == "3") { cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " >= " + ls_searchtext + " "; } if (ls_fieldid_sx == "4") { cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " <= " + ls_searchtext + " "; } } } } } //---查询条件---结束 //---排序---开始 string cmdStr_SearchSort = ""; if (dtlist.Rows[0]["hy_sortfield1"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString(); } } if (dtlist.Rows[0]["hy_sortfield2"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString(); } } if (dtlist.Rows[0]["hy_sortfield3"].ToString() != "") { if (cmdStr_SearchSort == "") { cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString(); } else { cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString(); } } if (this.txtfieldid.Value != "" && this.txtfieldsort.Value != "") { cmdStr_SearchSort = " order by hyc_" + this.txtfieldid.Value + " " + this.txtfieldsort.Value + " "; } if (cmdStr_SearchSort == "") { //没有配置,则默认按登记日期 cmdStr_SearchSort = " order by hy_djsj desc "; } //---排序---结束 //--根据查询条件得到返回数据集--s DataTable dt = new DataTable(); //单页数据集 DataTable dt_total = new DataTable(); //数据总条数,返回总条数值 DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value); //得到表配置信息查看当前表是否有流程 hy_ifflowdoc string cmdStr = ""; string ls_from = ""; ls_from = " hyc_" + this.txttableid.Value + " where 1=1 and hy_djrbmid='" + Session["hydeptid"].ToString() + "' " + cmdStr_Search; if (Session["conntype"].ToString() == "SQL") { cmdStr = "select top " + PageSize.Text + " * from " + ls_from; cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * int.Parse(PageSize.Text)).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort; } if (Session["conntype"].ToString() == "ORACLE") { cmdStr = " select * from ( "; cmdStr += " select my_table.*, rownum as my_rownum from "; cmdStr += " ( "; cmdStr += " select * from hyc_" + this.txttableid.Value + " where 1=1 and hy_djrbmid='" + Session["hydeptid"].ToString() + "' " + cmdStr_Search + cmdStr_SearchSort; cmdStr += " ) my_table "; cmdStr += " where rownum<= " + ((PageNo) * int.Parse(PageSize.Text)).ToString(); cmdStr += " ) where my_rownum> " + ((PageNo - 1) * int.Parse(PageSize.Text)).ToString(); } dt = Hyoa_global.GetDataTable(cmdStr); cmdStr = "select count(*) from " + ls_from; dt_total = Hyoa_global.GetDataTable(cmdStr); //--根据查询条件得到返回数据集--e //开始输出----整合成HTML为数据行 DataTable tempTable = dt.Clone(); DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列 add tempTable.Columns.Add(col); //追加一列 add string lscolname = ""; string lscolnameid = ""; string lscolwidth = ""; string ls_col = ""; string[] lvcolname; string[] lvcolnameid; string[] lvcolwidth; string lscolwidthper; lscolname = dtlist.Rows[0]["hy_columnshow"].ToString(); //要显示的列名:附件,标题,收文来源 lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString(); //要显示的列名id:uploadfile1,Hy_bt,Hy_swly lscolwidth = dtlist.Rows[0]["hy_width"].ToString(); //要显示的列名id:10,20,30 lvcolname = lscolname.Split(','); lvcolnameid = lscolnameid.Split(','); lvcolwidth = lscolwidth.Split(','); if (dt.Rows.Count <= 0) { //如果没有数据则输出表头 for (int n = 0; n < lvcolname.Length; n++) { if (n >= lvcolwidth.Length) { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。 else { lscolwidthper = lvcolwidth[n]; } this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>"; } } for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); //输出主表所有字段,start for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } //输出主表所有字段,end //////开始得到列的值 DataTable dtgetsqlfield; for (int m = 0; m < lvcolname.Length; m++) { //如果有数据,则输出数据 if (m >= lvcolwidth.Length) { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。 else { lscolwidthper = lvcolwidth[m]; } dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value); if (i % System.Int32.Parse(PageSize.Text) == 0) this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\"><a href=\"#\" title=\"点击可排序\" onclick=\"fun_sort('" + lvcolnameid[m] + "');\">" + lvcolname[m] + "</a></p></td>"; //根据字段英文名,得到数据库中对应的字段 string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString(); //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换) string lsgetputfiled = ""; if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { if (dt.Rows[i][lsgetsqlfield].ToString() != "") lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString(); } else { //解决Float小数点后面出现N位小数乱码的问题 if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { if (dt.Rows[i][lsgetsqlfield].ToString() != "") { //是否包含小数点,包含的话,取小数点后两位 if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true) { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2"); } else { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString(); } } else { lsgetputfiled = "0"; } //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); } else { lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); } } if (lsgetputfiled == "") lsgetputfiled = " "; //根据得到的SQL字段,得到输出字段的值end if (dtgetsqlfield.Rows[0]["hy_ifdbsybt"].ToString() == "是") { ls_col += "<td width=\"" + lscolwidthper + "%\" align=\"center\"><a href=\"#\" onclick=\"var ss='main.aspx?op=modify&mid=" + dt.Rows[i]["hy_mudelid"].ToString() + "&tableid=" + dt.Rows[i]["hy_tableid"].ToString() + "&docid=" + dt.Rows[i]["DOCID"].ToString() + "&url='+window.location;window.location=ss;\">" + lsgetputfiled + "</a></td>"; } else { ls_col += "<td width=\"" + lscolwidthper + "%\" align=\"center\">" + lsgetputfiled + "</td>"; } } //如果是流程表单,则最后追加两列(当前环节和当前处理人) //表头 if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null && i == 0) { this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前环节</td>"; this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前处理人</td>"; } //数据 if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null) { ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curtachename"].ToString() + " </td>"; ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + " </td>"; } dr["displaycol"] = ls_col; //将新值赋给相应的列 add ls_col = ""; tempTable.Rows.Add(dr); } int TotalRecord = int.Parse(dt_total.Rows[0][0].ToString()); this.sumts.Text = TotalRecord.ToString(); this.sumts2.Text = TotalRecord.ToString(); this.ShowTotalRecord.Text = TotalRecord.ToString(); //计算及显示总页数 int TotalPage; if (TotalRecord < System.Int32.Parse(PageSize.Text)) { TotalPage = 1; } else { if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0) { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1; } else { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text); } } this.ShowTotalPage.Text = TotalPage.ToString(); this.rptlist.DataSource = tempTable; this.rptlist.DataBind(); dt.Clear(); //列表中的一些特殊处理,都放在这个函数内 DataPlay_Tscl(); }
//保存 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>"); } }
public void GetSearchTableHtml() { //输出查询字段的表格(查询输入框) start HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield(); DataTable dtlistsearch = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.txtmudelid.Value, this.txttableid.Value); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //DataTable dtgetsqlfield; string lssearchdispaly = ""; //返回值 //输出外框(开始) lssearchdispaly +="<tr height=40px>"; lssearchdispaly +="<td valign=\"top\" >"; lssearchdispaly +="<table width=\"100%\" border=0>"; lssearchdispaly +="<tr>"; lssearchdispaly +="<td align=\"center\" valign=\"top\">"; lssearchdispaly +="<table width=\"100%\" height=\"5\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; lssearchdispaly +="<tr>"; lssearchdispaly +="<td></td>"; lssearchdispaly +="</tr>"; lssearchdispaly +="</table>"; lssearchdispaly +="<table width=\"98%\" border=0 cellpadding=0 cellspacing=1 class=\"tb1-main\">"; HyoaClass.DAO db = new HyoaClass.DAO(); string lsflag = "0"; //1表示有</tr>,则最后不用输出,否则循环完后,要输出一个</tr> for (int t = 0; t < dtlistsearch.Rows.Count; t++) { if (t % 2 == 0) { lssearchdispaly += "<tr>"; lsflag = "0"; } //得到hyt_listsearchfield表中的hy_fieldid, string lslistsearch = dtlistsearch.Rows[t]["hy_fieldid"].ToString(); //根据字段英文名得到数据库中对应的字段名,ztmztm DataTable dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lslistsearch, this.txttableid.Value); //得到与SQL表对应的字段名 lssearchdispaly += "<td width=\"15%\" height=\"30\" align=\"center\" class=\"Tdcellleft\">"; lssearchdispaly += dtlistsearch.Rows[t]["hy_field"].ToString(); lssearchdispaly += "</td>"; lssearchdispaly += " <td width=\"35%\" align=\"left\" class=\"Tdcellright\">"; //调用公用函数,输出txt查询框 lssearchdispaly += GetFieldHtml(this.txtmudelid.Value, dtgetsqlfield.Rows[0]["hy_fieldid"].ToString(), "0", this.txttableid.Value, "1"); lssearchdispaly += "</td>"; if ((t + 1) % 2 == 0) { lssearchdispaly += "</tr>"; lsflag = "1"; } dtgetsqlfield.Clear(); } //如果上面</tr>没有输出过,则要输出一个</tr>,保证html的完整性 if (lsflag != "1") { for (int t = 0; t < (4 - dtlistsearch.Rows.Count % 2 * 2); t++) { //如果行不足四列,则要补满四列 lssearchdispaly += " <td align=\"left\" class=\"Tdcellright\">"; lssearchdispaly += " "; lssearchdispaly += "</td>"; } lssearchdispaly += "</tr>"; } //输出外框(结束) lssearchdispaly += "<tr>"; lssearchdispaly += "<td height=\"30\" align=\"right\" class=\"Tdcellright\" colspan=4>"; lssearchdispaly += "<input type=\"button\" onclick=\"jssearch();\" value=\" 查 询\" class=btn7 name=\"Button_Return\" /> "; lssearchdispaly += "</td>"; lssearchdispaly += "</tr>"; lssearchdispaly += "</table>"; lssearchdispaly += "</td>"; lssearchdispaly += "</tr>"; lssearchdispaly += "</table>"; lssearchdispaly += "</td>"; lssearchdispaly += "</tr>"; this.lbsearchidspaly.Text = lssearchdispaly; //输出查询字段的表格 end }
//得到表单的HTML pi_flag 0:不赋值 1:需赋值 Written by xf 20110515 //docid:旧文档使用时,文档ID //ifhavarole:是否有权限 0:lable输出 1:input输出 //ifflowdoc:是否流程表单 0:非流程 1:流程 //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限 public DataTable GetDataTableFieldHtml(string hy_mudelid, string hy_tableid, string pi_flag, string ifsearch, string docid, string ifhavarole, string ifflowdoc, string curtacheid) { //加载表单 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); //根据模块ID和表单ID得到对应的配置字段 DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(hy_mudelid, hy_tableid); string ls_html = ""; Int32 li_tdnums = 0; //TDS数(colspan的值相加) DataTable tempTable = new DataTable(); DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列 add tempTable.Columns.Add(col); //追加一列 add if (dt_gettablecolumns.Rows.Count > 0) { //先从配置表中将配置的列数取出,如果配置表中找不到,则默认为4列,并且设置相应的宽度start HyoaClass.Hyoa_detail Hyoa_detail = new HyoaClass.Hyoa_detail(); int li_col = 4;//一行显示几列 string ls_leftwidth = "15";//左侧列宽 string ls_rightwidth = "35";//右侧列宽 DataTable detaildt = Hyoa_detail.Getdetail(hy_tableid); if (detaildt.Rows.Count > 0) { li_col = int.Parse(detaildt.Rows[0]["hy_colnum"].ToString()); if (detaildt.Rows[0]["hy_colnum"].ToString() == "6") { ls_leftwidth = "10"; ls_rightwidth = "23"; } else { if (detaildt.Rows[0]["hy_colnum"].ToString() == "8") { ls_leftwidth = "5"; ls_rightwidth = "7"; } else { if (detaildt.Rows[0]["hy_colnum"].ToString() == "10") { ls_leftwidth = "4"; ls_rightwidth = "6"; } } } } //先从配置表中将配置的列数取出,如果配置表中找不到,则默认为4列,并且设置相应的宽度end //开始加载字段信息到DT中,用于前台显示 for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++) { if (i == 0) { ls_html += "<TR height=\"30\">"; } //输出字段说明列(文字说明除外) if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() != "说明文字") { //20120724 //如果是隐藏字段,则隐藏(增加display) added by xf 20120217 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") ls_html += "<TD width=\"" + ls_leftwidth + "%\" align=\"center\" class=\"Tdcellleft\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</TD>"; else ls_html += "<div style=\"display:none\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</div>"; //ls_html += "<TD width=\"" + ls_leftwidth + "%\" align=\"center\" class=\"Tdcellleft\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</TD>"; } //得到当前字段的值 HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain(); DataTable dt_flowmain = Hyoa_flowmain.Getflowmain(docid); string field_docvalue = " "; if (dt_flowmain.Rows.Count > 0) { if (dt_gettablecolumns.Rows[i]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { field_docvalue = System.DateTime.Parse(dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString()).ToShortDateString() + field_docvalue; } else { //如果SQL为数值的字段部分,则需要截取小数点后边两位 if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值") { if (dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString().Contains(".") == true) field_docvalue = float.Parse(dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString()).ToString("F2") + field_docvalue; else field_docvalue = dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString() + field_docvalue; } else { field_docvalue = dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString() + field_docvalue; } } } //输出字段列 //this.Response.Write("<script>alert('" + ifhavarole + "');</script>"); if (ifhavarole == "0") //无权限(当前表单来讲) { //附件组件的值需要特定读取(附件需要特殊处理) Added by xf 20110607 if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "附件组件") { field_docvalue = ""; //根据docid得到目前已上传的附件信息 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(docid); if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { string ls_name = ""; DataTable dt_user = Hyoa_user.Getuser(dt_fileatt.Rows[ii]["hy_userid"].ToString()); if (dt_user.Rows.Count > 0) { ls_name = dt_user.Rows[0]["hy_username"].ToString(); } field_docvalue += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + " " + ls_name + " [" + dt_fileatt.Rows[ii]["hy_djsj"].ToString() + "]" + "</a><br />"; } } if (field_docvalue == "") field_docvalue = " "; } //痕迹保留组件的值需要读取(需要特殊处理) Added by xf 20110705 if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "痕迹保留") { field_docvalue = ""; field_docvalue += "<input type=button id=\"btn_zwxg\" value='正 文' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + docid + "&tacheByhj=1&jsxd=1','newwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" "; if (field_docvalue == "") field_docvalue = " "; } //ztmztmztmstart //this.Response.Write("<script>alert('" + field_docvalue + "');</script>"); if (field_docvalue.Length > 7) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = " "; } } //ztmztmztmend if (dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() == "1") { //如果是隐藏字段,则隐藏(增加display) added by xf 20120217 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") ls_html += "<TD width=\"" + ls_rightwidth + "%\" height=\"30px\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\">" + field_docvalue + "</TD>"; else ls_html += "<div style=\"display:none\">" + field_docvalue + "</div>"; //ls_html += "<TD width=\"" + ls_rightwidth + "%\" height=\"30px\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\">" + field_docvalue + "</TD>"; } else { //如果是隐藏字段,则隐藏(增加display) added by xf 20120217 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") ls_html += "<TD width=\"" + ls_rightwidth + "%\" height=\"30px\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\" colspan=" + dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() + ">" + field_docvalue + "</TD>"; else ls_html += "<div style=\"display:none\">" + field_docvalue + "</div>"; //ls_html += "<TD width=\"" + ls_rightwidth + "%\" height=\"30px\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\" colspan=" + dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() + ">" + field_docvalue + "</TD>"; } } else { //有权限(当前表单来讲)时,判断当前流程+当前环节对于这个字段是否有权限操作 string ls_ifhavarole = "0"; //默认没有权限(当前字段来讲)---该功能仅对于流程模块起作用 //非流程直接就有权限了 //this.Response.Write("<script>alert('" + ifflowdoc + "');</script>"); if (ifflowdoc == "0") { ls_ifhavarole = "1"; } else { //判断当前字段是否有权限 HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_ifhavarole = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(dt_gettablecolumns.Rows[i]["hy_flowid"].ToString(), curtacheid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString()); } if (dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() == "1") { //如果是隐藏字段,则隐藏(增加display) added by xf 20120217 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") ls_html += "<TD width=\"" + ls_rightwidth + "%\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</TD>"; else ls_html += "<div style=\"display:none\">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</div>"; //ls_html += "<TD width=\"" + ls_rightwidth + "%\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</TD>"; } else { //如果是隐藏字段,则隐藏(增加display) added by xf 20120217 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") ls_html += "<TD width=\"" + ls_rightwidth + "%\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\" colspan=" + dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() + ">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</TD>"; else ls_html += "<div style=\"display:none\">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</div>"; //ls_html += "<TD width=\"" + ls_rightwidth + "%\" align=" + dt_gettablecolumns.Rows[i]["hy_align"].ToString() + " class=\"Tdcellright\" colspan=" + dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString() + ">" + GetFieldHtml(hy_mudelid, dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString(), pi_flag, hy_tableid, ifsearch, docid, ls_ifhavarole) + "</TD>"; } } //开始colspan值累加,如果是隐藏字段,不计算在内 if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") { if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "说明文字") li_tdnums += System.Int32.Parse(dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString()); else li_tdnums += System.Int32.Parse(dt_gettablecolumns.Rows[i]["hy_tdnums"].ToString()) + 1; } //this.lbtest.Text += "," + li_tdnums; if (li_tdnums % li_col == 0 && dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是") { ls_html += "</tr>"; DataRow dr = tempTable.NewRow(); dr["displaycol"] = ls_html; //将新值赋给相应的列 add tempTable.Rows.Add(dr); ls_html = ""; if (i != (dt_gettablecolumns.Rows.Count - 1)) ls_html += "<tr>"; } //先从配置表中将配置的列数取出,如果配置表中找不到,则默认为4列end } } return tempTable; }
private void DataPlay(int PageNo) { //得到当前模块对应的role HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dt_mudel = Hyoa_mudel.Getmudel(this.txtmudelid.Value); string ls_role = "Role9999"; if (dt_mudel.Rows.Count > 0) ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString(); //根据表ID和模块ID得到当前传进来的模块是否有流程 HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value); //判断当前用户是否有删除权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (dttableconfig.Rows[0]["hy_ifflowdoc"].ToString() == "是") { //如果有流程的话,新建按钮就一直显示,不用作判断的,只要判断删除按钮就行。 if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.delcontrol.Visible = true; this.newcontrol.Visible = true; //this.copycontrol.Visible = false; //流程模块暂时都不能复制 } else { this.isrole.Value = "0"; this.newcontrol.Visible = true; } } else { //如果非流程(授权用户统一管理) if(dttableconfig.Rows[0]["hy_tablerole"].ToString() == "0") { if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.newcontrol.Visible = true; this.delcontrol.Visible = true; //this.copycontrol.Visible = true; } else { this.isrole.Value = "0"; } } //如果非流程(每个人管理自己的信息) if (dttableconfig.Rows[0]["hy_tablerole"].ToString() == "1") { this.isrole.Value = "1"; this.newcontrol.Visible = true; this.delcontrol_my.Visible = true; //this.copycontrol.Visible = true; } //如果非流程(每个人操作自己的信息、授权用户可管理所有信息) if (dttableconfig.Rows[0]["hy_tablerole"].ToString() == "2") { if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.newcontrol.Visible = true; this.delcontrol.Visible = true; //this.copycontrol.Visible = true; } else { this.isrole.Value = "0"; this.newcontrol.Visible = true; this.delcontrol_my.Visible = true; //this.copycontrol.Visible = true; } } } //得到当前页号 this.lbdisplaytitle.Text = ""; this.curpage.Text = PageNo.ToString(); //---查询条件---开始 HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain(); Hyoa_flowmain.hy_mudelid = this.txtmudelid.Value; Hyoa_flowmain.hy_tableid = this.txttableid.Value; Hyoa_flowmain.hy_bt = this.hy_bt.Text; Hyoa_flowmain.hy_djrname = this.hy_djrname.Text; Hyoa_flowmain.hy_djrbmname = this.hy_djrbmname.Text; Hyoa_flowmain.hy_djsj_start = this.hy_djsj_start.Text; Hyoa_flowmain.hy_djsj_end = this.hy_djsj_end.Text; Hyoa_flowmain.hy_bt = this.hy_bt.Text; Hyoa_flowmain.hy_content1 = this.hy_content1.Text; Hyoa_flowmain.hy_content2 = this.hy_content2.Text; Hyoa_flowmain.hy_content3 = this.hy_content3.Text; Hyoa_flowmain.hy_content4 = this.hy_content4.Text; Hyoa_flowmain.hy_content5 = this.hy_content5.Text; Hyoa_flowmain.hy_field1 = this.hy_field1.Text; Hyoa_flowmain.hy_field2 = this.hy_field2.Text; Hyoa_flowmain.hy_field3 = this.hy_field3.Text; Hyoa_flowmain.hy_field4 = this.hy_field4.Text; Hyoa_flowmain.hy_field5 = this.hy_field5.Text; Hyoa_flowmain.hy_field6 = this.hy_field6.Text; Hyoa_flowmain.hy_field7 = this.hy_field7.Text; Hyoa_flowmain.hy_field8 = this.hy_field8.Text; Hyoa_flowmain.hy_field9 = this.hy_field9.Text; Hyoa_flowmain.hy_field10 = this.hy_field10.Text; Hyoa_flowmain.hy_field11 = this.hy_field11.Text; Hyoa_flowmain.hy_field12 = this.hy_field12.Text; Hyoa_flowmain.hy_field13 = this.hy_field13.Text; Hyoa_flowmain.hy_field14 = this.hy_field14.Text; Hyoa_flowmain.hy_field15 = this.hy_field15.Text; Hyoa_flowmain.hy_field16 = this.hy_field16.Text; Hyoa_flowmain.hy_field17 = this.hy_field17.Text; Hyoa_flowmain.hy_field18 = this.hy_field18.Text; Hyoa_flowmain.hy_field19 = this.hy_field19.Text; Hyoa_flowmain.hy_field20 = this.hy_field20.Text; Hyoa_flowmain.hy_field21 = this.hy_field21.Text; Hyoa_flowmain.hy_field22 = this.hy_field22.Text; Hyoa_flowmain.hy_field23 = this.hy_field23.Text; Hyoa_flowmain.hy_field24 = this.hy_field24.Text; Hyoa_flowmain.hy_field25 = this.hy_field25.Text; Hyoa_flowmain.hy_field26 = this.hy_field26.Text; Hyoa_flowmain.hy_field27 = this.hy_field27.Text; Hyoa_flowmain.hy_field28 = this.hy_field28.Text; Hyoa_flowmain.hy_field29 = this.hy_field29.Text; Hyoa_flowmain.hy_field30 = this.hy_field30.Text; Hyoa_flowmain.hy_field31_start = this.hy_field31_start.Text; Hyoa_flowmain.hy_field32_start = this.hy_field32_start.Text; Hyoa_flowmain.hy_field33_start = this.hy_field33_start.Text; Hyoa_flowmain.hy_field34_start = this.hy_field34_start.Text; Hyoa_flowmain.hy_field35_start = this.hy_field35_start.Text; Hyoa_flowmain.hy_field31_end = this.hy_field31_end.Text; Hyoa_flowmain.hy_field32_end = this.hy_field32_end.Text; Hyoa_flowmain.hy_field33_end = this.hy_field33_end.Text; Hyoa_flowmain.hy_field34_end = this.hy_field34_end.Text; Hyoa_flowmain.hy_field35_end = this.hy_field35_end.Text; if (this.hy_field36_start.Text == "") { this.hy_field36_start.Text = "0"; } if (this.hy_field37_start.Text == "") { this.hy_field37_start.Text = "0"; } if (this.hy_field38_start.Text == "") { this.hy_field38_start.Text = "0"; } if (this.hy_field39_start.Text == "") { this.hy_field39_start.Text = "0"; } if (this.hy_field40_start.Text == "") { this.hy_field40_start.Text = "0"; } if (this.hy_field36_end.Text == "") { this.hy_field36_end.Text = "0"; } if (this.hy_field37_end.Text == "") { this.hy_field37_end.Text = "0"; } if (this.hy_field38_end.Text == "") { this.hy_field38_end.Text = "0"; } if (this.hy_field39_end.Text == "") { this.hy_field39_end.Text = "0"; } if (this.hy_field40_end.Text == "") { this.hy_field40_end.Text = "0"; } Hyoa_flowmain.hy_field36_start = float.Parse(this.hy_field36_start.Text); Hyoa_flowmain.hy_field37_start = float.Parse(this.hy_field37_start.Text); Hyoa_flowmain.hy_field38_start = float.Parse(this.hy_field38_start.Text); Hyoa_flowmain.hy_field39_start = float.Parse(this.hy_field39_start.Text); Hyoa_flowmain.hy_field40_start = float.Parse(this.hy_field40_start.Text); Hyoa_flowmain.hy_field36_end = float.Parse(this.hy_field36_end.Text); Hyoa_flowmain.hy_field37_end = float.Parse(this.hy_field37_end.Text); Hyoa_flowmain.hy_field38_end = float.Parse(this.hy_field38_end.Text); Hyoa_flowmain.hy_field39_end = float.Parse(this.hy_field39_end.Text); Hyoa_flowmain.hy_field40_end = float.Parse(this.hy_field40_end.Text); Hyoa_flowmain.hy_field41 = this.hy_field41.Text; Hyoa_flowmain.hy_field42 = this.hy_field42.Text; Hyoa_flowmain.hy_field43 = this.hy_field43.Text; Hyoa_flowmain.hy_field44 = this.hy_field44.Text; Hyoa_flowmain.hy_field45 = this.hy_field45.Text; Hyoa_flowmain.hy_field46 = this.hy_field46.Text; Hyoa_flowmain.hy_field47 = this.hy_field47.Text; Hyoa_flowmain.hy_field48 = this.hy_field48.Text; Hyoa_flowmain.hy_field49 = this.hy_field49.Text; Hyoa_flowmain.hy_field50 = this.hy_field50.Text; Hyoa_flowmain.hy_field51 = this.hy_field51.Text; Hyoa_flowmain.hy_field52 = this.hy_field52.Text; Hyoa_flowmain.hy_field53 = this.hy_field53.Text; Hyoa_flowmain.hy_field54 = this.hy_field54.Text; Hyoa_flowmain.hy_field55 = this.hy_field55.Text; Hyoa_flowmain.hy_field56 = this.hy_field56.Text; Hyoa_flowmain.hy_field57 = this.hy_field57.Text; Hyoa_flowmain.hy_field58 = this.hy_field58.Text; Hyoa_flowmain.hy_field59 = this.hy_field59.Text; Hyoa_flowmain.hy_field60 = this.hy_field60.Text; Hyoa_flowmain.hy_field61_start = this.hy_field61_start.Text; Hyoa_flowmain.hy_field62_start = this.hy_field62_start.Text; Hyoa_flowmain.hy_field63_start = this.hy_field63_start.Text; Hyoa_flowmain.hy_field64_start = this.hy_field64_start.Text; Hyoa_flowmain.hy_field65_start = this.hy_field65_start.Text; Hyoa_flowmain.hy_field66_start = this.hy_field66_start.Text; Hyoa_flowmain.hy_field67_start = this.hy_field67_start.Text; Hyoa_flowmain.hy_field68_start = this.hy_field68_start.Text; Hyoa_flowmain.hy_field69_start = this.hy_field69_start.Text; Hyoa_flowmain.hy_field70_start = this.hy_field70_start.Text; Hyoa_flowmain.hy_field61_end = this.hy_field61_end.Text; Hyoa_flowmain.hy_field62_end = this.hy_field62_end.Text; Hyoa_flowmain.hy_field63_end = this.hy_field63_end.Text; Hyoa_flowmain.hy_field64_end = this.hy_field64_end.Text; Hyoa_flowmain.hy_field65_end = this.hy_field65_end.Text; Hyoa_flowmain.hy_field66_end = this.hy_field66_end.Text; Hyoa_flowmain.hy_field67_end = this.hy_field67_end.Text; Hyoa_flowmain.hy_field68_end = this.hy_field68_end.Text; Hyoa_flowmain.hy_field69_end = this.hy_field69_end.Text; Hyoa_flowmain.hy_field70_end = this.hy_field70_end.Text; if (this.hy_field71_start.Text == "") { this.hy_field71_start.Text = "0"; } if (this.hy_field72_start.Text == "") { this.hy_field72_start.Text = "0"; } if (this.hy_field73_start.Text == "") { this.hy_field73_start.Text = "0"; } if (this.hy_field74_start.Text == "") { this.hy_field74_start.Text = "0"; } if (this.hy_field75_start.Text == "") { this.hy_field75_start.Text = "0"; } if (this.hy_field76_start.Text == "") { this.hy_field76_start.Text = "0"; } if (this.hy_field77_start.Text == "") { this.hy_field77_start.Text = "0"; } if (this.hy_field78_start.Text == "") { this.hy_field78_start.Text = "0"; } if (this.hy_field79_start.Text == "") { this.hy_field79_start.Text = "0"; } if (this.hy_field80_start.Text == "") { this.hy_field80_start.Text = "0"; } if (this.hy_field71_end.Text == "") { this.hy_field71_end.Text = "0"; } if (this.hy_field72_end.Text == "") { this.hy_field72_end.Text = "0"; } if (this.hy_field73_end.Text == "") { this.hy_field73_end.Text = "0"; } if (this.hy_field74_end.Text == "") { this.hy_field74_end.Text = "0"; } if (this.hy_field75_end.Text == "") { this.hy_field75_end.Text = "0"; } if (this.hy_field76_end.Text == "") { this.hy_field76_end.Text = "0"; } if (this.hy_field77_end.Text == "") { this.hy_field77_end.Text = "0"; } if (this.hy_field78_end.Text == "") { this.hy_field78_end.Text = "0"; } if (this.hy_field79_end.Text == "") { this.hy_field79_end.Text = "0"; } if (this.hy_field80_end.Text == "") { this.hy_field80_end.Text = "0"; } if (this.hy_field81_start.Text == "") { this.hy_field81_start.Text = "0"; } if (this.hy_field82_start.Text == "") { this.hy_field82_start.Text = "0"; } if (this.hy_field83_start.Text == "") { this.hy_field83_start.Text = "0"; } if (this.hy_field84_start.Text == "") { this.hy_field84_start.Text = "0"; } if (this.hy_field85_start.Text == "") { this.hy_field85_start.Text = "0"; } if (this.hy_field86_start.Text == "") { this.hy_field86_start.Text = "0"; } if (this.hy_field87_start.Text == "") { this.hy_field87_start.Text = "0"; } if (this.hy_field88_start.Text == "") { this.hy_field88_start.Text = "0"; } if (this.hy_field89_start.Text == "") { this.hy_field89_start.Text = "0"; } if (this.hy_field90_start.Text == "") { this.hy_field90_start.Text = "0"; } if (this.hy_field81_end.Text == "") { this.hy_field81_end.Text = "0"; } if (this.hy_field82_end.Text == "") { this.hy_field82_end.Text = "0"; } if (this.hy_field83_end.Text == "") { this.hy_field83_end.Text = "0"; } if (this.hy_field84_end.Text == "") { this.hy_field84_end.Text = "0"; } if (this.hy_field85_end.Text == "") { this.hy_field85_end.Text = "0"; } if (this.hy_field86_end.Text == "") { this.hy_field86_end.Text = "0"; } if (this.hy_field87_end.Text == "") { this.hy_field87_end.Text = "0"; } if (this.hy_field88_end.Text == "") { this.hy_field88_end.Text = "0"; } if (this.hy_field89_end.Text == "") { this.hy_field89_end.Text = "0"; } if (this.hy_field90_end.Text == "") { this.hy_field90_end.Text = "0"; } //ztm if (this.hy_field91_start.Text == "") { this.hy_field91_start.Text = "0"; } if (this.hy_field92_start.Text == "") { this.hy_field92_start.Text = "0"; } if (this.hy_field93_start.Text == "") { this.hy_field93_start.Text = "0"; } if (this.hy_field94_start.Text == "") { this.hy_field94_start.Text = "0"; } if (this.hy_field95_start.Text == "") { this.hy_field95_start.Text = "0"; } if (this.hy_field96_start.Text == "") { this.hy_field96_start.Text = "0"; } if (this.hy_field97_start.Text == "") { this.hy_field97_start.Text = "0"; } if (this.hy_field98_start.Text == "") { this.hy_field98_start.Text = "0"; } if (this.hy_field99_start.Text == "") { this.hy_field99_start.Text = "0"; } if (this.hy_field100_start.Text == "") { this.hy_field100_start.Text = "0"; } if (this.hy_field91_end.Text == "") { this.hy_field91_end.Text = "0"; } if (this.hy_field92_end.Text == "") { this.hy_field92_end.Text = "0"; } if (this.hy_field93_end.Text == "") { this.hy_field93_end.Text = "0"; } if (this.hy_field94_end.Text == "") { this.hy_field94_end.Text = "0"; } if (this.hy_field95_end.Text == "") { this.hy_field95_end.Text = "0"; } if (this.hy_field96_end.Text == "") { this.hy_field96_end.Text = "0"; } if (this.hy_field97_end.Text == "") { this.hy_field97_end.Text = "0"; } if (this.hy_field98_end.Text == "") { this.hy_field98_end.Text = "0"; } if (this.hy_field99_end.Text == "") { this.hy_field99_end.Text = "0"; } if (this.hy_field100_end.Text == "") { this.hy_field100_end.Text = "0"; } Hyoa_flowmain.hy_field71_start = float.Parse(this.hy_field71_start.Text); Hyoa_flowmain.hy_field72_start = float.Parse(this.hy_field72_start.Text); Hyoa_flowmain.hy_field73_start = float.Parse(this.hy_field73_start.Text); Hyoa_flowmain.hy_field74_start = float.Parse(this.hy_field74_start.Text); Hyoa_flowmain.hy_field75_start = float.Parse(this.hy_field75_start.Text); Hyoa_flowmain.hy_field76_start = float.Parse(this.hy_field76_start.Text); Hyoa_flowmain.hy_field77_start = float.Parse(this.hy_field77_start.Text); Hyoa_flowmain.hy_field78_start = float.Parse(this.hy_field78_start.Text); Hyoa_flowmain.hy_field79_start = float.Parse(this.hy_field79_start.Text); Hyoa_flowmain.hy_field80_start = float.Parse(this.hy_field80_start.Text); Hyoa_flowmain.hy_field71_end = float.Parse(this.hy_field71_end.Text); Hyoa_flowmain.hy_field72_end = float.Parse(this.hy_field72_end.Text); Hyoa_flowmain.hy_field73_end = float.Parse(this.hy_field73_end.Text); Hyoa_flowmain.hy_field74_end = float.Parse(this.hy_field74_end.Text); Hyoa_flowmain.hy_field75_end = float.Parse(this.hy_field75_end.Text); Hyoa_flowmain.hy_field76_end = float.Parse(this.hy_field76_end.Text); Hyoa_flowmain.hy_field77_end = float.Parse(this.hy_field77_end.Text); Hyoa_flowmain.hy_field78_end = float.Parse(this.hy_field78_end.Text); Hyoa_flowmain.hy_field79_end = float.Parse(this.hy_field79_end.Text); Hyoa_flowmain.hy_field80_end = float.Parse(this.hy_field80_end.Text); Hyoa_flowmain.hy_field81_start = float.Parse(this.hy_field81_start.Text); Hyoa_flowmain.hy_field82_start = float.Parse(this.hy_field82_start.Text); Hyoa_flowmain.hy_field83_start = float.Parse(this.hy_field83_start.Text); Hyoa_flowmain.hy_field84_start = float.Parse(this.hy_field84_start.Text); Hyoa_flowmain.hy_field85_start = float.Parse(this.hy_field85_start.Text); Hyoa_flowmain.hy_field86_start = float.Parse(this.hy_field86_start.Text); Hyoa_flowmain.hy_field87_start = float.Parse(this.hy_field87_start.Text); Hyoa_flowmain.hy_field88_start = float.Parse(this.hy_field88_start.Text); Hyoa_flowmain.hy_field89_start = float.Parse(this.hy_field89_start.Text); Hyoa_flowmain.hy_field90_start = float.Parse(this.hy_field90_start.Text); Hyoa_flowmain.hy_field81_end = float.Parse(this.hy_field81_end.Text); Hyoa_flowmain.hy_field82_end = float.Parse(this.hy_field82_end.Text); Hyoa_flowmain.hy_field83_end = float.Parse(this.hy_field83_end.Text); Hyoa_flowmain.hy_field84_end = float.Parse(this.hy_field84_end.Text); Hyoa_flowmain.hy_field85_end = float.Parse(this.hy_field85_end.Text); Hyoa_flowmain.hy_field86_end = float.Parse(this.hy_field86_end.Text); Hyoa_flowmain.hy_field87_end = float.Parse(this.hy_field87_end.Text); Hyoa_flowmain.hy_field88_end = float.Parse(this.hy_field88_end.Text); Hyoa_flowmain.hy_field89_end = float.Parse(this.hy_field89_end.Text); Hyoa_flowmain.hy_field90_end = float.Parse(this.hy_field90_end.Text); Hyoa_flowmain.hy_field91_start = float.Parse(this.hy_field91_start.Text); Hyoa_flowmain.hy_field92_start = float.Parse(this.hy_field92_start.Text); Hyoa_flowmain.hy_field93_start = float.Parse(this.hy_field93_start.Text); Hyoa_flowmain.hy_field94_start = float.Parse(this.hy_field94_start.Text); Hyoa_flowmain.hy_field95_start = float.Parse(this.hy_field95_start.Text); Hyoa_flowmain.hy_field96_start = float.Parse(this.hy_field96_start.Text); Hyoa_flowmain.hy_field97_start = float.Parse(this.hy_field97_start.Text); Hyoa_flowmain.hy_field98_start = float.Parse(this.hy_field98_start.Text); Hyoa_flowmain.hy_field99_start = float.Parse(this.hy_field99_start.Text); Hyoa_flowmain.hy_field100_start = float.Parse(this.hy_field100_start.Text); Hyoa_flowmain.hy_field91_end = float.Parse(this.hy_field91_end.Text); Hyoa_flowmain.hy_field92_end = float.Parse(this.hy_field92_end.Text); Hyoa_flowmain.hy_field93_end = float.Parse(this.hy_field93_end.Text); Hyoa_flowmain.hy_field94_end = float.Parse(this.hy_field94_end.Text); Hyoa_flowmain.hy_field95_end = float.Parse(this.hy_field95_end.Text); Hyoa_flowmain.hy_field96_end = float.Parse(this.hy_field96_end.Text); Hyoa_flowmain.hy_field97_end = float.Parse(this.hy_field97_end.Text); Hyoa_flowmain.hy_field98_end = float.Parse(this.hy_field98_end.Text); Hyoa_flowmain.hy_field99_end = float.Parse(this.hy_field99_end.Text); Hyoa_flowmain.hy_field100_end = float.Parse(this.hy_field100_end.Text); Hyoa_flowmain.hy_curclrid = this.Session["hyuid"].ToString(); Hyoa_flowmain.hy_curuserid = this.Session["hyuid"].ToString(); //排序 HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); DataTable dt_listconfig = Hyoa_listconfig.GetlistconfigByTableid(this.txttableid.Value); if (dt_listconfig.Rows.Count > 0) { Hyoa_flowmain.hy_sorttype = dt_listconfig.Rows[0]["hy_sortfield"].ToString() + " " + dt_listconfig.Rows[0]["hy_sorttype"].ToString(); } //---查询条件---结束 //--根据查询条件得到返回数据集--s DataTable dt; DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value); //得到表配置信息查看当前表是否有流程 hy_ifflowdoc dt = Hyoa_flowmain.GetflowmainsByIf_db(); //输出当前处理人是自己的dt //if (dttable.Rows[0]["hy_ifflowdoc"].ToString()=="是") //{ // //this.Response.Write("<script>alert('" + dttable.Rows[0]["hy_ispuballByflowYB"].ToString() + "')</script>"); // //dt = Hyoa_flowmain.GetflowmainsByIf(); //输出流程的dt // if (dttable.Rows[0]["hy_ispuballByflowYB"].ToString() == "是") // { // dt = Hyoa_flowmain.GetflowmainsByIf_jsDisplayAll(); //输出流程的dt // } // else // { // dt = Hyoa_flowmain.GetflowmainsByIf(); //输出流程的dt // } //} //else //{ // if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是") // { // dt = Hyoa_flowmain.GetAllflowmainsByNoFlows();//输出所有的dt // } // else // { // dt = Hyoa_flowmain.GetPersonerflowmainsByNoFlows();//输出自己的dt // } //} //--根据查询条件得到返回数据集--e //开始输出----整合成HTML为数据行 DataTable tempTable = dt.Clone(); DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列 add tempTable.Columns.Add(col); //追加一列 add string lscolname = ""; string lscolnameid = ""; string lscolwidth = ""; string ls_col = ""; string[] lvcolname; string[] lvcolnameid; string[] lvcolwidth; string lscolwidthper; //HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig(); DataTable dtlist = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(this.txtmudelid.Value,this.txttableid.Value); lscolname = dtlist.Rows[0]["hy_columnshow"].ToString(); //要显示的列名:附件,标题,收文来源 lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString(); //要显示的列名id:uploadfile1,Hy_bt,Hy_swly lscolwidth = dtlist.Rows[0]["hy_width"].ToString(); //要显示的列名id:10,20,30 lvcolname = lscolname.Split(','); lvcolnameid = lscolnameid.Split(','); lvcolwidth = lscolwidth.Split(','); if (dt.Rows.Count <= 0) { //如果没有数据则输出表头 for (int n = 0; n < lvcolname.Length; n++) { if (n >= lvcolwidth.Length) { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。 else { lscolwidthper = lvcolwidth[n]; } this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>"; } } for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); //输出主表所有字段,start for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } //输出主表所有字段,end //////开始得到列的值 HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtgetsqlfield; for (int m = 0; m < lvcolname.Length; m++) { //如果有数据,则输出数据 if (m >= lvcolwidth.Length) { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。 else { lscolwidthper = lvcolwidth[m]; } dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m],this.txttableid.Value); //ztm if (i % System.Int32.Parse(PageSize.Text) == 0) this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[m] + "</td>"; //根据字段英文名,得到数据库中对应的字段 string lsgetsqlfield = dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString(); //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换) string lsgetputfiled=""; if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString(); } else { //解决Float小数点后面出现N位小数乱码的问题 if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { //是否包含小数点,包含的话,取小数点后两位 if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true) { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2"); } else { lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString(); } //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); }else { lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString(); } } if (lsgetputfiled == "") lsgetputfiled = " "; //根据得到的SQL字段,得到输出字段的值end if (lsgetputfiled == "1900-1-1") lsgetputfiled = ""; ls_col += "<td width=\"" + lscolwidthper + "%\" align=\"center\">" + lsgetputfiled + "</td>"; } //如果是流程表单,则最后追加两列(当前环节和当前处理人) //表头 if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null && i == (PageNo - 1) * System.Int32.Parse(PageSize.Text)) { this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前环节</td>"; this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前处理人</td>"; } //数据 if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null) { ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curtachename"].ToString() + " </td>"; ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + " </td>"; } dr["displaycol"] = ls_col; //将新值赋给相应的列 add ls_col = ""; tempTable.Rows.Add(dr); } int TotalRecord = dt.Rows.Count; this.sumts.Text = TotalRecord.ToString(); this.sumts2.Text = TotalRecord.ToString(); this.ShowTotalRecord.Text = TotalRecord.ToString(); //计算及显示总页数 int TotalPage; if (TotalRecord < System.Int32.Parse(PageSize.Text)) { TotalPage = 1; } else { if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0) { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1; } else { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text); } } this.ShowTotalPage.Text = TotalPage.ToString(); this.rptlist.DataSource = tempTable; this.rptlist.DataBind(); dt.Clear(); }
//得到某一个字段的HTML Written by xf 20110515 //pi_flag 0:不赋值 1:需赋值 //ifsearch:是否查询时使用 0:非查询时使用 1:查询时使用 //docid:旧文档使用时,文档ID,新文档则为空就可以 //ifhavarole:是否有权限 0:lable输出 1:input输出 public string GetFieldHtml(string hy_mudelid, string hy_fieldid, string pi_flag, string hy_tableid, string ifsearch, string docid, string ifhavarole) { HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(hy_mudelid, hy_fieldid, hy_tableid); HyoaClass.DAO db = new HyoaClass.DAO(); string lsField = ""; string field_css = ""; string field_value = ""; string field_functionhy_onclick = ""; string field_functionhy_ondblclick = ""; string field_functionhy_onchange = ""; string field_functionhy_onkeydown = ""; string field_functionhy_onkeyup = ""; string field_wordlimit = ""; if (dtfield.Rows.Count > 0) { //得到该字段的样式start if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { if (ifsearch == "0") field_css += " readonly "; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { field_css += " class='" + dtfield.Rows[0]["hy_class"].ToString() + "' "; } if (dtfield.Rows[0]["hy_width"].ToString() != "") { field_css += " style='width:" + dtfield.Rows[0]["hy_width"].ToString() + ";"; } else { field_css += " style='"; } if (dtfield.Rows[0]["hy_height"].ToString() != "") { field_css += " height:" + dtfield.Rows[0]["hy_height"].ToString() + "'"; } else { field_css += "'"; } //得到字数限制 if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "") { field_wordlimit += " maxlength='" + dtfield.Rows[0]["hy_wordlimit"].ToString() + "' "; } //默认值 //默认值取值的方式,查询时不使用默认值 if (ifsearch == "0") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0") field_value += dtfield.Rows[0]["hy_defaultvalue"].ToString(); if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1") { DataTable dtdefault = db.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString()); if (dtdefault.Rows.Count > 0) field_value += dtdefault.Rows[0][0].ToString(); } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2") { field_value += Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3") { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") field_value += System.DateTime.Now.ToShortDateString(); else field_value += System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } //自动生成值的情况 Added by xf 20110719 if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4") { if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { //得到目前最大的数值,然后+1,未找到则赋值为1 HyoaClass.DAO db_autovalue = new HyoaClass.DAO(); DataTable dt_autovalue = db_autovalue.GetDataTable("select max(hy_field36) as maxint from hyp_flowmain where hy_tableid='" + dtfield.Rows[0]["hy_tableid"].ToString() + "'"); if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "") field_value += "1"; else field_value += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString(); } else { field_value += System.Guid.NewGuid().ToString(); } } } } //事件 if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { field_functionhy_onclick += " onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { field_functionhy_ondblclick += " ondblclick=\"" + dtfield.Rows[0]["hy_ondblclick"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { field_functionhy_onchange += " onchange=\"" + dtfield.Rows[0]["hy_onchange"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { field_functionhy_onkeydown += " onkeydown=\"" + dtfield.Rows[0]["hy_onkeydown"].ToString() + "\" "; } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { field_functionhy_onkeyup += " onkeyup=\"" + dtfield.Rows[0]["hy_onkeyup"].ToString() + "\" "; } //得到该字段的样式end string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //是否需要赋值,如果需要赋值,得到当前字段对应的值(日期型需要根据格式进行转换) string field_docvalue = ""; //this.Response.Write("<script>alert('" + pi_flag + "');</script>"); if (pi_flag == "1") { HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain(); DataTable dt_flowmain = Hyoa_flowmain.Getflowmain(docid); if (dt_flowmain.Rows.Count > 0) { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { field_docvalue = System.DateTime.Parse(dt_flowmain.Rows[0][dtfield.Rows[0]["hy_sqlfield"].ToString()].ToString()).ToShortDateString(); } else { //如果SQL为数值的字段部分,则需要截取小数点后边两位 if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { if (dt_flowmain.Rows[0][dtfield.Rows[0]["hy_sqlfield"].ToString()].ToString().Contains(".") == true) field_docvalue = float.Parse(dt_flowmain.Rows[0][dtfield.Rows[0]["hy_sqlfield"].ToString()].ToString()).ToString("F2"); else field_docvalue = dt_flowmain.Rows[0][dtfield.Rows[0]["hy_sqlfield"].ToString()].ToString(); } else { field_docvalue = dt_flowmain.Rows[0][dtfield.Rows[0]["hy_sqlfield"].ToString()].ToString(); } } } } //如果没有权限,直接输出lable //this.Response.Write("<script>alert('" + ifhavarole + "');</script>"); if (ifhavarole == "0") { //痕迹保留 if (field_type == "痕迹保留") { lsField += "<input type=button id=\"btn_zwxg\" value='正 文' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + docid + "&tacheByhj=1&jsxd=1','newwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" "; } else { //附件组件 if (field_type == "附件组件") { //根据docid得到目前已上传的附件信息 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(docid); if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { string ls_name = ""; DataTable dt_user = Hyoa_user.Getuser(dt_fileatt.Rows[ii]["hy_userid"].ToString()); if (dt_user.Rows.Count > 0) { ls_name = dt_user.Rows[0]["hy_username"].ToString(); } lsField += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + " " + ls_name + " [" + dt_fileatt.Rows[ii]["hy_djsj"].ToString() + "]" + "</a><br />"; } } else { lsField += " "; } } else { //ztmztmztm2start if (field_docvalue.Length > 8) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = " "; } } //ztmztmztm2end lsField = field_docvalue + " "; } } } else { //单行文本 if (field_type == "文本") { if (pi_flag == "0") lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_value + "\">"; else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_docvalue + "\">"; } //多行文本 if (field_type == "多行文本") { //格式化内容,将<br>转为/n if (field_docvalue.Contains("<br>")) field_docvalue = field_docvalue.Replace("<br>", "\n"); if (pi_flag == "0") lsField = "<textarea name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_css + field_wordlimit + " >" + field_value + "</textarea>"; else lsField = "<textarea name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_css + field_wordlimit + " >" + field_docvalue + "</textarea>"; } //日期 if (field_type == "日期") { //this.Response.Write("<script>alert('aaaaaa');</script>"); //this.Response.Write("<script>alert('" + pi_flag + "');</script>"); if (ifsearch == "0") { if (pi_flag == "0") lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_value + "\">"; else { //add ztm3 start if (field_docvalue.Length > 7) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = ""; } } //add ztm3 end lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_docvalue + "\">"; } } else { //this.Response.Write("<script>alert('aaaa');</script>"); lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_value + "\">至"; lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_value + "\">"; } } //文本加按钮 if (field_type == "文本加按钮") { if (pi_flag == "0") lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_value + "\"> <input type=button id=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" name=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" value=" + dtfield.Rows[0]["hy_fieldname"].ToString() + " class=btn3 " + field_functionhy_onclick + " >"; else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_docvalue + "\"> <input type=button id=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" name=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" value=" + dtfield.Rows[0]["hy_fieldname"].ToString() + " class=btn3 " + field_functionhy_onclick + " >"; } //多行文本加按钮 if (field_type == "多行文本加按钮") { //格式化内容,将<br>转为/n if (field_docvalue.Contains("<br>")) field_docvalue = field_docvalue.Replace("<br>", "\n"); if (pi_flag == "0") lsField = "<textarea name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_wordlimit + " " + field_css + " >" + field_value + "</textarea> <input type=button id=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" name=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" value=" + dtfield.Rows[0]["hy_fieldname"].ToString() + " class=btn3 " + field_functionhy_onclick + " >"; else lsField = "<textarea name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_wordlimit + " " + field_css + " >" + field_docvalue + "</textarea> <input type=button id=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" name=\"btn_" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "\" value=" + dtfield.Rows[0]["hy_fieldname"].ToString() + " class=btn3 " + field_functionhy_onclick + " >"; } //数值 if (field_type == "数值") { if (ifsearch == "0") { if (pi_flag == "0") lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_value + "\">"; else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_docvalue + "\">"; } else { lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_value + "\">到"; lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" type=text id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1\" " + field_functionhy_onclick + field_functionhy_ondblclick + field_functionhy_onkeydown + field_functionhy_onkeyup + field_css + field_wordlimit + " value=\"" + field_value + "\">"; } } //对话框列表(下拉框 if (field_type == "对话框列表") { lsField = "<select name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onchange + field_css + "> "; //第一项:请选择 lsField += "<option value=''>--请选择--</option>"; //有哪些选项 if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { if (pi_flag == "0") { lsField += "<option value='" + lv_options[ii].ToString() + "'>" + lv_options[ii].ToString() + "</option>"; } else { if (field_docvalue == lv_options[ii].ToString()) lsField += "<option value='" + lv_options[ii].ToString() + "' selected>" + lv_options[ii].ToString() + "</option>"; else lsField += "<option value='" + lv_options[ii].ToString() + "'>" + lv_options[ii].ToString() + "</option>"; } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { if (pi_flag == "0") { lsField += "<option value='" + dtoptions.Rows[ii][0].ToString() + "'>" + dtoptions.Rows[ii][0].ToString() + "</option>"; } else { if (field_docvalue == dtoptions.Rows[ii][0].ToString()) lsField += "<option value='" + dtoptions.Rows[ii][0].ToString() + "' selected>" + dtoptions.Rows[ii][0].ToString() + "</option>"; else lsField += "<option value='" + dtoptions.Rows[ii][0].ToString() + "'>" + dtoptions.Rows[ii][0].ToString() + "</option>"; } } } } lsField += "</select>"; } //复选框 if (field_type == "复选框") { //有哪些选项 if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { if (pi_flag == "0") { if (field_value == lv_options[ii].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } else { if (field_docvalue.Contains(lv_options[ii].ToString())) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { if (pi_flag == "0") { if (field_value == dtoptions.Rows[ii][0].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } else { if (field_docvalue.Contains(dtoptions.Rows[ii][0].ToString())) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=checkbox id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } } } } } //单选框 if (field_type == "单选框") { //有哪些选项 if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (var ii = 0; ii < lv_options.Length; ii++) { if (pi_flag == "0") { if (field_value == lv_options[ii].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } else { if (field_docvalue == lv_options[ii].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + lv_options[ii].ToString() + "\" />" + lv_options[ii].ToString(); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { DataTable dtoptions = db.GetDataTable(dtfield.Rows[0]["hy_options"].ToString()); if (dtoptions.Rows.Count > 0) { for (var ii = 0; ii < dtoptions.Rows.Count; ii++) { if (pi_flag == "0") { if (field_value == dtoptions.Rows[ii][0].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } else { if (field_docvalue == dtoptions.Rows[ii][0].ToString()) lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio checked=true id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); else lsField += "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=radio id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1_" + ii.ToString() + "\" " + field_functionhy_onclick + " value=\"" + dtoptions.Rows[ii][0].ToString() + "\" />" + dtoptions.Rows[ii][0].ToString(); } } } } } //口令 if (field_type == "口令") { if (pi_flag == "0") lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=password id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_value + "\">"; else lsField = "<input name=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" type=password id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\" " + field_functionhy_onclick + field_css + field_wordlimit + " value=\"" + field_docvalue + "\">"; } //附件组件 if (field_type == "附件组件") { lsField = ""; //根据docid得到目前已上传的附件信息 HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(docid); HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { string ls_name = ""; DataTable dt_user = Hyoa_user.Getuser(dt_fileatt.Rows[ii]["hy_userid"].ToString()); if (dt_user.Rows.Count > 0) { ls_name = dt_user.Rows[0]["hy_username"].ToString(); } lsField += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a> " + ls_name + " [" + dt_fileatt.Rows[ii]["hy_djsj"].ToString() + "]" + "<br />"; } } lsField += "<input type=button id=\"uploadfile1\" value='附件管理' class=btn3 onclick=\"window.open('/ggdy/main_fileatt.aspx?fatherid=" + docid + "','newwindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no');\" "; } //说明文字 if (field_type == "说明文字") { lsField = "<span id=\"" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "_1\">" + field_value + "</span>"; } //编辑器 if (field_type == "编辑器") { //lsField = "<textarea name=\"hy_content1_1\" id=\"hy_content1_1\" style=\"display:none\" runat="server">" + field_docvalue + "</textarea>"; lsField += "<iframe ID=\"eWebEditor1\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_sqlfield"].ToString() + "&style=Portal\" frameborder=\"0\" scrolling=\"no\" width=\"100%\" height=\"350\"></iframe>"; } //痕迹保留 //this.Response.Write("<script>alert('" + field_type + "');</script>"); if (field_type == "痕迹保留") { //判断是否为第一环节 HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*"); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text) { lsField += "<input type=button id=\"btn_zwxg\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + docid + "&tacheByhj=1&jsxd=0','newwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" "; } else { //判断是否为最后一个环节 dtflowwork.Clear(); dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**") { lsField += "<input type=button id=\"btn_zwxg\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + docid + "&tacheByhj=0&jsxd=1','newwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" "; } else { lsField += "<input type=button id=\"btn_zwxg\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + docid + "&tacheByhj=0&jsxd=0','newwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" "; } } } } } } db.Close(); } return lsField; }