Beispiel #1
0
    private void BinData()
    {
        // DateTime dateEnd=(DateTime)dateedtSCRQ2.Value;
        DataTable dtbRCL = new DataTable();
        string where=string.Empty;
        string m_scrq1 = Convert.ToDateTime(dateedtSCRQ1.Text.Trim()).ToString("yyyy-MM-dd");
        string m_scrq2 = Convert.ToDateTime(dateedtSCRQ2.Text.Trim()).ToString("yyyy-MM-dd");//dateEnd.AddDays(+1).ToString("yyy-MM-dd");
        string m_gxid = cbGX.Value.ToString().Trim();
        string m_xxlx = cbXXLX.Text.ToString().Trim();
        //    string m_yg = txtYG.Text.ToString().Trim();

        if (!string.IsNullOrEmpty(m_scrq1) && !string.IsNullOrEmpty(m_scrq2))
        {
            where = string.Format(" {0} and czrq >= '{1}' AND czrq <= '{2}'", where, m_scrq1, m_scrq2);
        }

        if (!string.IsNullOrEmpty(m_xxlx) && m_xxlx != "全部")
        {
            if (m_xxlx == "其它")
            {
                where = string.Format(" {0} and ( XXLX = '{1}' OR XXLX = NULL)", where, "");
            }
            else if (m_xxlx == "三相")
            {
                where = string.Format(" {0} and substring(XXLX,1,2) = '{1}'", where, m_xxlx);
            }
            else
            {
                where = string.Format(" {0} and XXLX = '{1}'", where, m_xxlx);
            }
        }

        if (!string.IsNullOrEmpty(m_gxid))
        {
            if (m_gxid == "102611")
            {
                where = string.Format(" SELECT * FROM V_GZ_BZDYTJ WHERE 1=1 {0}", where);

                V_GZ_BZDYTJ valBz = new V_GZ_BZDYTJ();
                V_GZ_BZDYTJ condBz = new V_GZ_BZDYTJ();
                conn = "connMES";
                dtbRCL = BLLTable<V_GZ_BZDYTJ>.Factory(conn).qDataTable(where);
            }
            if (m_gxid == "102511")
            {

                where = string.Format(" SELECT * FROM V_GZ_CPJTJ WHERE 1=1 {0}", where);

                V_GZ_CPJTJ valBz = new V_GZ_CPJTJ();
                V_GZ_CPJTJ condBz = new V_GZ_CPJTJ();
                conn = "connMES";
                dtbRCL = BLLTable<V_GZ_CPJTJ>.Factory(conn).qDataTable(where);
            }
            if (m_gxid == "102311")
            {

                where = string.Format(" SELECT * FROM V_GZ_JBTJ WHERE 1=1 {0}", where);

                V_GZ_JBTJ valBz = new V_GZ_JBTJ();
                V_GZ_JBTJ condBz = new V_GZ_JBTJ();
                conn = "connMES";
                dtbRCL = BLLTable<V_GZ_JBTJ>.Factory(conn).qDataTable(where);
            }
        }

        this.gridRGZ.DataSource = dtbRCL;
        gridRGZ.DataBind();  //执行绑定
        ViewState["detailtable"] = dtbRCL;//dtbRGZMX;
    }
Beispiel #2
0
    private void BinData()
    {
        // DateTime dateEnd=(DateTime)dateedtSCRQ2.Value;
        DataTable dtbRCL = new DataTable();

        string where = string.Empty;
        string m_scrq1 = Convert.ToDateTime(dateedtSCRQ1.Text.Trim()).ToString("yyyy-MM-dd");
        string m_scrq2 = Convert.ToDateTime(dateedtSCRQ2.Text.Trim()).ToString("yyyy-MM-dd");//dateEnd.AddDays(+1).ToString("yyy-MM-dd");
        string m_gxid  = cbGX.Value.ToString().Trim();
        string m_xxlx  = cbXXLX.Text.ToString().Trim();

        //    string m_yg = txtYG.Text.ToString().Trim();


        if (!string.IsNullOrEmpty(m_scrq1) && !string.IsNullOrEmpty(m_scrq2))
        {
            where = string.Format(" {0} and czrq >= '{1}' AND czrq <= '{2}'", where, m_scrq1, m_scrq2);
        }

        if (!string.IsNullOrEmpty(m_xxlx) && m_xxlx != "全部")
        {
            if (m_xxlx == "其它")
            {
                where = string.Format(" {0} and ( XXLX = '{1}' OR XXLX = NULL)", where, "");
            }
            else if (m_xxlx == "三相")
            {
                where = string.Format(" {0} and substring(XXLX,1,2) = '{1}'", where, m_xxlx);
            }
            else
            {
                where = string.Format(" {0} and XXLX = '{1}'", where, m_xxlx);
            }
        }


        if (!string.IsNullOrEmpty(m_gxid))
        {
            if (m_gxid == "102611")
            {
                where = string.Format(" SELECT * FROM V_GZ_BZDYTJ WHERE 1=1 {0}", where);

                V_GZ_BZDYTJ valBz  = new V_GZ_BZDYTJ();
                V_GZ_BZDYTJ condBz = new V_GZ_BZDYTJ();
                conn   = "connMES";
                dtbRCL = BLLTable <V_GZ_BZDYTJ> .Factory(conn).qDataTable(where);
            }
            if (m_gxid == "102511")
            {
                where = string.Format(" SELECT * FROM V_GZ_CPJTJ WHERE 1=1 {0}", where);

                V_GZ_CPJTJ valBz  = new V_GZ_CPJTJ();
                V_GZ_CPJTJ condBz = new V_GZ_CPJTJ();
                conn   = "connMES";
                dtbRCL = BLLTable <V_GZ_CPJTJ> .Factory(conn).qDataTable(where);
            }
            if (m_gxid == "102311")
            {
                where = string.Format(" SELECT * FROM V_GZ_JBTJ WHERE 1=1 {0}", where);

                V_GZ_JBTJ valBz  = new V_GZ_JBTJ();
                V_GZ_JBTJ condBz = new V_GZ_JBTJ();
                conn   = "connMES";
                dtbRCL = BLLTable <V_GZ_JBTJ> .Factory(conn).qDataTable(where);
            }
        }

        this.gridRGZ.DataSource = dtbRCL;
        gridRGZ.DataBind();                //执行绑定
        ViewState["detailtable"] = dtbRCL; //dtbRGZMX;
    }