예제 #1
0
    //保存或提交时的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;
    }
예제 #2
0
    //输出一个字段
    //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 = "&nbsp;";
                                }
                                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")  //有权限
                {
                    ls_laborinput = "1";
                }
            }
            else     //旧文档
            {
                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";
                    //}
                }
                //如果是“可修改所有文档的权限人员”,则可以修改所有的字段
                if (Hyoa_global.isHaveRole("Role9995", Session["hyuid"].ToString()))
                {
                    ls_laborinput = "1";
                }
            }

            //如果是输出LABLE,值为空则赋为&nbsp;不为空时需要转换回车和空格
            if (ls_laborinput == "0")
            {
                if (field_docvalue == "")
                {
                    field_docvalue = "&nbsp;";
                }
                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 = "&nbsp;";
                    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 = new DataTable();
                            if (ls_sql.Contains("#"))
                            {
                                ls_sql = ls_sql.Replace("#", "");
                                dt_options = Hyoa_global.GetDataTable_USER(ls_sql);
                            }
                            else
                            {
                                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 = "&nbsp;";
                    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 = "&nbsp;";
                    }
                    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> ";
                    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
                {
                    //新合同标识   add by wjs at 20150618--start
                    if (newHt != "")
                    {
                        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() + "&newHt=" + newHt + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    }
                    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=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    }
                    //新合同标识   add by wjs at 20150618--end
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    if (newHt != "")
                    {
                        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() + "&newHt=" + newHt + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    }
                    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;
    }
예제 #3
0
    //得到表单的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("&nbsp;"));
                    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("&nbsp;"));
                }
            }
        }

        //////////////////////////////////最后输出隐藏字段///////////////////////////////////////
        //得到所有需要显示的字段
        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("&nbsp;"));
                    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("&nbsp;"));
                }
            }
        }
    }
예제 #4
0
    //输出一个字段
    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");
            }
        }
    }
예제 #5
0
    //输出查询字段的表格(查询输入框)
    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("&nbsp;"));
                    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("&nbsp;"));
                }
            }
        }
        //插入查询按钮行
        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);
        tCell3.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;"));

        Button btnButton2 = new Button();
        //   btnButton2.ID = "btnsearch_dc";
        btnButton2.Text = " 导 出";
        // btnButton2.Click += new EventHandler(btndc_Click);
        //btnButton2.OnClientClick = "jssearch()";
        btnButton2.CssClass = "btn7";
        btnButton2.Click += new EventHandler(btnexport_Click);
        tCell3.Controls.Add(btnButton2);
    }
예제 #6
0
    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_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();
        //如果非流程(授权用户可新建信息、可删除所有信息)
        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;
            }
        }
        //如果非流程(授权用户可新建、只能删自己新建的信息)
        if (dttableconfig.Rows[0]["hy_tablerole"].ToString() == "3")
        {
            if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
            {
                this.isrole.Value = "1";
                this.newcontrol.Visible = true;
                this.delcontrol_sq.Visible = true;
                //this.copycontrol.Visible = true;
            }
        }

        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")
                    {

                        if (ls_searchtext.Contains(","))
                        {
                            string[] lv_searchfieldSplit = ls_searchtext.Split(',');
                            for (int n = 0; n < lv_searchfieldSplit.Length; n++)
                            {
                                if (n == 0)
                                {
                                    cmdStr_Search += " and hyc_" + ls_fieldid + " like '%" + lv_searchfieldSplit[n] + "%' ";
                                }
                                else
                                {
                                    cmdStr_Search += " or hyc_" + ls_fieldid + " like '%" + lv_searchfieldSplit[n] + "%' ";
                                }
                            }
                        }
                        else
                        {
                            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 sql_sc = "";          //sql语句    hy_iftx=1   表示该合同已删除
        if (this.txttableid.Value == "TableVODfwxy" || this.txttableid.Value == "Tableffpdfwht" || this.txttableid.Value == "Tablejdhazfwht" ||
            this.txttableid.Value == "Tablesyyhfwxy" || this.txttableid.Value == "TableDVBazfwdght" || this.txttableid.Value == "TableDVBazfwdght" ||
            this.txttableid.Value == "Tablejwdsjsxy" || this.txttableid.Value == "Tablejwdscsxy" || this.txttableid.Value == "Tablekdjrht" ||
             this.txttableid.Value == "Tablesjcsfwht" || this.txttableid.Value == "Tablesjgdcsfwht" || this.txttableid.Value == "Tablesjtxyyhzxy" ||
              this.txttableid.Value == "Tablezdyht" ||
              this.txttableid.Value == "Tablesyyhfwxy_new" || this.txttableid.Value == "Tableszdsywfwht_new" || this.txttableid.Value == "Tablejwdscsxy_new"
              || this.txttableid.Value == "Tablejwdsjm" || this.txttableid.Value == "Tablesjcsfwht_new" || this.txttableid.Value == "Tablekdjrht_new" ||
              this.txttableid.Value == "Tablesjgdcsfwht_new" || this.txttableid.Value == "Tablesjtxyyhzxy_new" || this.txttableid.Value == "Tableqtht"
            || this.txttableid.Value == "Tablegxhzhht")
        {
            sql_sc = " and hy_iftx is null";
        }

        string cmdStr = "";
        if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是")
        {
            string ls_from = "";
            ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + sql_sc + 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 " + 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);
        }
        else
        {
            string ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + sql_sc;
            //特殊处理  add by wjs   at 20150701   依据模块id得到权限id   再依据权限id来判断显示内容  start
            string strRoleid = "";
            string sqlSelect = " select hy_roleid from hyt_mudel where hy_mudelid='" + this.txtmudelid.Value + "' ";
            DataTable dt_role = Hyoa_global.GetDataTable_BASE(sqlSelect);
            if (dt_role.Rows.Count > 0)
            {
                strRoleid = dt_role.Rows[0]["hy_roleid"].ToString();
                strRoleid = strRoleid.Substring(0, strRoleid.Length - 3);
                //查看所有权限  直接查看所有
                if (Hyoa_global.isHaveRole(strRoleid + "001", this.Session["hyuid"].ToString()))
                {
                }
                else if (Hyoa_global.isHaveRole(strRoleid + "003", this.Session["hyuid"].ToString()))
                {
                    ls_from += " and hy_djrbmid='" + this.Session["hydeptid"].ToString() + "' ";
                }
                else
                {
                    ls_from += " and hy_djrid='" + this.Session["hyuid"].ToString() + "' ";
                }
            }
            else
            {
                ls_from += " and hy_djrid='" + this.Session["hyuid"].ToString() + "' ";
            }
            //特殊处理  add by wjs   at 20150701   依据模块id得到权限id   再依据权限id来判断显示内容  end
            ls_from += " " + 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 " + 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();
            }
            this.strSQL.Value = cmdStr;
            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 = "&nbsp;";
                //根据得到的SQL字段,得到输出字段的值end
                if (dtgetsqlfield.Rows[0]["hy_ifdbsybt"].ToString() == "是")
                {
                    ls_col += "<td width=\"" + lscolwidthper + "%\" align=\"center\"><a href=\"#\" onclick=\"var ss='main_flc.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>";
                }
            }
            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();
    }
예제 #7
0
    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 ";
        if (this.txttableid.Value == "Tablefpbd")
        {
            ls_from += " and hyc_sfbf <> '1' " + cmdStr_Search;
        }
        else
        {
            ls_from += 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 " + 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 = "&nbsp;";
                //根据得到的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>";
                }
            }
            //如果是流程表单,则最后追加两列(当前环节和当前处理人)
            #region 如果是流程表单,则最后追加两列(当前环节和当前处理人)
            //表头
            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>";
                //if (dt.Rows[i]["hy_curtachename"].ToString() != "结束")
                //{
                //    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() + "&nbsp;</td>";
                //if (dt.Rows[i]["hy_curtachename"].ToString() != "结束")
                //{
                //    ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + "&nbsp;</td>";
                //}
            }
            #endregion

            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();
    }