private void SearchData()
    {
        ProductionToDoListFlow flow = new ProductionToDoListFlow();
        ProductionWaitListSearchData data = new ProductionWaitListSearchData();
        data.CODEFROM = this.txtCodeFrom.Text.Trim();
        data.CODETO = this.txtCodeTo.Text.Trim();
        data.DATEFROM = this.dtpDateFrom.DateValue;
        data.DATETO = this.dtpDateTo.DateValue;
        data.PDNAME = this.txtPDName.Text.Trim();

        this.grvProductionWait.DataSource = flow.GetProductionWaitList(data);
        this.grvProductionWait.DataBind();
    }
        public DataTable GetProductionWaitList(ProductionWaitListSearchData data)
        {
            string where = "";

            if (data.CODEFROM.Trim() != "")
                where += (where == "" ? "" : "AND ") + "UPPER(CODE) >= '" + OracleDB.QRText(data.CODEFROM.Trim()).ToUpper() + "' ";

            if (data.CODETO.Trim() != "")
                where += (where == "" ? "" : "AND ") + "UPPER(CODE) <= '" + OracleDB.QRText(data.CODETO.Trim()).ToUpper() + "' ";

            if (data.DATEFROM.Year != 1)
                where += (where == "" ? "" : "AND ") + "TO_DATE(REQDATE, 'DDMMYYYY') >= " + OracleDB.QRDate(data.DATEFROM) + " ";

            if (data.DATETO.Year != 1)
                where += (where == "" ? "" : "AND ") + "TO_DATE(REQDATE, 'DDMMYYYY') <= " + OracleDB.QRDate(data.DATETO) + " ";

            if (data.PDNAME.Trim() != "")
                where += (where == "" ? "" : "AND ") + "UPPER(PDNAME) LIKE '%" + data.PDNAME.Trim().ToUpper() + "%' ";

            string sql = "SELECT RQILOID, RQLOID, PDLOID, CODE, PDNAME, REQDATE, QTY, UNAME, OFFICER ";
            sql += "FROM V_TODOLIST_PD_WAIT ";
            sql += (where == "" ? "" : "WHERE " + where);
            return OracleDB.ExecListCmd(sql);
        }