protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
     HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (var i = 0; i < v_uids.Length; i++)
     {
         if (v_uids[i] != "")
         {
             Hyoa_listconfig.ID = v_uids[i];
             Hyoa_listconfig.Delete();
             Hyoa_listsearchfield.hy_listid = v_uids[i];
             Hyoa_listsearchfield.DeleteBylistid();
         }
     }
     this.txtuids.Value = "";
     //DataPlay(1);
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
Esempio n. 2
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_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (dttableconfig.Rows[0]["hy_ifflowdoc"].ToString() == "是")
        {
            //如果有流程的话,新建按钮就一直显示,不用作判断的,只要判断删除按钮就行。
            if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
            {
                this.isrole.Value = "1";
                this.delcontrol.Visible = true;
                this.newcontrol.Visible = true;
                //this.copycontrol.Visible = false;   //流程模块暂时都不能复制
            }
            else
            {
                this.isrole.Value = "0";
                this.newcontrol.Visible = true;
            }
        }
        else
        {
            //如果非流程(授权用户统一管理)
            if(dttableconfig.Rows[0]["hy_tablerole"].ToString() == "0")
            {
                if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
                {
                    this.isrole.Value = "1";
                    this.newcontrol.Visible = true;
                    this.delcontrol.Visible = true;
                    //this.copycontrol.Visible = true;
                }
                else
                {
                    this.isrole.Value = "0";
                }
            }
            //如果非流程(每个人管理自己的信息)
            if (dttableconfig.Rows[0]["hy_tablerole"].ToString() == "1")
            {
                this.isrole.Value = "1";
                this.newcontrol.Visible = true;
                this.delcontrol_my.Visible = true;
                //this.copycontrol.Visible = true;
            }
            //如果非流程(每个人操作自己的信息、授权用户可管理所有信息)
            if (dttableconfig.Rows[0]["hy_tablerole"].ToString() == "2")
            {
                if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
                {
                    this.isrole.Value = "1";
                    this.newcontrol.Visible = true;
                    this.delcontrol.Visible = true;
                    //this.copycontrol.Visible = true;
                }
                else
                {
                    this.isrole.Value = "0";
                    this.newcontrol.Visible = true;
                    this.delcontrol_my.Visible = true;
                    //this.copycontrol.Visible = true;
                }
            }
        }

        //得到当前页号
        this.lbdisplaytitle.Text = "";
        this.curpage.Text = PageNo.ToString();

        //---查询条件---开始
        HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain();
        Hyoa_flowmain.hy_mudelid = this.txtmudelid.Value;
        Hyoa_flowmain.hy_tableid = this.txttableid.Value;
        Hyoa_flowmain.hy_bt = this.hy_bt.Text;
        Hyoa_flowmain.hy_djrname = this.hy_djrname.Text;
        Hyoa_flowmain.hy_djrbmname = this.hy_djrbmname.Text;
        Hyoa_flowmain.hy_djsj_start = this.hy_djsj_start.Text;
        Hyoa_flowmain.hy_djsj_end = this.hy_djsj_end.Text;
        Hyoa_flowmain.hy_bt = this.hy_bt.Text;
        Hyoa_flowmain.hy_content1 = this.hy_content1.Text;
        Hyoa_flowmain.hy_content2 = this.hy_content2.Text;
        Hyoa_flowmain.hy_content3 = this.hy_content3.Text;
        Hyoa_flowmain.hy_content4 = this.hy_content4.Text;
        Hyoa_flowmain.hy_content5 = this.hy_content5.Text;
        Hyoa_flowmain.hy_field1 = this.hy_field1.Text;
        Hyoa_flowmain.hy_field2 = this.hy_field2.Text;
        Hyoa_flowmain.hy_field3 = this.hy_field3.Text;
        Hyoa_flowmain.hy_field4 = this.hy_field4.Text;
        Hyoa_flowmain.hy_field5 = this.hy_field5.Text;
        Hyoa_flowmain.hy_field6 = this.hy_field6.Text;
        Hyoa_flowmain.hy_field7 = this.hy_field7.Text;
        Hyoa_flowmain.hy_field8 = this.hy_field8.Text;
        Hyoa_flowmain.hy_field9 = this.hy_field9.Text;
        Hyoa_flowmain.hy_field10 = this.hy_field10.Text;
        Hyoa_flowmain.hy_field11 = this.hy_field11.Text;
        Hyoa_flowmain.hy_field12 = this.hy_field12.Text;
        Hyoa_flowmain.hy_field13 = this.hy_field13.Text;
        Hyoa_flowmain.hy_field14 = this.hy_field14.Text;
        Hyoa_flowmain.hy_field15 = this.hy_field15.Text;
        Hyoa_flowmain.hy_field16 = this.hy_field16.Text;
        Hyoa_flowmain.hy_field17 = this.hy_field17.Text;
        Hyoa_flowmain.hy_field18 = this.hy_field18.Text;
        Hyoa_flowmain.hy_field19 = this.hy_field19.Text;
        Hyoa_flowmain.hy_field20 = this.hy_field20.Text;
        Hyoa_flowmain.hy_field21 = this.hy_field21.Text;
        Hyoa_flowmain.hy_field22 = this.hy_field22.Text;
        Hyoa_flowmain.hy_field23 = this.hy_field23.Text;
        Hyoa_flowmain.hy_field24 = this.hy_field24.Text;
        Hyoa_flowmain.hy_field25 = this.hy_field25.Text;
        Hyoa_flowmain.hy_field26 = this.hy_field26.Text;
        Hyoa_flowmain.hy_field27 = this.hy_field27.Text;
        Hyoa_flowmain.hy_field28 = this.hy_field28.Text;
        Hyoa_flowmain.hy_field29 = this.hy_field29.Text;
        Hyoa_flowmain.hy_field30 = this.hy_field30.Text;
        Hyoa_flowmain.hy_field31_start = this.hy_field31_start.Text;
        Hyoa_flowmain.hy_field32_start = this.hy_field32_start.Text;
        Hyoa_flowmain.hy_field33_start = this.hy_field33_start.Text;
        Hyoa_flowmain.hy_field34_start = this.hy_field34_start.Text;
        Hyoa_flowmain.hy_field35_start = this.hy_field35_start.Text;
        Hyoa_flowmain.hy_field31_end = this.hy_field31_end.Text;
        Hyoa_flowmain.hy_field32_end = this.hy_field32_end.Text;
        Hyoa_flowmain.hy_field33_end = this.hy_field33_end.Text;
        Hyoa_flowmain.hy_field34_end = this.hy_field34_end.Text;
        Hyoa_flowmain.hy_field35_end = this.hy_field35_end.Text;
        if (this.hy_field36_start.Text == "")
        {
            this.hy_field36_start.Text = "0";
        }
        if (this.hy_field37_start.Text == "")
        {
            this.hy_field37_start.Text = "0";
        }
        if (this.hy_field38_start.Text == "")
        {
            this.hy_field38_start.Text = "0";
        }
        if (this.hy_field39_start.Text == "")
        {
            this.hy_field39_start.Text = "0";
        }
        if (this.hy_field40_start.Text == "")
        {
            this.hy_field40_start.Text = "0";
        }
        if (this.hy_field36_end.Text == "")
        {
            this.hy_field36_end.Text = "0";
        }
        if (this.hy_field37_end.Text == "")
        {
            this.hy_field37_end.Text = "0";
        }
        if (this.hy_field38_end.Text == "")
        {
            this.hy_field38_end.Text = "0";
        }
        if (this.hy_field39_end.Text == "")
        {
            this.hy_field39_end.Text = "0";
        }
        if (this.hy_field40_end.Text == "")
        {
            this.hy_field40_end.Text = "0";
        }
        Hyoa_flowmain.hy_field36_start = float.Parse(this.hy_field36_start.Text);
        Hyoa_flowmain.hy_field37_start = float.Parse(this.hy_field37_start.Text);
        Hyoa_flowmain.hy_field38_start = float.Parse(this.hy_field38_start.Text);
        Hyoa_flowmain.hy_field39_start = float.Parse(this.hy_field39_start.Text);
        Hyoa_flowmain.hy_field40_start = float.Parse(this.hy_field40_start.Text);
        Hyoa_flowmain.hy_field36_end = float.Parse(this.hy_field36_end.Text);
        Hyoa_flowmain.hy_field37_end = float.Parse(this.hy_field37_end.Text);
        Hyoa_flowmain.hy_field38_end = float.Parse(this.hy_field38_end.Text);
        Hyoa_flowmain.hy_field39_end = float.Parse(this.hy_field39_end.Text);
        Hyoa_flowmain.hy_field40_end = float.Parse(this.hy_field40_end.Text);
        Hyoa_flowmain.hy_field41 = this.hy_field41.Text;
        Hyoa_flowmain.hy_field42 = this.hy_field42.Text;
        Hyoa_flowmain.hy_field43 = this.hy_field43.Text;
        Hyoa_flowmain.hy_field44 = this.hy_field44.Text;
        Hyoa_flowmain.hy_field45 = this.hy_field45.Text;
        Hyoa_flowmain.hy_field46 = this.hy_field46.Text;
        Hyoa_flowmain.hy_field47 = this.hy_field47.Text;
        Hyoa_flowmain.hy_field48 = this.hy_field48.Text;
        Hyoa_flowmain.hy_field49 = this.hy_field49.Text;
        Hyoa_flowmain.hy_field50 = this.hy_field50.Text;
        Hyoa_flowmain.hy_field51 = this.hy_field51.Text;
        Hyoa_flowmain.hy_field52 = this.hy_field52.Text;
        Hyoa_flowmain.hy_field53 = this.hy_field53.Text;
        Hyoa_flowmain.hy_field54 = this.hy_field54.Text;
        Hyoa_flowmain.hy_field55 = this.hy_field55.Text;
        Hyoa_flowmain.hy_field56 = this.hy_field56.Text;
        Hyoa_flowmain.hy_field57 = this.hy_field57.Text;
        Hyoa_flowmain.hy_field58 = this.hy_field58.Text;
        Hyoa_flowmain.hy_field59 = this.hy_field59.Text;
        Hyoa_flowmain.hy_field60 = this.hy_field60.Text;

        Hyoa_flowmain.hy_field61_start = this.hy_field61_start.Text;
        Hyoa_flowmain.hy_field62_start = this.hy_field62_start.Text;
        Hyoa_flowmain.hy_field63_start = this.hy_field63_start.Text;
        Hyoa_flowmain.hy_field64_start = this.hy_field64_start.Text;
        Hyoa_flowmain.hy_field65_start = this.hy_field65_start.Text;
        Hyoa_flowmain.hy_field66_start = this.hy_field66_start.Text;
        Hyoa_flowmain.hy_field67_start = this.hy_field67_start.Text;
        Hyoa_flowmain.hy_field68_start = this.hy_field68_start.Text;
        Hyoa_flowmain.hy_field69_start = this.hy_field69_start.Text;
        Hyoa_flowmain.hy_field70_start = this.hy_field70_start.Text;
        Hyoa_flowmain.hy_field61_end = this.hy_field61_end.Text;
        Hyoa_flowmain.hy_field62_end = this.hy_field62_end.Text;
        Hyoa_flowmain.hy_field63_end = this.hy_field63_end.Text;
        Hyoa_flowmain.hy_field64_end = this.hy_field64_end.Text;
        Hyoa_flowmain.hy_field65_end = this.hy_field65_end.Text;
        Hyoa_flowmain.hy_field66_end = this.hy_field66_end.Text;
        Hyoa_flowmain.hy_field67_end = this.hy_field67_end.Text;
        Hyoa_flowmain.hy_field68_end = this.hy_field68_end.Text;
        Hyoa_flowmain.hy_field69_end = this.hy_field69_end.Text;
        Hyoa_flowmain.hy_field70_end = this.hy_field70_end.Text;

        if (this.hy_field71_start.Text == "")
        {
            this.hy_field71_start.Text = "0";
        }
        if (this.hy_field72_start.Text == "")
        {
            this.hy_field72_start.Text = "0";
        }
        if (this.hy_field73_start.Text == "")
        {
            this.hy_field73_start.Text = "0";
        }
        if (this.hy_field74_start.Text == "")
        {
            this.hy_field74_start.Text = "0";
        }
        if (this.hy_field75_start.Text == "")
        {
            this.hy_field75_start.Text = "0";
        }
        if (this.hy_field76_start.Text == "")
        {
            this.hy_field76_start.Text = "0";
        }
        if (this.hy_field77_start.Text == "")
        {
            this.hy_field77_start.Text = "0";
        }
        if (this.hy_field78_start.Text == "")
        {
            this.hy_field78_start.Text = "0";
        }
        if (this.hy_field79_start.Text == "")
        {
            this.hy_field79_start.Text = "0";
        }
        if (this.hy_field80_start.Text == "")
        {
            this.hy_field80_start.Text = "0";
        }
        if (this.hy_field71_end.Text == "")
        {
            this.hy_field71_end.Text = "0";
        }
        if (this.hy_field72_end.Text == "")
        {
            this.hy_field72_end.Text = "0";
        }
        if (this.hy_field73_end.Text == "")
        {
            this.hy_field73_end.Text = "0";
        }
        if (this.hy_field74_end.Text == "")
        {
            this.hy_field74_end.Text = "0";
        }
        if (this.hy_field75_end.Text == "")
        {
            this.hy_field75_end.Text = "0";
        }
        if (this.hy_field76_end.Text == "")
        {
            this.hy_field76_end.Text = "0";
        }
        if (this.hy_field77_end.Text == "")
        {
            this.hy_field77_end.Text = "0";
        }
        if (this.hy_field78_end.Text == "")
        {
            this.hy_field78_end.Text = "0";
        }
        if (this.hy_field79_end.Text == "")
        {
            this.hy_field79_end.Text = "0";
        }
        if (this.hy_field80_end.Text == "")
        {
            this.hy_field80_end.Text = "0";
        }

        if (this.hy_field81_start.Text == "")
        {
            this.hy_field81_start.Text = "0";
        }
        if (this.hy_field82_start.Text == "")
        {
            this.hy_field82_start.Text = "0";
        }
        if (this.hy_field83_start.Text == "")
        {
            this.hy_field83_start.Text = "0";
        }
        if (this.hy_field84_start.Text == "")
        {
            this.hy_field84_start.Text = "0";
        }
        if (this.hy_field85_start.Text == "")
        {
            this.hy_field85_start.Text = "0";
        }
        if (this.hy_field86_start.Text == "")
        {
            this.hy_field86_start.Text = "0";
        }
        if (this.hy_field87_start.Text == "")
        {
            this.hy_field87_start.Text = "0";
        }
        if (this.hy_field88_start.Text == "")
        {
            this.hy_field88_start.Text = "0";
        }
        if (this.hy_field89_start.Text == "")
        {
            this.hy_field89_start.Text = "0";
        }
        if (this.hy_field90_start.Text == "")
        {
            this.hy_field90_start.Text = "0";
        }
        if (this.hy_field81_end.Text == "")
        {
            this.hy_field81_end.Text = "0";
        }
        if (this.hy_field82_end.Text == "")
        {
            this.hy_field82_end.Text = "0";
        }
        if (this.hy_field83_end.Text == "")
        {
            this.hy_field83_end.Text = "0";
        }
        if (this.hy_field84_end.Text == "")
        {
            this.hy_field84_end.Text = "0";
        }
        if (this.hy_field85_end.Text == "")
        {
            this.hy_field85_end.Text = "0";
        }
        if (this.hy_field86_end.Text == "")
        {
            this.hy_field86_end.Text = "0";
        }
        if (this.hy_field87_end.Text == "")
        {
            this.hy_field87_end.Text = "0";
        }
        if (this.hy_field88_end.Text == "")
        {
            this.hy_field88_end.Text = "0";
        }
        if (this.hy_field89_end.Text == "")
        {
            this.hy_field89_end.Text = "0";
        }
        if (this.hy_field90_end.Text == "")
        {
            this.hy_field90_end.Text = "0";
        }
        //ztm
        if (this.hy_field91_start.Text == "")
        {
            this.hy_field91_start.Text = "0";
        }
        if (this.hy_field92_start.Text == "")
        {
            this.hy_field92_start.Text = "0";
        }
        if (this.hy_field93_start.Text == "")
        {
            this.hy_field93_start.Text = "0";
        }
        if (this.hy_field94_start.Text == "")
        {
            this.hy_field94_start.Text = "0";
        }
        if (this.hy_field95_start.Text == "")
        {
            this.hy_field95_start.Text = "0";
        }
        if (this.hy_field96_start.Text == "")
        {
            this.hy_field96_start.Text = "0";
        }
        if (this.hy_field97_start.Text == "")
        {
            this.hy_field97_start.Text = "0";
        }
        if (this.hy_field98_start.Text == "")
        {
            this.hy_field98_start.Text = "0";
        }
        if (this.hy_field99_start.Text == "")
        {
            this.hy_field99_start.Text = "0";
        }
        if (this.hy_field100_start.Text == "")
        {
            this.hy_field100_start.Text = "0";
        }
        if (this.hy_field91_end.Text == "")
        {
            this.hy_field91_end.Text = "0";
        }
        if (this.hy_field92_end.Text == "")
        {
            this.hy_field92_end.Text = "0";
        }
        if (this.hy_field93_end.Text == "")
        {
            this.hy_field93_end.Text = "0";
        }
        if (this.hy_field94_end.Text == "")
        {
            this.hy_field94_end.Text = "0";
        }
        if (this.hy_field95_end.Text == "")
        {
            this.hy_field95_end.Text = "0";
        }
        if (this.hy_field96_end.Text == "")
        {
            this.hy_field96_end.Text = "0";
        }
        if (this.hy_field97_end.Text == "")
        {
            this.hy_field97_end.Text = "0";
        }
        if (this.hy_field98_end.Text == "")
        {
            this.hy_field98_end.Text = "0";
        }
        if (this.hy_field99_end.Text == "")
        {
            this.hy_field99_end.Text = "0";
        }
        if (this.hy_field100_end.Text == "")
        {
            this.hy_field100_end.Text = "0";
        }
        Hyoa_flowmain.hy_field71_start = float.Parse(this.hy_field71_start.Text);
        Hyoa_flowmain.hy_field72_start = float.Parse(this.hy_field72_start.Text);
        Hyoa_flowmain.hy_field73_start = float.Parse(this.hy_field73_start.Text);
        Hyoa_flowmain.hy_field74_start = float.Parse(this.hy_field74_start.Text);
        Hyoa_flowmain.hy_field75_start = float.Parse(this.hy_field75_start.Text);
        Hyoa_flowmain.hy_field76_start = float.Parse(this.hy_field76_start.Text);
        Hyoa_flowmain.hy_field77_start = float.Parse(this.hy_field77_start.Text);
        Hyoa_flowmain.hy_field78_start = float.Parse(this.hy_field78_start.Text);
        Hyoa_flowmain.hy_field79_start = float.Parse(this.hy_field79_start.Text);
        Hyoa_flowmain.hy_field80_start = float.Parse(this.hy_field80_start.Text);

        Hyoa_flowmain.hy_field71_end = float.Parse(this.hy_field71_end.Text);
        Hyoa_flowmain.hy_field72_end = float.Parse(this.hy_field72_end.Text);
        Hyoa_flowmain.hy_field73_end = float.Parse(this.hy_field73_end.Text);
        Hyoa_flowmain.hy_field74_end = float.Parse(this.hy_field74_end.Text);
        Hyoa_flowmain.hy_field75_end = float.Parse(this.hy_field75_end.Text);
        Hyoa_flowmain.hy_field76_end = float.Parse(this.hy_field76_end.Text);
        Hyoa_flowmain.hy_field77_end = float.Parse(this.hy_field77_end.Text);
        Hyoa_flowmain.hy_field78_end = float.Parse(this.hy_field78_end.Text);
        Hyoa_flowmain.hy_field79_end = float.Parse(this.hy_field79_end.Text);
        Hyoa_flowmain.hy_field80_end = float.Parse(this.hy_field80_end.Text);

        Hyoa_flowmain.hy_field81_start = float.Parse(this.hy_field81_start.Text);
        Hyoa_flowmain.hy_field82_start = float.Parse(this.hy_field82_start.Text);
        Hyoa_flowmain.hy_field83_start = float.Parse(this.hy_field83_start.Text);
        Hyoa_flowmain.hy_field84_start = float.Parse(this.hy_field84_start.Text);
        Hyoa_flowmain.hy_field85_start = float.Parse(this.hy_field85_start.Text);
        Hyoa_flowmain.hy_field86_start = float.Parse(this.hy_field86_start.Text);
        Hyoa_flowmain.hy_field87_start = float.Parse(this.hy_field87_start.Text);
        Hyoa_flowmain.hy_field88_start = float.Parse(this.hy_field88_start.Text);
        Hyoa_flowmain.hy_field89_start = float.Parse(this.hy_field89_start.Text);
        Hyoa_flowmain.hy_field90_start = float.Parse(this.hy_field90_start.Text);

        Hyoa_flowmain.hy_field81_end = float.Parse(this.hy_field81_end.Text);
        Hyoa_flowmain.hy_field82_end = float.Parse(this.hy_field82_end.Text);
        Hyoa_flowmain.hy_field83_end = float.Parse(this.hy_field83_end.Text);
        Hyoa_flowmain.hy_field84_end = float.Parse(this.hy_field84_end.Text);
        Hyoa_flowmain.hy_field85_end = float.Parse(this.hy_field85_end.Text);
        Hyoa_flowmain.hy_field86_end = float.Parse(this.hy_field86_end.Text);
        Hyoa_flowmain.hy_field87_end = float.Parse(this.hy_field87_end.Text);
        Hyoa_flowmain.hy_field88_end = float.Parse(this.hy_field88_end.Text);
        Hyoa_flowmain.hy_field89_end = float.Parse(this.hy_field89_end.Text);
        Hyoa_flowmain.hy_field90_end = float.Parse(this.hy_field90_end.Text);

        Hyoa_flowmain.hy_field91_start = float.Parse(this.hy_field91_start.Text);
        Hyoa_flowmain.hy_field92_start = float.Parse(this.hy_field92_start.Text);
        Hyoa_flowmain.hy_field93_start = float.Parse(this.hy_field93_start.Text);
        Hyoa_flowmain.hy_field94_start = float.Parse(this.hy_field94_start.Text);
        Hyoa_flowmain.hy_field95_start = float.Parse(this.hy_field95_start.Text);
        Hyoa_flowmain.hy_field96_start = float.Parse(this.hy_field96_start.Text);
        Hyoa_flowmain.hy_field97_start = float.Parse(this.hy_field97_start.Text);
        Hyoa_flowmain.hy_field98_start = float.Parse(this.hy_field98_start.Text);
        Hyoa_flowmain.hy_field99_start = float.Parse(this.hy_field99_start.Text);
        Hyoa_flowmain.hy_field100_start = float.Parse(this.hy_field100_start.Text);

        Hyoa_flowmain.hy_field91_end = float.Parse(this.hy_field91_end.Text);
        Hyoa_flowmain.hy_field92_end = float.Parse(this.hy_field92_end.Text);
        Hyoa_flowmain.hy_field93_end = float.Parse(this.hy_field93_end.Text);
        Hyoa_flowmain.hy_field94_end = float.Parse(this.hy_field94_end.Text);
        Hyoa_flowmain.hy_field95_end = float.Parse(this.hy_field95_end.Text);
        Hyoa_flowmain.hy_field96_end = float.Parse(this.hy_field96_end.Text);
        Hyoa_flowmain.hy_field97_end = float.Parse(this.hy_field97_end.Text);
        Hyoa_flowmain.hy_field98_end = float.Parse(this.hy_field98_end.Text);
        Hyoa_flowmain.hy_field99_end = float.Parse(this.hy_field99_end.Text);
        Hyoa_flowmain.hy_field100_end = float.Parse(this.hy_field100_end.Text);

        Hyoa_flowmain.hy_curclrid = this.Session["hyuid"].ToString();
        Hyoa_flowmain.hy_curuserid = this.Session["hyuid"].ToString();
        //排序
        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dt_listconfig = Hyoa_listconfig.GetlistconfigByTableid(this.txttableid.Value);
        if (dt_listconfig.Rows.Count > 0)
        {
            Hyoa_flowmain.hy_sorttype = dt_listconfig.Rows[0]["hy_sortfield"].ToString() + " " + dt_listconfig.Rows[0]["hy_sorttype"].ToString();
        }

        //---查询条件---结束

        //--根据查询条件得到返回数据集--s
        DataTable dt;
        DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value);  //得到表配置信息查看当前表是否有流程 hy_ifflowdoc
        dt = Hyoa_flowmain.GetflowmainsByIf_db();  //输出当前处理人是自己的dt
        //if (dttable.Rows[0]["hy_ifflowdoc"].ToString()=="是")
        //{
        //    //this.Response.Write("<script>alert('" + dttable.Rows[0]["hy_ispuballByflowYB"].ToString() + "')</script>");
        //     //dt = Hyoa_flowmain.GetflowmainsByIf();  //输出流程的dt
        //    if (dttable.Rows[0]["hy_ispuballByflowYB"].ToString() == "是")
        //    {
        //        dt = Hyoa_flowmain.GetflowmainsByIf_jsDisplayAll();  //输出流程的dt
        //    }
        //    else
        //    {
        //        dt = Hyoa_flowmain.GetflowmainsByIf();  //输出流程的dt
        //    }
        //}
        //else
        //{
        //    if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是")
        //    {
        //        dt = Hyoa_flowmain.GetAllflowmainsByNoFlows();//输出所有的dt
        //    }
        //    else
        //    {
        //        dt = Hyoa_flowmain.GetPersonerflowmainsByNoFlows();//输出自己的dt
        //    }
        //}
        //--根据查询条件得到返回数据集--e

        //开始输出----整合成HTML为数据行
        DataTable tempTable = dt.Clone();
        DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列  add
        tempTable.Columns.Add(col);  //追加一列  add
        string lscolname = "";
        string lscolnameid = "";
        string lscolwidth = "";
        string ls_col = "";
        string[] lvcolname;
        string[] lvcolnameid;
        string[] lvcolwidth;
        string lscolwidthper;

        //HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dtlist = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(this.txtmudelid.Value,this.txttableid.Value);
        lscolname = dtlist.Rows[0]["hy_columnshow"].ToString();  //要显示的列名:附件,标题,收文来源
        lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString();  //要显示的列名id:uploadfile1,Hy_bt,Hy_swly
        lscolwidth = dtlist.Rows[0]["hy_width"].ToString();  //要显示的列名id:10,20,30
        lvcolname = lscolname.Split(',');
        lvcolnameid = lscolnameid.Split(',');
        lvcolwidth = lscolwidth.Split(',');
        if (dt.Rows.Count <= 0)
        {
            //如果没有数据则输出表头
            for (int n = 0; n < lvcolname.Length; n++)
            {
                if (n >= lvcolwidth.Length)
                { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
                else
                { lscolwidthper = lvcolwidth[n]; }
                this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
            }
        }
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            //输出主表所有字段,start
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            //输出主表所有字段,end

            //////开始得到列的值
            HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
            DataTable dtgetsqlfield;
            for (int m = 0; m < lvcolname.Length; m++)
            {
                //如果有数据,则输出数据
                if (m >= lvcolwidth.Length)
                { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
                else
                { lscolwidthper = lvcolwidth[m]; }

                dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m],this.txttableid.Value);
                //ztm
                if (i % System.Int32.Parse(PageSize.Text) == 0)
                    this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[m] + "</td>";

                //根据字段英文名,得到数据库中对应的字段
                string lsgetsqlfield = dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString();
                //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
                string lsgetputfiled="";
                if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                {
                    lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
                }
                else
                {
                    //解决Float小数点后面出现N位小数乱码的问题
                    if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
                    {
                        //是否包含小数点,包含的话,取小数点后两位
                        if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
                        {
                            lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
                        }
                        else
                        {
                            lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
                        }

                        //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                    }else
                    {
                        lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                    }

                }
                if (lsgetputfiled == "")
                    lsgetputfiled = "&nbsp;";
                //根据得到的SQL字段,得到输出字段的值end
                if (lsgetputfiled == "1900-1-1")
                    lsgetputfiled = "";
                ls_col += "<td width=\"" + lscolwidthper + "%\" align=\"center\">" + lsgetputfiled + "</td>";
            }
            //如果是流程表单,则最后追加两列(当前环节和当前处理人)
            //表头
            if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null && i == (PageNo - 1) * System.Int32.Parse(PageSize.Text))
            {
                this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前环节</td>";
                this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前处理人</td>";
            }
            //数据
            if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null)
            {
                ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curtachename"].ToString() + "&nbsp;</td>";
                ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + "&nbsp;</td>";
            }

            dr["displaycol"] = ls_col;  //将新值赋给相应的列  add
            ls_col = "";
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("/login.aspx");

        if (this.Request.QueryString["mid"] != null)
        {
            //得到模块ID
            this.txtmudelid.Value = this.Request.QueryString["mid"].ToString();
        }
        else
        {
            this.Response.Write("<script>alert('模块ID没有传入,请联系管理员!');</script>");
            return;
        }
        if (this.Request.QueryString["tableid"] != null)
        {
            //表的ID
            this.txttableid.Value = this.Request.QueryString["tableid"].ToString();
            //得到表名
            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
            DataTable dt_tableconfig = Hyoa_tableconfig.GetTable(this.txttableid.Value);
            if (dt_tableconfig.Rows.Count > 0)
                this.lblcurtachenameshow.Text = dt_tableconfig.Rows[0]["hy_name"].ToString();
        }
        else
        {
            this.Response.Write("<script>alert('表单ID没有传入,请联系管理员!');</script>");
            return;
        }

        if (!IsPostBack)
        {
            //判断是否需要查询(目前一个表单只能对应一个列表,所以直接用表单ID进行查找)
            HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
            DataTable dt_listconfig = Hyoa_listconfig.GetlistconfigByTableid(this.txttableid.Value);
            if (dt_listconfig.Rows.Count > 0)
            {
                if (dt_listconfig.Rows[0]["hy_ifsearch"].ToString() == "是")
                    GetSearchTableHtml();//查询表格动态生成
            }

            DataPlay(1);   //列表区动态生成
            PageListItem();
            EnabledWhatButton();
            if (this.txtmudelid.Value == "kqgl" && this.txttableid.Value == "74e7e280-4fc5-4ccb-be3d-0f995ac2c934")
            {
                this.delcontrol_my.Visible = false;
                this.newcontrol.Visible = false;

            }
            if (this.txtmudelid.Value == "clgl" && this.txttableid.Value == "0b5c53fe-114b-4fa3-8b59-4163b3053504")
            {
                this.exportexcel.Visible = true;
            }

            ///只有管理员岗位能删除(大榭特有)
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
            }
            else
            {
                this.delcontrol.Visible = false;
                this.delcontrol_my.Visible = false;
            }

        }
    }
    private void DataPlay(int PageNo)
    {
        //根据表ID和模块ID得到当前传进来的模块是否有流程
        HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
        DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value);

        //根据表单得到对应的所有字段
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbytableid(dttableconfig.Rows[0]["ID"].ToString());
        //循环所有字段
        string ls_flowfield = "";
        if (dtflowfield.Rows.Count > 0)
        {
            for (int i = 0; i < dtflowfield.Rows.Count; i++)
            {
                string ls_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString();
                if (ls_fieldtype == "文本" || ls_fieldtype == "多行文本" || ls_fieldtype == "文本加按钮" || ls_fieldtype == "多行文本加按钮" || ls_fieldtype == "日期" || ls_fieldtype == "数值" || ls_fieldtype == "对话框列表" || ls_fieldtype == "复选框" || ls_fieldtype == "单选框" || ls_fieldtype == "口令")
                {
                    ls_flowfield += ",a.hyc_" + dtflowfield.Rows[i]["hy_fieldid"].ToString();
                }
            }
        }

        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();

        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dtlist = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value);     //列表配置

        this.lbdisplaytitle.Text = "";
        //得到当前页号
        this.curpage.Text = PageNo.ToString();

        //---查询条件---开始
        string cmdStr_Search = "";
        if (txtsearchfields.Text != "")
        {
            string[] lv_searchfields = txtsearchfields.Text.Split(',');
            string[] lv_searchfields_sx = txtsearchfields_sx.Text.Split(',');
            for (int i = 0; i < lv_searchfields.Length; i++)
            {
                string ls_fieldid = lv_searchfields[i].ToString();
                string ls_fieldid_sx = lv_searchfields_sx[i].ToString();
                string ls_searchtext = "";
                if (this.Request.Form[ls_fieldid] != null)
                {
                    ls_searchtext = this.Request.Form[ls_fieldid].ToString();
                }
                if (ls_searchtext != "")
                {
                    if (ls_fieldid_sx == "0")
                    {
                        cmdStr_Search += " and hyc_" + ls_fieldid + " like '%" + ls_searchtext + "%' ";
                    }
                    else
                    {
                        if (ls_fieldid_sx == "1")
                        {
                            if (Session["conntype"].ToString() == "SQL")
                            {
                                cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) >= '" + ls_searchtext + "' ";
                            }
                            if (Session["conntype"].ToString() == "ORACLE")
                            {
                                cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') >= '" + ls_searchtext + "' ";
                            }
                        }
                        if (ls_fieldid_sx == "2")
                        {
                            if (Session["conntype"].ToString() == "SQL")
                            {
                                cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) <= '" + ls_searchtext + "' ";
                            }
                            if (Session["conntype"].ToString() == "ORACLE")
                            {
                                cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') <= '" + ls_searchtext + "' ";
                            }
                        }
                        if (ls_fieldid_sx == "3")
                        {
                            cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " >= " + ls_searchtext + " ";
                        }
                        if (ls_fieldid_sx == "4")
                        {
                            cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " <= " + ls_searchtext + " ";
                        }
                    }
                }
            }
        }
        //---查询条件---结束
        //---排序---开始
        string cmdStr_SearchSort = "";
        if (dtlist.Rows[0]["hy_sortfield1"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield2"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield3"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
        }
        if (this.txtfieldid.Value != "" && this.txtfieldsort.Value != "")
        {
            cmdStr_SearchSort = " order by hyc_" + this.txtfieldid.Value + " " + this.txtfieldsort.Value + " ";
        }
        if (cmdStr_SearchSort == "")
        {
            //没有配置,则默认按登记日期
            cmdStr_SearchSort = " order by hy_djsj desc ";
        }
        //---排序---结束

        //--根据查询条件得到返回数据集--s
        DataTable dt = new DataTable();         //单页数据集
        DataTable dt_total = new DataTable();   //数据总条数,返回总条数值
        DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value);  //得到表配置信息查看当前表是否有流程 hy_ifflowdoc

        string cmdStr = "";

        string ls_from = "";
        ls_from = " hyc_" + this.txttableid.Value + " where 1=1 and hy_djrbmid='" + Session["hydeptid"].ToString() + "' " + cmdStr_Search;
        if (Session["conntype"].ToString() == "SQL")
        {
            cmdStr = "select top " + PageSize.Text + " * from " + ls_from;
            cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * int.Parse(PageSize.Text)).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort;
        }
        if (Session["conntype"].ToString() == "ORACLE")
        {
            cmdStr = " select * from ( ";
            cmdStr += " select my_table.*, rownum as my_rownum from ";
            cmdStr += " ( ";

            cmdStr += " select * from hyc_" + this.txttableid.Value + " where 1=1 and hy_djrbmid='" + Session["hydeptid"].ToString() + "' " + cmdStr_Search + cmdStr_SearchSort;

            cmdStr += " )  my_table ";
            cmdStr += " where rownum<= " + ((PageNo) * int.Parse(PageSize.Text)).ToString();
            cmdStr += " ) where my_rownum> " + ((PageNo - 1) * int.Parse(PageSize.Text)).ToString();
        }
        dt = Hyoa_global.GetDataTable(cmdStr);
        cmdStr = "select count(*) from " + ls_from;
        dt_total = Hyoa_global.GetDataTable(cmdStr);
        //--根据查询条件得到返回数据集--e

        //开始输出----整合成HTML为数据行
        DataTable tempTable = dt.Clone();
        DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列  add
        tempTable.Columns.Add(col);  //追加一列  add
        string lscolname = "";
        string lscolnameid = "";
        string lscolwidth = "";
        string ls_col = "";
        string[] lvcolname;
        string[] lvcolnameid;
        string[] lvcolwidth;
        string lscolwidthper;
        lscolname = dtlist.Rows[0]["hy_columnshow"].ToString();  //要显示的列名:附件,标题,收文来源
        lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString();  //要显示的列名id:uploadfile1,Hy_bt,Hy_swly
        lscolwidth = dtlist.Rows[0]["hy_width"].ToString();  //要显示的列名id:10,20,30
        lvcolname = lscolname.Split(',');
        lvcolnameid = lscolnameid.Split(',');
        lvcolwidth = lscolwidth.Split(',');
        if (dt.Rows.Count <= 0)
        {
            //如果没有数据则输出表头
            for (int n = 0; n < lvcolname.Length; n++)
            {
                if (n >= lvcolwidth.Length)
                { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
                else
                { lscolwidthper = lvcolwidth[n]; }
                this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
            }
        }
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow dr = tempTable.NewRow();
            //输出主表所有字段,start
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            //输出主表所有字段,end

            //////开始得到列的值
            DataTable dtgetsqlfield;
            for (int m = 0; m < lvcolname.Length; m++)
            {
                //如果有数据,则输出数据
                if (m >= lvcolwidth.Length)
                { lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
                else
                { lscolwidthper = lvcolwidth[m]; }

                dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);

                if (i % System.Int32.Parse(PageSize.Text) == 0)
                    this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\"><a href=\"#\" title=\"点击可排序\" onclick=\"fun_sort('" + lvcolnameid[m] + "');\">" + lvcolname[m] + "</a></p></td>";

                //根据字段英文名,得到数据库中对应的字段
                string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
                //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
                string lsgetputfiled = "";
                if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                {
                    if (dt.Rows[i][lsgetsqlfield].ToString() != "")
                        lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
                }
                else
                {
                    //解决Float小数点后面出现N位小数乱码的问题
                    if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
                    {
                        if (dt.Rows[i][lsgetsqlfield].ToString() != "")
                        {
                            //是否包含小数点,包含的话,取小数点后两位
                            if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
                            {
                                lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
                            }
                            else
                            {
                                lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
                            }
                        }
                        else
                        {
                            lsgetputfiled = "0";
                        }
                        //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                    }
                    else
                    {
                        lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                    }

                }
                if (lsgetputfiled == "")
                    lsgetputfiled = "&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>";
                }
            }
            //如果是流程表单,则最后追加两列(当前环节和当前处理人)
            //表头
            if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null && i == 0)
            {
                this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前环节</td>";
                this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前处理人</td>";
            }
            //数据
            if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null)
            {
                ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curtachename"].ToString() + "&nbsp;</td>";
                ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + "&nbsp;</td>";
            }

            dr["displaycol"] = ls_col;  //将新值赋给相应的列  add
            ls_col = "";
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = int.Parse(dt_total.Rows[0][0].ToString());
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();

        //列表中的一些特殊处理,都放在这个函数内
        DataPlay_Tscl();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("login.aspx");

        if (this.Request.QueryString["mid"] != null)
        {
            //得到模块ID
            this.txtmudelid.Value = this.Request.QueryString["mid"].ToString();
        }
        else
        {
            this.Response.Write("<script>alert('模块ID没有传入,请联系管理员!');</script>");
            return;
        }
        if (this.Request.QueryString["tableid"] != null)
        {
            //表的ID
            this.txttableid.Value = this.Request.QueryString["tableid"].ToString();
            //得到表名
            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
            DataTable dt_tableconfig = Hyoa_tableconfig.GetTable(this.txttableid.Value);
            if (dt_tableconfig.Rows.Count > 0)
                this.lblcurtachenameshow.Text = dt_tableconfig.Rows[0]["hy_name"].ToString();
        }
        else
        {
            this.Response.Write("<script>alert('表单ID没有传入,请联系管理员!');</script>");
            return;
        }
        if (this.Request.QueryString["listid"] != null)
        {
            //得到列表ID
            if (this.Request.QueryString["listid"].ToString() != "")
            {
                this.txtlistid.Value = this.Request.QueryString["listid"].ToString();
            }
        }
        else
        {
            this.Response.Write("<script>alert('列表ID没有传入,请联系管理员!');</script>");
            return;
        }
        //判断是否需要查询
        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dt_listconfig = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value);
        if (dt_listconfig.Rows.Count > 0)
        {
            if (dt_listconfig.Rows[0]["hy_ifsearch"].ToString() == "是")
            {
                GetSearchTableHtml();//查询表格动态生成
            }
            else
            {
                trsearch.Visible = false;
            }
        }
        if (!IsPostBack)
        {
            DataPlay(1);   //列表区动态生成
            PageListItem();
            EnabledWhatButton();
        }
    }
Esempio n. 6
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "复制成功!";

        try
        {
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
            HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
            HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
            HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
            HyoaClass.Hyoa_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor();
            HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
            HyoaClass.Hyoa_flowtache Hyoa_flowtache = new HyoaClass.Hyoa_flowtache();
            HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
            HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser();
            HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork();
            #region 生成权限
            DataTable dt = Hyoa_role.Getrole("Role" + this.txtmudelid.Text);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('该权限编号已存在,请重新填写!');history.back();</script>");
                return;
            }
            else
            {
                Hyoa_role.hy_roleid = "Role" + this.txtmudelid.Text;
                Hyoa_role.hy_rolename = this.txtmudelname.Text;
                Hyoa_role.hy_sort = System.Int32.Parse(this.txtno.Value);
                Hyoa_role.Insert();
            }
            #endregion

            #region 生成模块
            dt = Hyoa_mudel.Getmudel("Mudel" + this.txtmudelid.Text);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('该模块编号已存在,请重新填写!');history.back();</script>");
                return;
            }
            else
            {
                Hyoa_mudel.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                Hyoa_mudel.hy_mudelname = this.txtmudelname.Text;
                Hyoa_mudel.hy_sort = System.Int32.Parse(this.txtno.Value);
                Hyoa_mudel.hy_isenabled = "是";
                Hyoa_mudel.hy_roleid = "Role" + this.txtmudelid.Text;
                Hyoa_mudel.hy_qqroleid = "Role" + this.txtmudelid.Text;
                Hyoa_mudel.Insert();
            }
            #endregion

            #region 生成表单
            DataTable tableconfigdt = Hyoa_tableconfig.GetTablesbymudelid(this.ddlmudelid.SelectedValue);
            if (tableconfigdt.Rows.Count > 0)
            {
                Hyoa_tableconfig.ID = "Table" + this.txtmudelid.Text;
                Hyoa_tableconfig.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                Hyoa_tableconfig.hy_name = this.txtmudelname.Text;
                Hyoa_tableconfig.hy_onload = tableconfigdt.Rows[0]["hy_onload"].ToString();
                Hyoa_tableconfig.hy_sort = float.Parse(this.txtno.Value);
                Hyoa_tableconfig.hy_ifflowdoc = tableconfigdt.Rows[0]["hy_ifflowdoc"].ToString();
                Hyoa_tableconfig.hy_ifdisplayall = tableconfigdt.Rows[0]["hy_ifdisplayall"].ToString();
                Hyoa_tableconfig.hy_ispuballByflowYB = tableconfigdt.Rows[0]["hy_ispuballByflowYB"].ToString();
                Hyoa_tableconfig.hy_tablerole = tableconfigdt.Rows[0]["hy_tablerole"].ToString();
                Hyoa_tableconfig.hy_ifcomment = tableconfigdt.Rows[0]["hy_ifcomment"].ToString();
                Hyoa_tableconfig.hy_colnum = float.Parse(tableconfigdt.Rows[0]["hy_colnum"].ToString());
                Hyoa_tableconfig.hy_field1 = tableconfigdt.Rows[0]["hy_field1"].ToString();
                Hyoa_tableconfig.hy_field2 = tableconfigdt.Rows[0]["hy_field2"].ToString();
                Hyoa_tableconfig.hy_field3 = tableconfigdt.Rows[0]["hy_field3"].ToString();
                Hyoa_tableconfig.hy_field4 = tableconfigdt.Rows[0]["hy_field4"].ToString();
                Hyoa_tableconfig.hy_field5 = tableconfigdt.Rows[0]["hy_field5"].ToString();
                Hyoa_tableconfig.Insert();
            }
            #endregion

            #region 生成表单字段
            int i;
            DataTable flowfielddt = Hyoa_flowfield.Getflowfieldsbytableid(this.ddltableid.SelectedValue);
            if (flowfielddt.Rows.Count > 0)
            {
                for (i = 0; i < flowfielddt.Rows.Count; i++)
                {
                    Hyoa_flowfield.ID = Hyoa_global.GetRandom();
                    Hyoa_flowfield.hy_tableid = "Table" + this.txtmudelid.Text;
                    Hyoa_flowfield.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                    Hyoa_flowfield.hy_flowid = "Flow" + this.txtmudelid.Text;
                    Hyoa_flowfield.hy_fieldid = flowfielddt.Rows[i]["hy_fieldid"].ToString();
                    Hyoa_flowfield.hy_fieldname = flowfielddt.Rows[i]["hy_fieldname"].ToString();
                    Hyoa_flowfield.hy_fieldtype = flowfielddt.Rows[i]["hy_fieldtype"].ToString();
                    Hyoa_flowfield.hy_ifreadonly = flowfielddt.Rows[i]["hy_ifreadonly"].ToString();
                    Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(flowfielddt.Rows[i]["hy_defaultvaluetype"].ToString());
                    Hyoa_flowfield.hy_defaultvalue = flowfielddt.Rows[i]["hy_defaultvalue"].ToString();
                    Hyoa_flowfield.hy_optiontype = System.Int32.Parse(flowfielddt.Rows[i]["hy_optiontype"].ToString());
                    Hyoa_flowfield.hy_options = flowfielddt.Rows[i]["hy_options"].ToString();
                    Hyoa_flowfield.hy_onclick = flowfielddt.Rows[i]["hy_onclick"].ToString();
                    Hyoa_flowfield.hy_ondblclick = flowfielddt.Rows[i]["hy_ondblclick"].ToString();
                    Hyoa_flowfield.hy_onchange = flowfielddt.Rows[i]["hy_onchange"].ToString();
                    Hyoa_flowfield.hy_onkeydown = flowfielddt.Rows[i]["hy_onkeydown"].ToString();
                    Hyoa_flowfield.hy_onkeyup = flowfielddt.Rows[i]["hy_onkeyup"].ToString();
                    Hyoa_flowfield.hy_onfocus = flowfielddt.Rows[i]["hy_onfocus"].ToString();
                    Hyoa_flowfield.hy_onblur = flowfielddt.Rows[i]["hy_onblur"].ToString();
                    Hyoa_flowfield.hy_sqlfield = flowfielddt.Rows[i]["hy_sqlfield"].ToString();
                    Hyoa_flowfield.hy_class = flowfielddt.Rows[i]["hy_class"].ToString();
                    Hyoa_flowfield.hy_width = flowfielddt.Rows[i]["hy_width"].ToString();
                    Hyoa_flowfield.hy_height = flowfielddt.Rows[i]["hy_height"].ToString();
                    Hyoa_flowfield.hy_tdnums = System.Int32.Parse(flowfielddt.Rows[i]["hy_tdnums"].ToString());
                    Hyoa_flowfield.hy_config = flowfielddt.Rows[i]["hy_config"].ToString();
                    Hyoa_flowfield.hy_sort = float.Parse(flowfielddt.Rows[i]["hy_sort"].ToString());
                    Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(flowfielddt.Rows[i]["hy_wordlimit"].ToString());
                    Hyoa_flowfield.hy_required = flowfielddt.Rows[i]["hy_required"].ToString();
                    Hyoa_flowfield.hy_align = flowfielddt.Rows[i]["hy_align"].ToString();
                    Hyoa_flowfield.hy_ifhiddle = flowfielddt.Rows[i]["hy_ifhiddle"].ToString();
                    Hyoa_flowfield.hy_ifdbsybt = flowfielddt.Rows[i]["hy_ifdbsybt"].ToString();
                    Hyoa_flowfield.hy_field1 = flowfielddt.Rows[i]["hy_field1"].ToString();
                    Hyoa_flowfield.hy_field2 = flowfielddt.Rows[i]["hy_field2"].ToString();
                    Hyoa_flowfield.hy_field3 = flowfielddt.Rows[i]["hy_field3"].ToString();
                    Hyoa_flowfield.hy_field4 = flowfielddt.Rows[i]["hy_field4"].ToString();
                    Hyoa_flowfield.hy_field5 = flowfielddt.Rows[i]["hy_field5"].ToString();
                    Hyoa_flowfield.Insert();
                }
            }
            #endregion

            #region 生成SQL/ORACLE中的表
            string sql = "";
            if (Session["conntype"].ToString() == "SQL")
            {
                sql = "select * into hyc_Table" + this.txtmudelid.Text + " from hyc_" + this.ddltableid.SelectedValue + " where 1=0";
            }
            if (Session["conntype"].ToString() == "ORACLE")
            {
                sql = "create table hyc_Table" + this.txtmudelid.Text + " as select * from hyc_" + this.ddltableid.SelectedValue + " where 1=2";
            }
            Hyoa_global.ExcuteSQL(sql);
            #endregion

            #region 生成列表
            DataTable listconfigdt = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(this.ddlmudelid.SelectedValue, this.ddltableid.SelectedValue);
            //列表ID
            string strListId = Hyoa_global.GetRandom();
            if (listconfigdt.Rows.Count > 0)
            {
                Hyoa_listconfig.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                Hyoa_listconfig.hy_tableid = "Table" + this.txtmudelid.Text;
                Hyoa_listconfig.hy_ifflowdoc = listconfigdt.Rows[0]["hy_ifflowdoc"].ToString();
                Hyoa_listconfig.hy_sort = System.Int32.Parse(this.txtno.Value);
                Hyoa_listconfig.hy_columnshowid = listconfigdt.Rows[0]["hy_columnshowid"].ToString();
                Hyoa_listconfig.hy_columnshow = listconfigdt.Rows[0]["hy_columnshow"].ToString();
                Hyoa_listconfig.hy_ifsearch = listconfigdt.Rows[0]["hy_ifsearch"].ToString();
                Hyoa_listconfig.hy_ifshowsearch = listconfigdt.Rows[0]["hy_ifshowsearch"].ToString();
                Hyoa_listconfig.hy_width = listconfigdt.Rows[0]["hy_width"].ToString();
                Hyoa_listconfig.hy_listname = this.txtmudelname.Text;
                Hyoa_listconfig.hy_sortfield1 = listconfigdt.Rows[0]["hy_sortfield1"].ToString();
                Hyoa_listconfig.hy_sorttype1 = listconfigdt.Rows[0]["hy_sorttype1"].ToString();
                Hyoa_listconfig.hy_sortfield2 = listconfigdt.Rows[0]["hy_sortfield2"].ToString();
                Hyoa_listconfig.hy_sorttype2 = listconfigdt.Rows[0]["hy_sorttype2"].ToString();
                Hyoa_listconfig.hy_sortfield3 = listconfigdt.Rows[0]["hy_sortfield3"].ToString();
                Hyoa_listconfig.hy_sorttype3 = listconfigdt.Rows[0]["hy_sorttype3"].ToString();
                Hyoa_listconfig.hy_fieldid_fl1 = listconfigdt.Rows[0]["hy_fieldid_fl1"].ToString();
                Hyoa_listconfig.hy_fieldname_fl1 = listconfigdt.Rows[0]["hy_fieldname_fl1"].ToString();
                Hyoa_listconfig.hy_sql_fl1 = listconfigdt.Rows[0]["hy_sql_fl1"].ToString();
                Hyoa_listconfig.hy_fieldid_fl2 = listconfigdt.Rows[0]["hy_fieldid_fl2"].ToString();
                Hyoa_listconfig.hy_fieldname_fl2 = listconfigdt.Rows[0]["hy_fieldname_fl2"].ToString();
                Hyoa_listconfig.hy_sql_fl2 = listconfigdt.Rows[0]["hy_sql_fl2"].ToString();
                Hyoa_listconfig.hy_fieldid_fl3 = listconfigdt.Rows[0]["hy_fieldid_fl3"].ToString();
                Hyoa_listconfig.hy_fieldname_fl3 = listconfigdt.Rows[0]["hy_fieldname_fl3"].ToString();
                Hyoa_listconfig.hy_sql_fl3 = listconfigdt.Rows[0]["hy_sql_fl3"].ToString();
                Hyoa_listconfig.ID = strListId;
                Hyoa_listconfig.Insert();
            }
            #endregion

            #region 生成列表查询条件
            DataTable listsearchdt = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.ddlmudelid.SelectedValue, this.ddltableid.SelectedValue);
            for (int m = 0; m < listsearchdt.Rows.Count; m++)
            {
                Hyoa_listsearchfield.ID = Hyoa_global.GetRandom();
                Hyoa_listsearchfield.hy_listid = strListId;
                Hyoa_listsearchfield.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                Hyoa_listsearchfield.hy_tableid = "Table" + this.txtmudelid.Text;
                Hyoa_listsearchfield.hy_field = listsearchdt.Rows[m]["hy_field"].ToString();
                Hyoa_listsearchfield.hy_fieldid = listsearchdt.Rows[m]["hy_fieldid"].ToString();
                Hyoa_listsearchfield.hy_sort = m + 2;
                Hyoa_listsearchfield.Insert();
            }
            #endregion

            #region 生成流程信息
            string lssoureceflowid = "";
            if (tableconfigdt.Rows[0]["hy_ifflowdoc"].ToString() == "是")
            {
                DataTable flowinfordt = Hyoa_flowinfor.Getflowinforbymudelid(this.ddlmudelid.SelectedValue);
                if (flowinfordt.Rows.Count > 0)
                {
                    //得到老模块的flowid 后面要用到
                    lssoureceflowid = flowfielddt.Rows[0]["hy_flowid"].ToString();
                    //插入流程信息start
                    Hyoa_flowinfor.hy_flowid = "Flow" + this.txtmudelid.Text;
                    Hyoa_flowinfor.hy_flowname = this.txtmudelname.Text;
                    Hyoa_flowinfor.hy_sort = System.Int32.Parse(this.txtno.Value);
                    Hyoa_flowinfor.hy_mudelid = "Mudel" + this.txtmudelid.Text;
                    // Hyoa_flowinfor.hy_addbyalluser = flowinfordt.Rows[0]["hy_addbyalluser"].ToString();
                    Hyoa_flowinfor.Insert();
                }
                //插入流程信息end

                //流程环节
                DataTable flowtachedt = Hyoa_flowtache.Getflowtachebyflowid(lssoureceflowid);
                if (flowtachedt.Rows.Count > 0)
                {
                    for (i = 0; i < flowtachedt.Rows.Count; i++)
                    {
                        Hyoa_flowtache.ID = Hyoa_global.GetRandom();
                        Hyoa_flowtache.hy_flowid = "Flow" + this.txtmudelid.Text;
                        Hyoa_flowtache.hy_tacheid = flowtachedt.Rows[i]["hy_tacheid"].ToString();
                        Hyoa_flowtache.hy_tachename = flowtachedt.Rows[i]["hy_tachename"].ToString();
                        Hyoa_flowtache.hy_sort = System.Int32.Parse(flowtachedt.Rows[i]["hy_sort"].ToString());
                        Hyoa_flowtache.hy_ifshowcurcomp = flowtachedt.Rows[i]["hy_ifshowcurcomp"].ToString();
                        Hyoa_flowtache.hy_ifshowcurdept = flowtachedt.Rows[i]["hy_ifshowcurdept"].ToString();
                        Hyoa_flowtache.hy_XValue = flowtachedt.Rows[i]["hy_XValue"].ToString();
                        Hyoa_flowtache.hy_YValue = flowtachedt.Rows[i]["hy_YValue"].ToString();
                        Hyoa_flowtache.hy_rdDoIsSendSms = flowtachedt.Rows[i]["hy_rdDoIsSendSms"].ToString();
                        Hyoa_flowtache.hy_rdDoIsSendMessage = flowtachedt.Rows[i]["hy_rdDoIsSendMessage"].ToString();
                        Hyoa_flowtache.hy_rdPassIsSendSms = flowtachedt.Rows[i]["hy_rdPassIsSendSms"].ToString();
                        Hyoa_flowtache.hy_rdPassIsSendMessage = flowtachedt.Rows[i]["hy_rdPassIsSendMessage"].ToString();
                        Hyoa_flowtache.hy_enablecondition = flowtachedt.Rows[i]["hy_enablecondition"].ToString();
                        Hyoa_flowtache.Insert();
                    }
                }

                //流程环节对应的域
                DataTable flowtachefielddt = Hyoa_flowtachefield.Getflowtachefieldbyflowid(lssoureceflowid);
                if (flowtachefielddt.Rows.Count > 0)
                {
                    for (i = 0; i < flowtachefielddt.Rows.Count; i++)
                    {
                        Hyoa_flowtachefield.ID = Hyoa_global.GetRandom();
                        Hyoa_flowtachefield.hy_flowid = "Flow" + this.txtmudelid.Text;
                        Hyoa_flowtachefield.hy_tacheid = flowtachefielddt.Rows[i]["hy_tacheid"].ToString();
                        Hyoa_flowtachefield.hy_fieldid = flowtachefielddt.Rows[i]["hy_fieldid"].ToString();
                        Hyoa_flowtachefield.Insert();
                    }
                }
                //流程环节对应的用户
                DataTable flowtacheuserdt = Hyoa_flowtacheuser.Getflowtacheuserbyflowid(lssoureceflowid);
                if (flowtacheuserdt.Rows.Count > 0)
                {
                    for (i = 0; i < flowtacheuserdt.Rows.Count; i++)
                    {
                        Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom();
                        Hyoa_flowtacheuser.hy_flowid = "Flow" + this.txtmudelid.Text;
                        Hyoa_flowtacheuser.hy_tacheid = flowtacheuserdt.Rows[i]["hy_tacheid"].ToString();
                        Hyoa_flowtacheuser.hy_userid = flowtacheuserdt.Rows[i]["hy_userid"].ToString();
                        Hyoa_flowtacheuser.Insert();
                    }
                }
                //工作流
                DataTable flowworkdt = Hyoa_flowwork.Getflowworksbyflowid(lssoureceflowid);
                if (flowworkdt.Rows.Count > 0)
                {
                    for (i = 0; i < flowworkdt.Rows.Count; i++)
                    {
                        Hyoa_flowwork.ID = Hyoa_global.GetRandom();
                        Hyoa_flowwork.hy_flowid = "Flow" + this.txtmudelid.Text;
                        Hyoa_flowwork.hy_curtacheid = flowworkdt.Rows[i]["hy_curtacheid"].ToString();
                        Hyoa_flowwork.hy_curtachename = flowworkdt.Rows[i]["hy_curtachename"].ToString();
                        Hyoa_flowwork.hy_nexttacheid = flowworkdt.Rows[i]["hy_nexttacheid"].ToString();
                        Hyoa_flowwork.hy_nexttachename = flowworkdt.Rows[i]["hy_nexttachename"].ToString();
                        Hyoa_flowwork.hy_sort = System.Int32.Parse(flowworkdt.Rows[i]["hy_sort"].ToString());
                        Hyoa_flowwork.hy_actiontype = flowworkdt.Rows[i]["hy_actiontype"].ToString();
                        Hyoa_flowwork.hy_identity_type = flowworkdt.Rows[i]["hy_identity_type"].ToString();
                        Hyoa_flowwork.hy_identity_id = flowworkdt.Rows[i]["hy_identity_id"].ToString();
                        Hyoa_flowwork.hy_jscondition = flowworkdt.Rows[i]["hy_jscondition"].ToString();
                        Hyoa_flowwork.hy_jscondition1 = flowworkdt.Rows[i]["hy_jscondition1"].ToString();
                        Hyoa_flowwork.hy_jscondition2 = flowworkdt.Rows[i]["hy_jscondition2"].ToString();
                        Hyoa_flowwork.hy_zdcyuserids = flowworkdt.Rows[i]["hy_zdcyuserids"].ToString();
                        Hyoa_flowwork.Insert();
                    }
                }

            }
            #endregion
        }
        catch
        {
            ls_tip = "复制失败!";
        }
        finally
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location.href='" + txturl.Text + "';</script>");
        }
    }
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
            this.tdnewdoc.Visible = true; //新建
            this.tddeldoc.Visible = true; //删除

        }
        else
        {
            this.isrole.Value = "0";
            this.tdnewdoc.Visible = false; //新建
            this.tddeldoc.Visible = false; //删除
        }

        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        //HyoaClass.Hyoa_iplimit Hyoa_iplimit = new HyoaClass.Hyoa_iplimit();
        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();

        DataTable dt = new DataTable();
        if (this.hy_name.Value != "")
        {
            dt = Hyoa_listconfig.Getdocsbyname(this.hy_name.Value);
        }
        else
        {
            dt = Hyoa_listconfig.GetlistconfigsAndTableconfigByID();
        }
        //dt = Hyoa_iplimit.Getiplimits();

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
    private void DataPlay()
    {
        //是否启用
        this.ddlifsearch.Items.Insert(0, "是");
        this.ddlifsearch.Items.Insert(1, "否");
        this.ddlifflowdoc.Items.Insert(0, "是");
        this.ddlifflowdoc.Items.Insert(1, "否");
        this.ddlifshowsearch.Items.Insert(0, "是");
        this.ddlifshowsearch.Items.Insert(1, "否");
        //模块编号
        //加载模块信息
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dtmudel = Hyoa_mudel.Getmudels();
        if (dtmudel.Rows.Count > 0)
        {
            this.ddlmudelid.DataSource = dtmudel;
            this.ddlmudelid.DataTextField = "hy_mudelname";
            this.ddlmudelid.DataValueField = "hy_mudelid";
            this.ddlmudelid.DataBind();
            this.ddlmudelid.Items.Insert(0, new ListItem("请选择", "请选择"));
            this.ddlmudelid.SelectedIndex = 0;
        }

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            //旧文档
            HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.txtdocid.Value = this.Request.QueryString["id"].ToString();
                    DataTable dt = Hyoa_listconfig.Getlistconfig(this.txtdocid.Value);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString();
                        if (dt.Rows[0]["hy_ifsearch"].ToString() == "是")
                        {
                            this.ddlifsearch.SelectedIndex = 0;
                        }
                        else
                        {
                            this.ddlifsearch.SelectedIndex = 1;
                        }
                        if (dt.Rows[0]["hy_ifshowsearch"].ToString() != "否")
                        {
                            this.ddlifshowsearch.SelectedIndex = 0;
                        }
                        else
                        {
                            this.ddlifshowsearch.SelectedIndex = 1;
                        }
                        this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString();
                        if (dt.Rows[0]["hy_ifflowdoc"].ToString() == "是")
                        {
                            this.ddlifflowdoc.SelectedIndex = 0;
                        }
                        else
                        {
                            this.ddlifflowdoc.SelectedIndex = 1;
                        }
                        this.txthy_listname.Text = dt.Rows[0]["hy_listname"].ToString();
                        this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString();

                        //加载所有列信息
                        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
                        DataTable dtflowfield;

                        //dtflowfield = Hyoa_flowfield.Getflowfields();
                        dtflowfield = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
                        if (dtflowfield.Rows.Count > 0)
                        {
                            this.ddlcolumnshow.DataSource = dtflowfield;
                            this.ddlcolumnshow.DataTextField = "hy_fieldname";
                            this.ddlcolumnshow.DataValueField = "hy_fieldid";
                            this.ddlcolumnshow.DataBind();
                            this.ddlcolumnshow.SelectedIndex = 0;
                        }
                        dtflowfield.Clear();

                        //将列都列出来
                        string[] lv_columnshowselect;
                        string[] lv_columnshowselectid;
                        lv_columnshowselect = dt.Rows[0]["hy_columnshow"].ToString().Split(',');
                        lv_columnshowselectid = dt.Rows[0]["hy_columnshowid"].ToString().Split(',');
                        for (int j = 0; j < lv_columnshowselect.Length; j++)
                        {
                            this.ddlcolumnshowselect.Items.Insert(j, new ListItem(lv_columnshowselect[j], lv_columnshowselectid[j]));
                        }

                        //根据模块信息得到对应的选择表单值
                        if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null)
                        {
                            this.ddltableid.Items.Clear();
                            //根据模块ID得到表单ID
                            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
                            DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString());
                            if (dtgettableid.Rows.Count > 0)
                            {
                                for (var i = 0; i < dtgettableid.Rows.Count; i++)
                                {
                                    this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString()));
                                }
                                this.ddltableid.Items.Insert(0, new ListItem("--请选择--", ""));
                                this.ddltableid.Attributes.Add("onchange ", "mudelidonchang() ");
                                //定位
                                this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString();
                            }
                        }

                        //排序的字段
                        //根据模块ID+表单ID+字段ID得到字段中文名
                        DataTable dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
                        if (dt_flowfield.Rows.Count > 0)
                        {
                            this.searchsort1.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString()));
                        }
                        this.ddlsorttype1.SelectedValue = dt.Rows[0]["hy_sorttype1"].ToString();
                        dt_flowfield.Clear();
                        dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
                        if (dt_flowfield.Rows.Count > 0)
                        {
                            this.searchsort2.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString()));
                        }
                        this.ddlsorttype2.SelectedValue = dt.Rows[0]["hy_sorttype2"].ToString();
                        dt_flowfield.Clear();
                        dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
                        if (dt_flowfield.Rows.Count > 0)
                        {
                            this.searchsort3.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString()));
                        }
                        this.ddlsorttype3.SelectedValue = dt.Rows[0]["hy_sorttype3"].ToString();
                        dt_flowfield.Clear();
                        //分类的字段
                        this.txthy_field_fl1.Text = dt.Rows[0]["hy_sql_fl1"].ToString();
                        if (dt.Rows[0]["hy_fieldid_fl1"].ToString() != "")
                        {
                            this.flfield1.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl1"].ToString(), dt.Rows[0]["hy_fieldid_fl1"].ToString()));
                        }
                        this.txthy_field_fl2.Text = dt.Rows[0]["hy_sql_fl2"].ToString();
                        if (dt.Rows[0]["hy_fieldid_fl2"].ToString() != "")
                        {
                            this.flfield2.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl2"].ToString(), dt.Rows[0]["hy_fieldid_fl2"].ToString()));
                        }
                        this.txthy_field_fl3.Text = dt.Rows[0]["hy_sql_fl3"].ToString();
                        if (dt.Rows[0]["hy_fieldid_fl3"].ToString() != "")
                        {
                            this.flfield3.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl3"].ToString(), dt.Rows[0]["hy_fieldid_fl3"].ToString()));
                        }
                    }
                    dt.Clear();
                    HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
                    DataTable dt5 = Hyoa_listsearchfield.Getlistsearchfieldsbylistid(this.txtdocid.Value);
                    if (dt5.Rows.Count > 0)
                    {
                        for (int m = 0; m < dt5.Rows.Count; m++)
                        {
                            this.searchselect.Items.Insert(m, new ListItem(dt5.Rows[m]["hy_field"].ToString(), dt5.Rows[m]["hy_fieldid"].ToString()));
                        }
                    }
                }
            }
            else
            {
                //自动获取最大排序号,然后+2
                DataTable dt_maxsort = Hyoa_listconfig.GetMaxlistconfigsort();
                if (dt_maxsort.Rows.Count > 0)
                    txtsort.Text = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString();
                else
                    txtsort.Text = "1";
            }
        }
    }
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";

        //新文档时
        string lscolunid = "";
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();

        Hyoa_listconfig.hy_mudelid = this.ddlmudelid.SelectedValue;
        Hyoa_listconfig.hy_tableid = this.ddltableid.SelectedValue;
        Hyoa_listconfig.hy_ifflowdoc = this.ddlifflowdoc.SelectedValue;
        Hyoa_listconfig.hy_sort = System.Int32.Parse(this.txtsort.Text);
        Hyoa_listconfig.hy_columnshowid = this.txtselcolid.Value;
        Hyoa_listconfig.hy_columnshow = this.txtselcol.Value;
        Hyoa_listconfig.hy_ifsearch = this.ddlifsearch.SelectedValue;
        Hyoa_listconfig.hy_ifshowsearch = this.ddlifshowsearch.SelectedValue;
        Hyoa_listconfig.hy_width = this.txtwidth.Text;
        Hyoa_listconfig.hy_listname = this.txthy_listname.Text;
        Hyoa_listconfig.hy_sortfield1 = this.txtselsortfieldid1.Value;
        Hyoa_listconfig.hy_sorttype1 = this.ddlsorttype1.SelectedValue;
        Hyoa_listconfig.hy_sortfield2 = this.txtselsortfieldid2.Value;
        Hyoa_listconfig.hy_sorttype2 = this.ddlsorttype2.SelectedValue;
        Hyoa_listconfig.hy_sortfield3 = this.txtselsortfieldid3.Value;
        Hyoa_listconfig.hy_sorttype3 = this.ddlsorttype3.SelectedValue;
        Hyoa_listconfig.hy_fieldid_fl1 = this.txtflfieldid1.Value;
        Hyoa_listconfig.hy_fieldname_fl1 = this.txtflfieldname1.Value;
        Hyoa_listconfig.hy_sql_fl1 = this.txthy_field_fl1.Text;
        Hyoa_listconfig.hy_fieldid_fl2 = this.txtflfieldid2.Value;
        Hyoa_listconfig.hy_fieldname_fl2 = this.txtflfieldname2.Value;
        Hyoa_listconfig.hy_sql_fl2 = this.txthy_field_fl2.Text;
        Hyoa_listconfig.hy_fieldid_fl3 = this.txtflfieldid3.Value;
        Hyoa_listconfig.hy_fieldname_fl3 = this.txtflfieldname3.Value;
        Hyoa_listconfig.hy_sql_fl3 = this.txthy_field_fl3.Text;
        if (this.txtop.Value == "add")
        {
            lscolunid = Hyoa_global.GetRandom();
            Hyoa_listconfig.ID = lscolunid;
            Hyoa_listconfig.Insert();

            //向查询字段表中插入数据
            string[] lv_selsearchid;
            string[] lv_selsearch;
            lv_selsearchid = this.txtselsearchid.Value.ToString().Split(',');
            lv_selsearch = this.txtselsearch.Value.ToString().Split(',');
            for (int m = 0; m < lv_selsearchid.Length; m++)
            {
                Hyoa_listsearchfield.ID = Hyoa_global.GetRandom();
                Hyoa_listsearchfield.hy_listid = lscolunid;
                Hyoa_listsearchfield.hy_mudelid = this.ddlmudelid.SelectedValue;
                Hyoa_listsearchfield.hy_tableid = this.ddltableid.SelectedValue;
                Hyoa_listsearchfield.hy_field = lv_selsearch[m];
                Hyoa_listsearchfield.hy_fieldid = lv_selsearchid[m];
                Hyoa_listsearchfield.hy_sort = m + 1;
                Hyoa_listsearchfield.Insert();
            }
        }
        else
        {
            Hyoa_listconfig.ID = this.txtdocid.Value;
            Hyoa_listconfig.Update();

            //向查询字段表中插入数据
            //要先删除再插入
            Hyoa_listsearchfield.hy_listid = this.txtdocid.Value;
            Hyoa_listsearchfield.DeleteBylistid();

            string[] lv_selsearchid;
            string[] lv_selsearch;
            lv_selsearchid = this.txtselsearchid.Value.ToString().Split(',');
            lv_selsearch = this.txtselsearch.Value.ToString().Split(',');
            for (int m = 0; m < lv_selsearchid.Length; m++)
            {
                Hyoa_listsearchfield.ID = Hyoa_global.GetRandom();
                Hyoa_listsearchfield.hy_listid = this.txtdocid.Value;
                Hyoa_listsearchfield.hy_mudelid = this.ddlmudelid.SelectedValue;
                Hyoa_listsearchfield.hy_tableid = this.ddltableid.SelectedValue;
                Hyoa_listsearchfield.hy_field = lv_selsearch[m];
                Hyoa_listsearchfield.hy_fieldid = lv_selsearchid[m];
                Hyoa_listsearchfield.hy_sort = m;
                Hyoa_listsearchfield.Insert();
            }
        }

        //处理完成后的提示及跳转
        if (this.txtifpop.Value == "")
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
        }
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string ls_mudelid="";
        string ls_colname="";
        string ls_colid="";
        string ls_colname2="";
        string ls_colid2="";
        string ls_colname3="";
        string ls_colid3="";
        string ls_tableid = "";

        if (this.Request.QueryString["mudelid"] != null)
        {
            ls_mudelid = this.Request.QueryString["mudelid"].ToString();
        }
        if (this.Request.QueryString["tableid"] != null)
        {
            ls_tableid = this.Request.QueryString["tableid"].ToString();
        }

        //模块对应的域
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dt4 = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mudelid, ls_tableid);
        if (dt4.Rows.Count > 0)
        {
            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                if (ls_colname == "")
                {
                    ls_colname = dt4.Rows[i]["hy_fieldname"].ToString();
                    ls_colid = dt4.Rows[i]["hy_fieldid"].ToString();

                }
                else
                {
                    ls_colname = ls_colname + "+" + dt4.Rows[i]["hy_fieldname"].ToString();
                    ls_colid = ls_colid + "+" + dt4.Rows[i]["hy_fieldid"].ToString();
                }
            }
        }
        dt4.Clear();
        string lsid = "";
        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        dt4 = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(ls_mudelid,ls_tableid);
        if (dt4.Rows.Count > 0)
        {
            ls_colname2 = dt4.Rows[0]["hy_columnshow"].ToString();
            ls_colid2 = dt4.Rows[0]["hy_columnshowid"].ToString();
            lsid = dt4.Rows[0]["ID"].ToString();
        }

        dt4.Clear();
        HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
        dt4 = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndListid(ls_mudelid,lsid);
        if (dt4.Rows.Count > 0)
        {
            for (int k = 0; k < dt4.Rows.Count; k++)
            {
                if (ls_colname3 == "")
                {
                    ls_colname3 = dt4.Rows[k]["hy_field"].ToString();
                    ls_colid3 = dt4.Rows[k]["hy_fieldid"].ToString();

                }
                else
                {
                    ls_colname3 = ls_colname3 + "+" + dt4.Rows[k]["hy_field"].ToString();
                    ls_colid3 = ls_colid3 + "+" + dt4.Rows[k]["hy_fieldid"].ToString();
                }
            }
        }

            //HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();

        this.Response.Write(ls_colname + "*" + ls_colid + "#" + ls_colname2 + "*" + ls_colid2 + "#" + ls_colname3 + "*" + ls_colid3);
        //return ;
    }
    //需要导出的内容
    private string getExcelContent()
    {
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        //根据表ID和模块ID得到当前传进来的模块是否有流程
        HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
        DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value);

        //根据表单得到对应的所有字段
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbytableid(dttableconfig.Rows[0]["ID"].ToString());
        //循环所有字段
        string ls_flowfield = "";
        if (dtflowfield.Rows.Count > 0)
        {
            for (int i = 0; i < dtflowfield.Rows.Count; i++)
            {
                string ls_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString();
                if (ls_fieldtype == "文本" || ls_fieldtype == "多行文本" || ls_fieldtype == "文本加按钮" || ls_fieldtype == "多行文本加按钮" || ls_fieldtype == "日期" || ls_fieldtype == "数值" || ls_fieldtype == "对话框列表" || ls_fieldtype == "复选框" || ls_fieldtype == "单选框" || ls_fieldtype == "口令")
                {
                    ls_flowfield += ",a.hyc_" + dtflowfield.Rows[i]["hy_fieldid"].ToString();
                }
            }
        }

        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dtlist = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value);     //列表配置

        #region ---查询条件---
        string cmdStr_Search = "";
        if (txtsearchfields.Text != "")
        {
            string[] lv_searchfields = txtsearchfields.Text.Split(',');
            string[] lv_searchfields_sx = txtsearchfields_sx.Text.Split(',');
            for (int i = 0; i < lv_searchfields.Length; i++)
            {
                string ls_fieldid = lv_searchfields[i].ToString();
                string ls_fieldid_sx = lv_searchfields_sx[i].ToString();
                string ls_searchtext = "";
                if (this.Request.Form[ls_fieldid] != null)
                {
                    ls_searchtext = this.Request.Form[ls_fieldid].ToString();
                }
                if (ls_searchtext != "")
                {
                    if (ls_fieldid_sx == "0")
                    {
                        cmdStr_Search += " and hyc_" + ls_fieldid + " like '%" + ls_searchtext + "%' ";
                    }
                    else
                    {
                        if (ls_fieldid_sx == "1")
                        {
                            if (Session["conntype"].ToString() == "SQL")
                            {
                                cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) >= '" + ls_searchtext + "' ";
                            }
                            if (Session["conntype"].ToString() == "ORACLE")
                            {
                                cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') >= '" + ls_searchtext + "' ";
                            }
                        }
                        if (ls_fieldid_sx == "2")
                        {
                            if (Session["conntype"].ToString() == "SQL")
                            {
                                cmdStr_Search += " and left(CONVERT(varchar, hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ", 120 ) ,10) <= '" + ls_searchtext + "' ";
                            }
                            if (Session["conntype"].ToString() == "ORACLE")
                            {
                                cmdStr_Search += " and to_char(hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + ",'YYYY-MM-DD') <= '" + ls_searchtext + "' ";
                            }
                        }
                        if (ls_fieldid_sx == "3")
                        {
                            cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " >= " + ls_searchtext + " ";
                        }
                        if (ls_fieldid_sx == "4")
                        {
                            cmdStr_Search += " and hyc_" + ls_fieldid.Substring(0, ls_fieldid.Length - 2) + " <= " + ls_searchtext + " ";
                        }
                    }
                }
            }
        }
        #endregion ---查询条件---

        #region ---排序---
        string cmdStr_SearchSort = "";
        if (dtlist.Rows[0]["hy_sortfield1"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield2"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield3"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
        }
        if (cmdStr_SearchSort == "")
        {
            //没有配置,则默认按登记日期
            cmdStr_SearchSort = " order by hy_djsj desc ";
        }
        #endregion ---排序---

        #region  --根据查询条件得到返回数据集--
        DataTable dt = new DataTable();         //单页数据集
        DataTable dt_total = new DataTable();   //数据总条数,返回总条数值
        DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value);  //得到表配置信息查看当前表是否有流程 hy_ifflowdoc

        string cmdStr = "";

        if (dttable.Rows[0]["hy_ifflowdoc"].ToString() == "是")
        {
            if (dttable.Rows[0]["hy_ispuballByflowYB"].ToString() == "是")
            {
                string ls_from = "";
                if (Session["conntype"].ToString() == "SQL")
                {
                    ls_from = " hyc_" + this.txttableid.Value + " a,hyp_flowhistoryinfo_cl b where a.DOCID=b.DOCID and (','+b.hy_clrid+',' like '%," + Session["hyuid"].ToString() + ",%' or ','+b.hy_cyrid+',' like '%," + Session["hyuid"].ToString() + ",%' or a.hy_curtacheid='**')  and b.hy_ifth!='是' " + cmdStr_Search;
                    //cmdStr = "select distinct top 10 a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from;
                    //cmdStr += " and a.DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " a.DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort;
                    cmdStr = "select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,";
                    cmdStr += "a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,";
                    cmdStr += "a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + cmdStr_SearchSort;
                }
                dt = Hyoa_global.GetDataTable(cmdStr);
                if (Session["conntype"].ToString() == "SQL")
                {
                    cmdStr = "select count(*) from (select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + " ) f";
                }
                dt_total = Hyoa_global.GetDataTable(cmdStr);
                //dt = Hyoa_flowmain.GetflowmainsByIf_jsDisplayAll();  //输出流程的dt
            }
            else
            {
                string ls_from = "";
                if (Session["conntype"].ToString() == "SQL")
                {
                    ls_from = " hyc_" + this.txttableid.Value + " a,hyp_flowhistoryinfo_cl b where a.DOCID=b.DOCID and (','+b.hy_clrid+',' like '%," + Session["hyuid"].ToString() + ",%' or ','+b.hy_cyrid+',' like '%," + Session["hyuid"].ToString() + ",%')  and b.hy_ifth!='是' " + cmdStr_Search;
                    //cmdStr = "select distinct top 10 a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from;
                    //cmdStr += " and a.DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " a.DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort;
                    cmdStr = "select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,";
                    cmdStr += "a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,";
                    cmdStr += "a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + cmdStr_SearchSort;

                }
                dt = Hyoa_global.GetDataTable(cmdStr);
                if (Session["conntype"].ToString() == "SQL")
                {
                    cmdStr = "select count(*) from (select distinct a.DOCID,a.hy_mudelid,a.hy_tableid,a.hy_flowid,a.hy_flowname,a.hy_curtacheid,a.hy_curtachename,a.hy_curclrid,a.hy_curclrname,a.hy_djrid,a.hy_djrname,a.hy_djrbmid,a.hy_djrbmname,a.hy_djsj,a.hy_bt,a.hy_iftx,a.hy_zhtxsj,a.hy_readuserlist,a.hy_readdatelist,a.hy_motherid,a.hy_ifconfirm" + ls_flowfield + " from " + ls_from + " ) f";
                }
                dt_total = Hyoa_global.GetDataTable(cmdStr);
                //dt = Hyoa_flowmain.GetflowmainsByIf();  //输出流程的dt
            }
        }
        else
        {
            if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是")
            {
                string ls_from = "";
                ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + cmdStr_Search;
                if (Session["conntype"].ToString() == "SQL")
                {
                    cmdStr = "select * from " + ls_from + cmdStr_SearchSort;
                    //cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort;
                }
                dt = Hyoa_global.GetDataTable(cmdStr);
                cmdStr = "select count(*) from " + ls_from;
                dt_total = Hyoa_global.GetDataTable(cmdStr);
            }
            else
            {
                string ls_from = "";
                //ls_from = " hyc_" + this.txttableid.Value + " where hy_djrid='" + Session["hyuid"].ToString() + "' " + cmdStr_Search;
                ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + cmdStr_Search;
                if (Session["conntype"].ToString() == "SQL")
                {
                    cmdStr = "select * from " + ls_from + cmdStr_SearchSort;
                    //cmdStr += " and DOCID not in (select top " + ((PageNo - 1) * 10).ToString() + " DOCID from " + ls_from + cmdStr_SearchSort + ") " + cmdStr_SearchSort;
                }
                dt = Hyoa_global.GetDataTable(cmdStr);
                cmdStr = "select count(*) from " + ls_from;
                dt_total = Hyoa_global.GetDataTable(cmdStr);
            }
        }
        #endregion --根据查询条件得到返回数据集--

        //开始输出----整合成HTML为数据行
        StringBuilder sb = new StringBuilder();
        string lscolname = "";
        string lscolnameid = "";
        string lscolwidth = "";
        string[] lvcolname;
        string[] lvcolnameid;
        string[] lvcolwidth;
        string lscolwidthper;
        lscolname = dtlist.Rows[0]["hy_columnshow"].ToString();  //要显示的列名:附件,标题,收文来源
        lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString();  //要显示的列名id:uploadfile1,Hy_bt,Hy_swly
        lscolwidth = dtlist.Rows[0]["hy_width"].ToString();  //要显示的列名id:10,20,30
        lvcolname = lscolname.Split(',');
        lvcolnameid = lscolnameid.Split(',');
        lvcolwidth = lscolwidth.Split(',');
        string ls_colspan = (lvcolname.Length + 1).ToString();
        sb.Append("<table border='1'>");
        sb.Append("<thead><tr><th colSpan='" + ls_colspan + "' class='ztitle'>" + this.lblcurtachenameshow.Text + "</th></tr>");
        sb.Append("<tr><th colSpan='" + ls_colspan + "' class='tdheight20'></th></tr>");
        sb.Append("<tr>");
        sb.Append("<th style='width:70px;' class='tdcenter'>序号</th>");

        //如果没有数据则输出表头
        for (int n = 0; n < lvcolname.Length; n++)
        {
            if (n >= lvcolwidth.Length)
            {
                //此判断是为了防止对应宽度没有输入时,会溢出报错。
                lscolwidthper = "100";
            }
            else
            {
                lscolwidthper = (int.Parse(lvcolwidth[n]) * 20).ToString();
            }
            sb.Append("<th style='width:" + lscolwidthper + "px;' class='tdcenter'>" + lvcolname[n] + "</th>");
        }

        sb.Append("</tr></thead>");

        if (dt.Rows.Count <= 0)
        {
            sb.Append("</table>");
        }
        else
        {
            //如果有数据,则输出数据
            sb.Append("<tbody>");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append("<tr>");
                sb.Append("<td class='tdcenter'>" + (i + 1).ToString() + "</td>");  //序号
                //////开始得到列的值
                DataTable dtgetsqlfield;
                for (int m = 0; m < lvcolname.Length; m++)
                {
                    //根据字段英文名,得到数据库中对应的字段
                    dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
                    string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
                    //根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
                    string lsgetputfiled = "";
                    if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                    {
                        if (dt.Rows[i][lsgetsqlfield].ToString() != "")
                            lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        //解决Float小数点后面出现N位小数乱码的问题
                        if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
                        {
                            if (dt.Rows[i][lsgetsqlfield].ToString() != "")
                            {
                                //是否包含小数点,包含的话,取小数点后两位
                                if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
                                {
                                    lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
                                }
                                else
                                {
                                    lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
                                }
                            }
                            else
                            {
                                lsgetputfiled = "0";
                            }
                            //lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                        }
                        else
                        {
                            lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
                        }

                    }
                    if (lsgetputfiled == "")
                        lsgetputfiled = "&nbsp;";

                    sb.Append("<td class='tdcenter'>" + lsgetputfiled + "</td>");
                }
                sb.Append("</tr>");
            }
            sb.Append("</tbody></table>");
        }
        return sb.ToString();
    }
Esempio n. 12
0
    private void DataPlay()
    {
        //加载模块信息
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dtmudel = Hyoa_mudel.Getmudels();
        if (dtmudel.Rows.Count > 0)
        {
            this.ddlmudelid.DataSource = dtmudel;
            this.ddlmudelid.DataTextField = "hy_mudelname";
            this.ddlmudelid.DataValueField = "hy_mudelid";
            this.ddlmudelid.DataBind();
            this.ddlmudelid.Items.Insert(0, "--请选择--");
            this.ddlmudelid.SelectedIndex = 0;
        }

        //加载权限
        HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
        DataTable dtrole = Hyoa_role.Getroles();
        if (dtrole.Rows.Count > 0)
        {
            this.ddlrole.DataSource = dtrole;
            this.ddlrole.DataTextField = "hy_rolename";
            this.ddlrole.DataValueField = "hy_roleid";
            this.ddlrole.DataBind();
            this.ddlrole.Items.Insert(0, "--请选择--");
            this.ddlrole.SelectedIndex = 0;
        }

        this.ddlisenabled.Items.Insert(0, "是");
        this.ddlisenabled.Items.Insert(1, "否");

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml();

            //新文档,自动得到最大目录号
            if (this.Request.QueryString["op"] == "add")
            {
                if (this.txtmlid.Text == "")
                {
                    this.lblid.Text = Hyoa_ml.GetMaxFirstMLID();
                }
                else
                {
                    this.lblid.Text = Hyoa_ml.GetMaxMLID(this.txtmlid.Text);
                }
            }

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.lblid.Text = this.Request.QueryString["id"].ToString();
                    DataTable dt = Hyoa_ml.Getml(this.lblid.Text);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtname.Value = dt.Rows[0]["MLName"].ToString();

                        for (var i = 0; i < this.fdPic.Items.Count; i++)
                        {
                            if (this.fdPic.Items[i].Value == dt.Rows[0]["hy_pic"].ToString())
                            {
                                this.fdPic.SelectedIndex = i;
                            }
                        }
                        //图片
                        this.ml_pic.Src = dt.Rows[0]["hy_pic"].ToString();

                        this.txtlink.Value = dt.Rows[0]["hy_link"].ToString();
                        this.ddltarget.SelectedValue = dt.Rows[0]["hy_target"].ToString();
                        this.ddlrole.SelectedValue = dt.Rows[0]["hy_role"].ToString();
                        this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString();
                        //模块信息定位
                        for (var i = 0; i < this.ddlmudelid.Items.Count; i++)
                        {
                            if (this.ddlmudelid.Items[i].Value == dt.Rows[0]["hy_mudelid"].ToString())
                            {
                                this.ddlmudelid.SelectedIndex = i;
                            }
                        }
                        if (dt.Rows[0]["hy_ifqy"].ToString() == "是")
                            this.ddlisenabled.SelectedIndex = 0;
                        else
                            this.ddlisenabled.SelectedIndex = 1;

                        //根据模块信息得到对应的选择表单值
                        if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null)
                        {
                            this.ddltableid.Items.Clear();
                            //根据模块ID得到表单ID
                            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
                            DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString());
                            if (dtgettableid.Rows.Count > 0)
                            {
                                for (var i = 0; i < dtgettableid.Rows.Count; i++)
                                {
                                    this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString()));
                                }
                                this.ddltableid.Items.Insert(0, new ListItem("--请选择--", ""));
                                //定位
                                this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString();
                            }
                        }

                        //根据模块ID得到表单ID
                        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
                        DataTable dtlist = Hyoa_listconfig.GetlistconfigByTableid(this.ddltableid.SelectedValue);
                        if (dtlist.Rows.Count > 0)
                        {
                            for (var i = 0; i < dtlist.Rows.Count; i++)
                            {
                                this.ddllistid.Items.Insert(i, new ListItem(dtlist.Rows[i]["hy_listname"].ToString(), dtlist.Rows[i]["ID"].ToString()));
                            }
                            this.ddllistid.Items.Insert(0, new ListItem("--请选择--", ""));
                            //定位
                            this.ddllistid.SelectedValue = dt.Rows[0]["hy_listid"].ToString();
                        }
                    }
                    dt.Clear();
                    this.lblid.Enabled = false;
                }
            }
        }
    }
Esempio n. 13
0
 protected void ddltableid_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.ddltableid.SelectedIndex != 0)
     {
         this.ddllistid.Items.Clear();
         //根据表单ID得到列表名称和ID
         HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
         DataTable dt = Hyoa_listconfig.GetlistconfigByTableid(this.ddltableid.SelectedValue);
         if (dt.Rows.Count > 0)
         {
             for (var i = 0; i < dt.Rows.Count; i++)
             {
                 this.ddllistid.Items.Insert(i, new ListItem(dt.Rows[i]["hy_listname"].ToString(), dt.Rows[i]["ID"].ToString()));
             }
             this.ddllistid.Items.Insert(0, new ListItem("--请选择--", ""));
         }
     }
     else
     {
         //清空
         this.ddllistid.Items.Clear();
     }
 }
Esempio n. 14
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;
            }
            else
            {
                this.isrole.Value = "0";
                this.newcontrol.Visible = true;
                this.delcontrol_my.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")
                    {
                        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 ";
        }
        //---排序---结束

        //通过URL传过来的分类选择值 added by xf 2012-02-11
        string ls_key = "";
        string ls_subkey = "";
        string ls_threekey = "";
        if (Request.QueryString["key"] != null)
        {
            ls_key = Request.QueryString["key"].ToString();
        }
        if (Request.QueryString["subkey"] != null)
        {
            ls_subkey = Request.QueryString["subkey"].ToString();
        }
        if (Request.QueryString["threekey"] != null)
        {
            ls_threekey = Request.QueryString["threekey"].ToString();
        }

        //显示分类列表中的分类字段1  added by xf 2012-02-11
        if (dtlist.Rows[0]["hy_sql_fl1"].ToString() != "")
        {
            int li_i = 0;  //默认值
            //如果配置中包含了#,则手工配置型,否则执行SQL语句
            this.ddlflfield.Items.Insert(0, new ListItem("--请选择--", ""));
            if (dtlist.Rows[0]["hy_sql_fl1"].ToString().Contains("#"))
            {
                string[] lv_temp = dtlist.Rows[0]["hy_sql_fl1"].ToString().Split('#');
                for (var i = 0; i < lv_temp.Length; i++)
                {
                    this.ddlflfield.Items.Insert(i + 1, new ListItem(lv_temp[i], lv_temp[i]));
                    //默认值
                    if (lv_temp[i] == ls_key)
                        li_i = i + 1;
                }
            }
            else
            {
                string hy_sql_fl1 = dtlist.Rows[0]["hy_sql_fl1"].ToString();
                if (hy_sql_fl1.Contains("当前用户ID"))
                    hy_sql_fl1 = hy_sql_fl1.Replace("当前用户ID", "'" + Session["hyuid"].ToString() + "'");

                DataTable dt_flxx = Hyoa_global.GetDataTable(hy_sql_fl1);
                if (dt_flxx.Rows.Count > 0)
                {
                    for (var i = 0; i < dt_flxx.Rows.Count; i++)
                    {
                        this.ddlflfield.Items.Insert(i + 1, new ListItem(dt_flxx.Rows[i][0].ToString(), dt_flxx.Rows[i][0].ToString()));
                        //默认值
                        if (dt_flxx.Rows[i][0].ToString() == ls_key)
                            li_i = i + 1;
                    }
                }
            }
            ddlflfield.SelectedIndex = li_i;
        }
        //显示分类列表中的分类字段2  added by xf 2012-02-11
        if (dtlist.Rows[0]["hy_sql_fl2"].ToString() != "")
        {
            int li_i = 0;  //默认值
            //如果配置中包含了#,则手工配置型,否则执行SQL语句
            this.ddlflfield.Items.Insert(0, new ListItem("--请选择--", ""));
            if (dtlist.Rows[0]["hy_sql_fl2"].ToString().Contains("#"))
            {
                string[] lv_temp = dtlist.Rows[0]["hy_sql_fl2"].ToString().Split('#');
                for (var i = 0; i < lv_temp.Length; i++)
                {
                    this.ddlflfield2.Items.Insert(i + 1, new ListItem(lv_temp[i], lv_temp[i]));
                    //默认值
                    if (lv_temp[i] == ls_subkey)
                        li_i = i + 1;
                }
            }
            else
            {
                string hy_sql_fl2 = dtlist.Rows[0]["hy_sql_fl2"].ToString();
                if (hy_sql_fl2.Contains("当前用户ID"))
                    hy_sql_fl2 = hy_sql_fl2.Replace("当前用户ID", "'" + Session["hyuid"].ToString() + "'");

                DataTable dt_flxx = Hyoa_global.GetDataTable(hy_sql_fl2);
                if (dt_flxx.Rows.Count > 0)
                {
                    for (var i = 0; i < dt_flxx.Rows.Count; i++)
                    {
                        this.ddlflfield2.Items.Insert(i + 1, new ListItem(dt_flxx.Rows[i][0].ToString(), dt_flxx.Rows[i][0].ToString()));
                        //默认值
                        if (dt_flxx.Rows[i][0].ToString() == ls_subkey)
                            li_i = i + 1;
                    }
                }
            }
            ddlflfield2.SelectedIndex = li_i;
        }
        //显示分类列表中的分类字段3  added by xf 2012-02-11
        if (dtlist.Rows[0]["hy_sql_fl3"].ToString() != "")
        {
            int li_i = 0;  //默认值
            //如果配置中包含了#,则手工配置型,否则执行SQL语句
            this.ddlflfield3.Items.Insert(0, new ListItem("--请选择--", ""));
            if (dtlist.Rows[0]["hy_sql_fl3"].ToString().Contains("#"))
            {
                string[] lv_temp = dtlist.Rows[0]["hy_sql_fl3"].ToString().Split('#');
                for (var i = 0; i < lv_temp.Length; i++)
                {
                    this.ddlflfield3.Items.Insert(i + 1, new ListItem(lv_temp[i], lv_temp[i]));
                    //默认值
                    if (lv_temp[i] == ls_threekey)
                        li_i = i + 1;
                }
            }
            else
            {
                string hy_sql_fl3 = dtlist.Rows[0]["hy_sql_fl3"].ToString();
                if (hy_sql_fl3.Contains("当前用户ID"))
                    hy_sql_fl3 = hy_sql_fl3.Replace("当前用户ID", "'" + Session["hyuid"].ToString() + "'");

                DataTable dt_flxx = Hyoa_global.GetDataTable(hy_sql_fl3);
                if (dt_flxx.Rows.Count > 0)
                {
                    for (var i = 0; i < dt_flxx.Rows.Count; i++)
                    {
                        this.ddlflfield3.Items.Insert(i + 1, new ListItem(dt_flxx.Rows[i][0].ToString(), dt_flxx.Rows[i][0].ToString()));
                        //默认值
                        if (dt_flxx.Rows[i][0].ToString() == ls_threekey)
                            li_i = i + 1;
                    }
                }
            }
            ddlflfield3.SelectedIndex = li_i;
        }

        //通过选择的分类值,自动添加分类的查询值 added by xf 2012-02-11
        string ls_sqlfl = "";
        if (dtlist.Rows[0]["hy_fieldid_fl1"].ToString() != "")
        {
            if (ls_key != "")
            {
                hy_fieldid_fl1.Text = dtlist.Rows[0]["hy_fieldid_fl1"].ToString();
                ls_sqlfl += " and hyc_" + hy_fieldid_fl1.Text + "='" + ls_key + "' ";
            }
        }
        else
        {
            ddlflfield.Visible = false;
        }
        if (dtlist.Rows[0]["hy_fieldid_fl2"].ToString() != "")
        {
            if (ls_subkey != "")
            {
                hy_fieldid_fl2.Text = dtlist.Rows[0]["hy_fieldid_fl2"].ToString();
                ls_sqlfl += " and hyc_" + hy_fieldid_fl2.Text + "='" + ls_subkey + "' ";
            }
        }
        else
        {
            ddlflfield2.Visible = false;
        }
        if (dtlist.Rows[0]["hy_fieldid_fl3"].ToString() != "")
        {
            if (ls_threekey != "")
            {
                hy_fieldid_fl3.Text = dtlist.Rows[0]["hy_fieldid_fl3"].ToString();
                ls_sqlfl += " and hyc_" + hy_fieldid_fl3.Text + "='" + ls_threekey + "' ";
            }
        }
        else
        {
            ddlflfield3.Visible = false;
        }

        //--根据查询条件得到返回数据集--s
        DataTable dt = new DataTable();         //单页数据集
        DataTable dt_total = new DataTable();   //数据总条数,返回总条数值
        DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value);  //得到表配置信息查看当前表是否有流程 hy_ifflowdoc

        string cmdStr = "";
        if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是")
        {
            string ls_from = "";
            ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + ls_sqlfl + 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 " + ls_sqlfl + 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 = "";
            ls_from = " hyc_" + this.txttableid.Value + " where hy_djrid='" + Session["hyuid"].ToString() + "' " + ls_sqlfl + 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 hy_djrid='" + Session["hyuid"].ToString() + "' " + ls_sqlfl + 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>";
                }
            }
            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();
    }
Esempio n. 15
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 cmdStr = "";
        if (dttable.Rows[0]["hy_ifdisplayall"].ToString() == "是")
        {
            string ls_from = "";
            ls_from = " hyc_" + this.txttableid.Value + " where 1=1 " + cmdStr_Search;
            if (Session["conntype"].ToString() == "SQL")
            {
                cmdStr = "select 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 ";

            # region 客户管理、商机管理
            string ls_mids4 = ",Mudelkhda,Mudelsjgl,";
            if (ls_mids4.IndexOf("," + this.txtmudelid.Value + ",") >= 0)
            {
                //if (this.txtmudelid.Value == "Mudelkhda")
                //{
                this.newcontrol.Visible = false;
                this.delcontrol_my.Visible = false;

                if (Hyoa_global.isHaveRole("Rolekhgl001", this.Session["hyuid"].ToString()))
                {
                    //查看所有
                }
                else if (Hyoa_global.isHaveRole("Rolekhgl002", this.Session["hyuid"].ToString()))
                {
                    //查看本部
                    if (this.Session["hyuid"].ToString() == "008")
                    {
                        //业务一部 酒店、综合
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='005' ";
                    }
                    if (this.Session["hyuid"].ToString() == "009")
                    {
                        //业务二部 金融、政府
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='006' ";
                    }

                }
                //else if (Hyoa_global.isHaveRole("Rolekhgl003", this.Session["hyuid"].ToString()))
                //{
                //    //查看本组
                //    ls_from += " and hy_djrbmid='" + Session["hydeptid"].ToString() + "'";
                //}
                else
                {
                    ////自己看自己
                    //ls_from += " and hy_djrid='" + Session["hyuid"].ToString() + "' ";
                    //同组可以查看
                    ls_from += " and hy_djrbmid='" + Session["hydeptid"].ToString() + "'";
                }
            }
            # endregion

            # region 合同管理
            string ls_mids = ",Mudelsyyhfwxy,Mudeljdhazfwht,MudelVODfwxy,Mudelffpdfwht,MudelDVBazfwdght,Mudeljwdsjsxy,Mudeljwdscsxy,Mudelkdjrht,Mudelsjcsfwht,Mudelsjgdcsfwht,Mudelsjtxyyhzxy,Mudelzdyht,Mudelqtht,Mudelgxhzhht,";
            if (ls_mids.IndexOf("," + this.txtmudelid.Value + ",") >= 0)
            {
                if (Hyoa_global.isHaveRole("Rolehtgl001", this.Session["hyuid"].ToString()))
                {
                    //查看所有
                }
                else if (Hyoa_global.isHaveRole("Rolehtgl002", this.Session["hyuid"].ToString()))
                {
                    //查看本部
                    if (this.Session["hyuid"].ToString() == "008")
                    {
                        //业务一部 酒店、综合
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='005' ";
                    }
                    if (this.Session["hyuid"].ToString() == "009")
                    {
                        //业务二部 金融、政府
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='006' ";
                    }

                }
                //else if (Hyoa_global.isHaveRole("Rolehtgl003", this.Session["hyuid"].ToString()))
                //{
                //    //查看本组
                //    ls_from += " and hy_djrbmid='" + Session["hydeptid"].ToString() + "'";
                //}
                else
                {
                    //同组可以查看
                    ls_from += " and hy_djrbmid='" + Session["hydeptid"].ToString() + "'";
                }
            }
            # endregion

            # region 数据管理--指标管理
            if (this.txtmudelid.Value == "Mudelzbsrwh")
            {
                if (Hyoa_global.isHaveRole("Rolesjglzbgl001", this.Session["hyuid"].ToString()))
                {
                    //查看所有
                }
                else if (Hyoa_global.isHaveRole("Rolesjglzbgl002", this.Session["hyuid"].ToString()))
                {
                    //查看本部
                    if (this.Session["hyuid"].ToString() == "008")
                    {
                        //业务一部 酒店、综合
                        ls_from += " and SUBSTRING(hyc_szzid2, 0, 4)='005' ";
                    }
                    if (this.Session["hyuid"].ToString() == "009")
                    {
                        //业务二部 金融、政府
                        ls_from += " and SUBSTRING(hyc_szzid2, 0, 4)='006' ";
                    }

                }
                //else if (Hyoa_global.isHaveRole("Rolesjglzbgl003", this.Session["hyuid"].ToString()))
                //{
                //    //查看本组
                //    ls_from += " and hyc_szzid2='" + Session["hydeptid"].ToString() + "'";
                //}
                else
                {
                    //    //自己看自己
                    //    ls_from += " and hyc_khjlid2='" + Session["hyuid"].ToString() + "' ";
                    ls_from += " and hyc_szzid2='" + Session["hydeptid"].ToString() + "'";
                }
            }
            # endregion

            # region 日常管理
            string ls_mids2 = ",Mudelxjsq,Mudelshd,Mudelszds,Mudelywsl,Mudelzbgl,";
            if (ls_mids2.IndexOf("," + this.txtmudelid.Value + ",") >= 0)
            {
                if (Hyoa_global.isHaveRole("Rolercgl001", this.Session["hyuid"].ToString()))
                {
                    //查看所有
                }
                else if (Hyoa_global.isHaveRole("Rolercgl002", this.Session["hyuid"].ToString()))
                {
                    //查看本部
                    if (this.Session["hyuid"].ToString() == "008")
                    {
                        //业务一部 酒店、综合
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='005' ";
                    }
                    if (this.Session["hyuid"].ToString() == "009")
                    {
                        //业务二部 金融、政府
                        ls_from += " and SUBSTRING(hy_djrbmid, 0, 4)='006' ";
                    }

                }
                else if (Hyoa_global.isHaveRole("Rolercgl003", this.Session["hyuid"].ToString()))
                {
                    //查看本组
                    ls_from += " and hy_djrbmid='" + Session["hydeptid"].ToString() + "'";
                }
                else
                {
                    //自己看自己
                    ls_from += " and hy_djrid='" + Session["hyuid"].ToString() + "' ";
                }
            }
            # endregion

            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 hy_djrid='" + Session["hyuid"].ToString() + "' " + cmdStr_Search + cmdStr_SearchSort;

                cmdStr += " )  my_table ";
                cmdStr += " where rownum<= " + ((PageNo) * int.Parse(PageSize.Text)).ToString();
                cmdStr += " ) where my_rownum> " + ((PageNo - 1) * int.Parse(PageSize.Text)).ToString();
            }
            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();
    }
    private void DataPlay(int PageNo)
    {
        //得到当前模块对应的全权用户组
        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)
        {
            if (dt_mudel.Rows[0]["hy_qqroleid"] == null)
            {
                return;
            }
            else
            {
                if (dt_mudel.Rows[0]["hy_qqroleid"] == "")
                {
                    return;
                }
                else
                {
                    ls_role = dt_mudel.Rows[0]["hy_qqroleid"].ToString();
                }
            }
        }

        //根据表ID和模块ID得到当前传进来的模块是否有流程
        HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
        DataTable dttableconfig = Hyoa_tableconfig.GetTablesbymudelidandtableid(this.txtmudelid.Value, this.txttableid.Value);

        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
        }
        else
        {
            this.isrole.Value = "0";
            Response.Write("<script>alert('您无权访问此页面的数据!');self.close();</script>");
            return;
        }

        //根据表单得到对应的所有字段
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dtflowfield = Hyoa_flowfield.Getflowfieldsbytableid(dttableconfig.Rows[0]["ID"].ToString());
        //循环所有字段
        string ls_flowfield = "";
        if (dtflowfield.Rows.Count > 0)
        {
            for (int i = 0; i < dtflowfield.Rows.Count; i++)
            {
                string ls_fieldtype = dtflowfield.Rows[i]["hy_fieldtype"].ToString();
                if (ls_fieldtype == "文本" || ls_fieldtype == "多行文本" || ls_fieldtype == "文本加按钮" || ls_fieldtype == "多行文本加按钮" || ls_fieldtype == "日期" || ls_fieldtype == "数值" || ls_fieldtype == "对话框列表" || ls_fieldtype == "复选框" || ls_fieldtype == "单选框" || ls_fieldtype == "口令")
                {
                    ls_flowfield += ",a.hyc_" + dtflowfield.Rows[i]["hy_fieldid"].ToString();
                }
            }
        }

        HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
        DataTable dtlist = Hyoa_listconfig.Getlistconfig(this.txtlistid.Value);     //列表配置

        this.lbdisplaytitle.Text = "";

        //---排序---开始
        string cmdStr_SearchSort = "";
        if (dtlist.Rows[0]["hy_sortfield1"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield1"].ToString() + " " + dtlist.Rows[0]["hy_sorttype1"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield2"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield2"].ToString() + " " + dtlist.Rows[0]["hy_sorttype2"].ToString();
            }
        }
        if (dtlist.Rows[0]["hy_sortfield3"].ToString() != "")
        {
            if (cmdStr_SearchSort == "")
            {
                cmdStr_SearchSort = " order by hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
            else
            {
                cmdStr_SearchSort += " ,hyc_" + dtlist.Rows[0]["hy_sortfield3"].ToString() + " " + dtlist.Rows[0]["hy_sorttype3"].ToString();
            }
        }
        if (cmdStr_SearchSort == "")
        {
            //没有配置,则默认按登记日期
            cmdStr_SearchSort = " order by hy_djsj desc ";
        }
        //---排序---结束

        //--根据查询条件得到返回数据集--s
        DataTable dt = new DataTable();         //单页数据集
        DataTable dt_total = new DataTable();   //数据总条数,返回总条数值
        DataTable dttable = Hyoa_tableconfig.GetTable(this.txttableid.Value);  //得到表配置信息查看当前表是否有流程 hy_ifflowdoc

        string cmdStr = "";
        cmdStr = "select * from hyc_" + this.txttableid.Value + " " + cmdStr_SearchSort;
        dt = Hyoa_global.GetDataTable(cmdStr);
        cmdStr = "select count(*) from hyc_" + this.txttableid.Value;
        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 == 0)
                {
                    this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[m] + "</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>";
                }
            }
            //////////如果是流程表单,则最后追加两列(当前环节和当前处理人)
            //////////表头
            ////////if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null && i == (PageNo - 1) * System.Int32.Parse(PageSize.Text))
            ////////{
            ////////    this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前环节</td>";
            ////////    this.lbdisplaytitle.Text += "<td width=\"10%\" class=\"TdcellHead\"><p align=\"center\">当前处理人</td>";
            ////////}
            //////////数据
            ////////if (dt.Rows[i]["hy_flowid"].ToString() != "" && dt.Rows[i]["hy_flowid"].ToString() != null)
            ////////{
            ////////    ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curtachename"].ToString() + "&nbsp;</td>";
            ////////    ls_col += "<td width=\"10%\" align=\"center\">" + dt.Rows[i]["hy_curclrname"].ToString() + "&nbsp;</td>";
            ////////}

            dr["displaycol"] = ls_col;  //将新值赋给相应的列  add
            ls_col = "";
            tempTable.Rows.Add(dr);
        }

        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }