public string hy_mudelname()
    {
        string mudelname = "";
        if (this.Request.QueryString["mid"] != null)
        {
            //得到模块中文名
            string ls_mid = "";
            ls_mid = this.Request.QueryString["mid"].ToString();
            if (ls_mid.Contains(","))
                ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(","));

            HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
            DataTable dtmudel = Hyoa_mudel.Getmudel(ls_mid);
            //Response.Write(Request.QueryString["mid"].ToString());
            if (dtmudel.Rows.Count > 0)
            {
                mudelname = dtmudel.Rows[0]["hy_mudelname"].ToString();
            }
        }
        return mudelname;
    }
    //判断是否有权限操作(ROLE中判断)
    //返回值:0(无权限)1(有权限)
    //如果模块未设置权限,则所有人有权限(个人通讯录等模块)
    private string Hy_IfHaveRole(string mudelid, string userid)
    {
        string ls_return = "0";

        //根据模块ID得到ROLEID
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dt_mudel = Hyoa_mudel.Getmudel(mudelid);
        string ls_roleid = "";
        if (dt_mudel.Rows.Count > 0)
        {
            if (dt_mudel.Rows[0]["hy_roleid"].ToString() == "")
            {
                //所有人开放权限
                ls_return = "1";
            }
            else
            {
                ls_roleid = dt_mudel.Rows[0]["hy_roleid"].ToString();
                HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser();
                ls_return = Hyoa_roleuser.GetIfHaveRoleByroleidanduserid(ls_roleid, userid);
            }
        }
        return ls_return;
    }
    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();
    }