//ntko_class db = new ntko_class();//实例ntko_class类 protected void Page_Load(object sender, EventArgs e) { //title = db.getdemotitle(); //attachpath = db.getattachpath(); title = "宁波合益"; newofficetype = Request.QueryString["newofficetype"]; HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); if (this.Request.QueryString["fatherid"] != null) { fatherid = this.Request.QueryString["fatherid"].ToString(); DataTable dtfatherid = Hyoa_ntko.GetntkofileByfother(fatherid); //this.Response.Write("<script>alert('" + dtfatherid.Rows.Count + "');</script>"); if (dtfatherid.Rows.Count > 0) { url = dtfatherid.Rows[0]["fid"].ToString(); DataTable dt = Hyoa_ntko.Getntkofile(url); if (dt.Rows.Count > 0) { fileid = dt.Rows[0]["fid"].ToString(); filetitle = dt.Rows[0]["ftitle"].ToString(); fileother = dt.Rows[0]["fother"].ToString(); filename = dt.Rows[0]["fname"].ToString(); } } } }
//ntko_class db = new ntko_class();//实例ntko_class类 protected void Page_Load(object sender, EventArgs e) { //title = db.getdemotitle(); //attachpath = db.getattachpath(); title = "宁波合益"; newofficetype = Request.QueryString["newofficetype"]; HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); tableid=""; if (this.Request.QueryString["tableid"] != null) { tableid = this.Request.QueryString["tableid"].ToString(); } if (this.Request.QueryString["fatherid"] != null) { fatherid = this.Request.QueryString["fatherid"].ToString(); DataTable dtfatherid = Hyoa_ntko.GetntkofileByfother(fatherid); //this.Response.Write("<script>alert('" + dtfatherid.Rows.Count + "');</script>"); if (dtfatherid.Rows.Count > 0) { url = dtfatherid.Rows[0]["fid"].ToString(); DataTable dt = Hyoa_ntko.Getntkofile(url); if (dt.Rows.Count > 0) { fileid = dt.Rows[0]["fid"].ToString(); filetitle = dt.Rows[0]["ftitle"].ToString(); fileother = dt.Rows[0]["fother"].ToString(); filename = dt.Rows[0]["fname"].ToString(); } } //隐藏控制(根据fatherid) string ls_flowid = ""; string ls_currenttacheid = ""; HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); string sql = "select * from hyc_" + tableid + " where DOCID='" + fatherid + "' "; DataTable dt_flowmain = Hyoa_global.GetDataTable(sql); if (dt_flowmain.Rows.Count > 0) { if (dt_flowmain.Rows[0]["hy_curtacheid"].ToString() == "**") ckhjbl.Visible = true; } } }
//输出一个字段 //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(); } if (field_type == "意见加按钮") { HyoaClass.Hyoa_yj Hyoa_yj = new HyoaClass.Hyoa_yj(); DataTable dt_yj = Hyoa_yj.Getyjsbydocidandfieldid_sx(this.txtdocid.Value, hy_fieldid); if (dt_yj.Rows.Count > 0) { field_docvalue = ""; for (int ii = 0; ii < dt_yj.Rows.Count; ii++) { field_docvalue += dt_yj.Rows[ii]["hy_yjbody"].ToString() + "(" + dt_yj.Rows[ii]["hy_yjusername"].ToString() + " " + System.DateTime.Parse(dt_yj.Rows[ii]["hy_yjtime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + ")<br/>"; } } } } //判断是输出LABL还是INPUT if (pi_isnewdoc == "0") //新文档 { 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 (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"; } if (ls_laborinput == "1") { //如果当前字段中文名为“结束流程按钮”,则这个字段主要用于收文中阅件时,可点击这个按钮结束流程,用于控制这个按钮的隐藏和显示 if (dtfield.Rows[0]["hy_fieldname"].ToString() == "结束流程按钮") { td_flowend.Visible = true; } } } //如果是“可修改所有文档的权限人员”,则可以修改所有的字段 if (Hyoa_global.isHaveRole("Role9995", Session["hyuid"].ToString())) { ls_laborinput = "1"; } } //如果是输出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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "") { txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString()) / 2).ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "0"); } } //多行文本 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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "0"); } } //多行文本_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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "0"); } } //按钮 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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "1"); } } //文本加按钮 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()); } if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "") { txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString()) / 2).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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "0"); } } //多行文本加按钮 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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "0"); } } //意见加按钮 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_show = new Label(); txtTextBox_show.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_show"; txtTextBox_show.Text = field_docvalue; tCell2.Controls.Add(txtTextBox_show); 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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "9"); } } //数值 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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } //if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "") //{ // txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString())).ToString()); //} txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "3"); } } //对话框列表(下拉框 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); //插入字段:共有哪几个查询条件 addsavefields(hy_fieldid, "0"); } } //复选框(查询时直接显示文本框) 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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "7"); } } //单选框(查询时直接显示文本框) 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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "8"); } } //口令 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()); } if (dtfield.Rows[0]["hy_onfocus"].ToString() != "") { txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString()); } if (dtfield.Rows[0]["hy_onblur"].ToString() != "") { txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString()); } if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "") { txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString())).ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "5"); } } //附件组件 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 = "<span id=\"fjinfoshow_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\">" + field_docvalue + "</span>"; 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); //插入字段:共有哪几个INPUT字段 addsavefields(hy_fieldid, "6"); } } //痕迹保留 if (field_type == "痕迹保留") { string ls_btnname = ""; HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); DataTable dt_ntko = Hyoa_ntko.GetntkofileByfother(this.txtdocid.Value); if (dt_ntko.Rows.Count > 0) { ls_btnname = "正文:" + this.hy_bt.Text; } else { ls_btnname = "<span id='ntko_wsc'>未上传正文,请点击上传!</span>"; } //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' 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');\" /> "; field_docvalue = "<a href=\"#\" 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');\">" + ls_btnname + "</a> "; 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='" + ls_btnname + "' 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');\" /> "; field_docvalue = "<a href=\"#\" 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');\">" + ls_btnname + "</a> "; //如果是流程模块,则根据环节判断一下 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='" + ls_btnname + "' 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');\" /> "; field_docvalue = "<a href=\"#\" 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');\">" + ls_btnname + "</a> "; } 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='" + ls_btnname + "' 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');\" /> "; field_docvalue = "<a href=\"#\" 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');\">" + ls_btnname + "</a> "; } else { //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' 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');\" /> "; field_docvalue = "<a href=\"#\" 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');\">" + ls_btnname + "</a> "; } } } } } 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; }
//ntko_class db = new ntko_class();//实例ntko_class类 protected void Page_Load(object sender, EventArgs e) { //title = db.getdemotitle(); //attachpath = db.getattachpath(); if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx?url=" + this.Request.RawUrl); //加载模板 HyoaClass.Hyoa_ntkotemplateFile Hyoa_ntkotemplateFile = new HyoaClass.Hyoa_ntkotemplateFile(); DataTable dt_templateFile = Hyoa_ntkotemplateFile.GettemplateFiles(); this.templateFile.DataSource = dt_templateFile; this.templateFile.DataTextField = "templateFilename"; this.templateFile.DataValueField = "templateFileurl"; this.templateFile.DataBind(); this.templateFile.Items.Insert(0, new ListItem("--请选择模板--", "")); this.templateFile.SelectedIndex = 0; //加载印章 HyoaClass.Hyoa_ntkoesp Hyoa_ntkoesp = new HyoaClass.Hyoa_ntkoesp(); DataTable dt_esp = Hyoa_ntkoesp.Getesps(); this.SignFileUrl.DataSource = dt_esp; this.SignFileUrl.DataTextField = "espname"; this.SignFileUrl.DataValueField = "espurl"; this.SignFileUrl.DataBind(); this.SignFileUrl.Items.Insert(0, new ListItem("--请选择印章--", "")); this.SignFileUrl.SelectedIndex = 0; //加载红头 HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou(); DataTable dt_hongtou = Hyoa_ntkohongtou.Gethongtous(); this.redHeadTemplateFile.DataSource = dt_hongtou; this.redHeadTemplateFile.DataTextField = "hongtouname"; this.redHeadTemplateFile.DataValueField = "hongtouurl"; this.redHeadTemplateFile.DataBind(); this.redHeadTemplateFile.Items.Insert(0, new ListItem("--请选择红头--", "")); this.redHeadTemplateFile.SelectedIndex = 0; title = "宁波合益"; hyusername = this.Session["hyuname"].ToString(); //设置第一环节是否在痕迹模式下编辑 tacheByhj = "0";//痕迹模式下编辑 if (this.Request.QueryString["tacheByhj"] != null) { if (this.Request.QueryString["tacheByhj"].ToString() == "1") { tacheByhj = "1"; //非痕迹模式下编辑 } } //是否显示接受修订按钮 if (this.Request.QueryString["jsxd"] != null) { if (this.Request.QueryString["jsxd"].ToString() == "1") { btnjsxd = "<input id=\"Button2\" type=button style =\"width:70px;height:23px;\" onclick=\"TANGER_OCX_AllRevisions(true);\" runat=\"server\" value=\" 接受修订\" />"; } } newofficetype = Request.QueryString["newofficetype"]; HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); if (this.Request.QueryString["fatherid"] != null) { fatherid = this.Request.QueryString["fatherid"].ToString(); DataTable dtfatherid = Hyoa_ntko.GetntkofileByfother(fatherid); //this.Response.Write("<script>alert('" + dtfatherid.Rows.Count + "');</script>"); if (dtfatherid.Rows.Count > 0) { url = dtfatherid.Rows[0]["fid"].ToString(); DataTable dt = Hyoa_ntko.Getntkofile(url); if (dt.Rows.Count > 0) { fileid = dt.Rows[0]["fid"].ToString(); filetitle = dt.Rows[0]["ftitle"].ToString(); fileother = dt.Rows[0]["fother"].ToString(); filename = dt.Rows[0]["fname"].ToString(); } } } tableid = ""; if (this.Request.QueryString["tableid"] != null) { tableid = Request.QueryString["tableid"].ToString(); } //隐藏控制(根据fatherid) string ls_flowid = ""; string ls_currenttacheid = ""; HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); string sql = ""; sql = "select * from hyc_" + tableid + " where DOCID='" + fatherid + "' "; DataTable dt_flowmain = Hyoa_global.GetDataTable(sql); if (dt_flowmain.Rows.Count > 0) { ls_flowid = dt_flowmain.Rows[0]["hy_flowid"].ToString(); ls_currenttacheid = dt_flowmain.Rows[0]["hy_curtacheid"].ToString(); //根据当前环节ID得到对应的隐藏权限 DataTable dt_flowtachefield = Hyoa_flowtachefield.Getflowtachefield_gl(ls_flowid, ls_currenttacheid); if (dt_flowtachefield.Rows.Count > 0) { for (var i = 0; i < dt_flowtachefield.Rows.Count; i++) { if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "选择模板") { xuanzemubangongneng.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "界面设置") { jiemianshezhi.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "打印控制") { dayinkongzhi.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "印章和图片") { yinzhanghetupiangongneng.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "套红功能") { taohonggongneng.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "接受修订") { jieshouxiuding.Visible = true; } if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "权限控制") { quanxiankongzhi.Visible = true; } } } } else { //未找到,则默认权限 xuanzemubangongneng.Visible = true; jiemianshezhi.Visible = true; dayinkongzhi.Visible = true; yinzhanghetupiangongneng.Visible = true; taohonggongneng.Visible = true; jieshouxiuding.Visible = true; quanxiankongzhi.Visible = true; } //生成痕迹稿start //在接受修订环节,打开文档时生成痕迹稿。 string lsMapPath=""; string lsMapPathsdec = ""; if (this.Request.QueryString["jsxd"] != null) { if (this.Request.QueryString["jsxd"].ToString() == "1") { lsMapPath = Server.MapPath("~/")+"/NTKO/uploadOfficeFile/"+filename; //虚拟目录的位置 if (filename.IndexOf(".doc") > 0) { lsMapPathsdec = Server.MapPath("~/") + "/NTKO/uploadOfficeFile/" + filename.Substring(0, filename.IndexOf(".doc")) + "hjbl" + ".doc";//虚拟目录的位置 } if (filename.IndexOf(".wps") > 0) { lsMapPathsdec = Server.MapPath("~/") + "/NTKO/uploadOfficeFile/" + filename.Substring(0, filename.IndexOf(".wps")) + "hjbl" + ".wps";//虚拟目录的位置 } //File.Delete(lsMapPathsdec); if (File.Exists(lsMapPathsdec)) { //如果文件已经存在了,就不用产生痕迹稿了 } else { //如果没有生成则生成痕迹稿 File.Copy(lsMapPath, lsMapPathsdec, false); } } } //生成痕迹稿end }
//ntko_class db = new ntko_class();//实例ntko_class类 protected void Page_Load(object sender, EventArgs e) { //title = db.getdemotitle(); //attachpath = db.getattachpath(); if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx?url=" + this.Request.RawUrl); title = "宁波合益"; hyusername = this.Session["hyuname"].ToString(); //设置第一环节是否在痕迹模式下编辑 tacheByhj = "0";//痕迹模式下编辑 if (this.Request.QueryString["tacheByhj"] != null) { if (this.Request.QueryString["tacheByhj"].ToString() == "1") { tacheByhj = "1";//非痕迹模式下编辑 } } //是否显示接受修订按钮 if (this.Request.QueryString["jsxd"] != null) { if (this.Request.QueryString["jsxd"].ToString() == "1") { btnjsxd = "<input id=\"Button2\" type=button style =\"width:70px;height:23px;\" onclick=\"TANGER_OCX_AllRevisions(true);\" runat=\"server\" value=\" 接受修订\" />"; } } newofficetype = Request.QueryString["newofficetype"]; HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); if (this.Request.QueryString["fatherid"] != null) { fatherid = this.Request.QueryString["fatherid"].ToString(); DataTable dtfatherid = Hyoa_ntko.GetntkofileByfother(fatherid); //this.Response.Write("<script>alert('" + dtfatherid.Rows.Count + "');</script>"); if (dtfatherid.Rows.Count > 0) { url = dtfatherid.Rows[0]["fid"].ToString(); DataTable dt = Hyoa_ntko.Getntkofile(url); if (dt.Rows.Count > 0) { fileid = dt.Rows[0]["fid"].ToString(); filetitle = dt.Rows[0]["ftitle"].ToString(); fileother = dt.Rows[0]["fother"].ToString(); filename = dt.Rows[0]["fname"].ToString(); } } } //生成痕迹稿start //在接受修订环节,打开文档时生成痕迹稿。 string lsMapPath=""; string lsMapPathsdec = ""; if (this.Request.QueryString["jsxd"] != null) { if (this.Request.QueryString["jsxd"].ToString() == "1") { lsMapPath = Server.MapPath("~/")+"/NTKO/uploadOfficeFile/"+filename;//虚拟目录的位置 lsMapPathsdec = Server.MapPath("~/") + "/NTKO/uploadOfficeFile/" + filename.Substring(0,filename.IndexOf(".doc"))+"hjbl"+".doc";//虚拟目录的位置 //File.Delete(lsMapPathsdec); if (File.Exists(lsMapPathsdec)) { //如果文件已经存在了,就不用产生痕迹稿了 } else { //如果没有生成则生成痕迹稿 File.Copy(lsMapPath, lsMapPathsdec, false); } } } //生成痕迹稿end }
//保存文档为office public void saveoffice() { string uploadoffiepath = Server.MapPath("uploadOfficeFile");//上传文件的路径 //string attpath = Server.MapPath(db.getattachpath().ToString());//上传附件文件路径 System.Web.HttpFileCollection uploadFiles = Request.Files; System.Web.HttpPostedFile theFile; bool isNewRecord = false; if ((fid.Length == 0) || (fid.Trim().Length == 0)) { isNewRecord = true; } else { isNewRecord = false; } if (uploadFiles.Count == 0) { Response.Write("没有文件上传!"); return; } else { //db.open(); try { for (int i = 0; i < uploadFiles.Count; i++) { theFile = uploadFiles[i]; if (uploadFiles.GetKey(i).ToUpper() == "EDITFILE")//上传文档控件中的文档 { string strcmd = ""; string time = System.DateTime.Now.ToString(); if (fname == "" || fname == null) { fname = time + "." + theFile.FileName.Substring(theFile.FileName.LastIndexOf('\\') + 1); } fname = fname.Replace(":", ".");//上传文件到磁盘,文件名中不允许带:符号 theFile.SaveAs(uploadoffiepath + @"\" + fname); HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko(); if (isNewRecord) // add new record to database { Hyoa_ntko.fname = fname; Hyoa_ntko.fsize = theFile.ContentLength.ToString(); Hyoa_ntko.ftitle = title; Hyoa_ntko.filetype = filetype; Hyoa_ntko.ftime = time; Hyoa_ntko.fother = fother; Hyoa_ntko.fpath = filepath; Hyoa_ntko.Insert(); } else { Hyoa_ntko.fid = System.Convert.ToInt32(fid); Hyoa_ntko.fname = fname; Hyoa_ntko.fsize = theFile.ContentLength.ToString(); Hyoa_ntko.ftitle = title; Hyoa_ntko.filetype = filetype; Hyoa_ntko.ftime = time; Hyoa_ntko.fother = fother; Hyoa_ntko.fpath = filepath; Hyoa_ntko.Update(); //strcmd = "Update files Set fname=@fname,fsize=@fsize,ftitle=@ftitle,filetype=@filetype,ftime=@ftime,fother=@fother," + // "fpath=@fpath WHERE fid=" + fid; } //string time = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString(); //System.Data.SqlClient.SqlCommand objCommand = new System.Data.SqlClient.SqlCommand(strcmd, db.connstr); //objCommand.Parameters.Add("@fname", System.Data.SqlDbType.VarChar).Value = fname; //objCommand.Parameters.Add("@fsize", System.Data.SqlDbType.VarChar).Value = theFile.ContentLength; //objCommand.Parameters.Add("@ftitle", System.Data.SqlDbType.VarChar).Value = title; //objCommand.Parameters.Add("@filetype", System.Data.SqlDbType.VarChar).Value = filetype; //objCommand.Parameters.Add("@ftime", System.Data.SqlDbType.VarChar).Value = time; //objCommand.Parameters.Add("@fother", System.Data.SqlDbType.VarChar).Value = fother; //objCommand.Parameters.Add("@fpath", System.Data.SqlDbType.VarChar).Value = filepath; } else//其它附件上传 { //string attcmd = "INSERT INTO attachs (fid,aname,asize,apath) Values(@fid, @aname, @asize, @apath)"; //fname = theFile.FileName.Substring(theFile.FileName.LastIndexOf('\\') + 1); //theFile.SaveAs(attpath + @"\" + fname.Replace(":", "."));//上传附件到磁盘,文件名中不允许带:符号 //System.Data.SqlClient.SqlCommand objCommand = new System.Data.SqlClient.SqlCommand(attcmd, db.connstr); //objCommand.Parameters.Add("@fid", System.Data.SqlDbType.Int).Value = System.Convert.ToInt64(fid); //objCommand.Parameters.Add("@aname", System.Data.SqlDbType.VarChar).Value = fname; //objCommand.Parameters.Add("@asize", System.Data.SqlDbType.VarChar).Value = theFile.ContentLength.ToString(); //objCommand.Parameters.Add("@apath", System.Data.SqlDbType.VarChar).Value = attachpath; //objCommand.ExecuteNonQuery(); //Response.Write("上传的附件: " + fname + "<br>"); //Response.Write("附件大小: " + theFile.ContentLength.ToString() + " bytes<br>"); } } } finally { //db.close(); } } }