Пример #1
0
 private ControlStockSearchData GetSearchData()
 {
     ControlStockSearchData data = new ControlStockSearchData();
     data.BARCODE = txtBarcode.Text.Trim();
     data.BARCODETO = txtBarcodeTo.Text.Trim();
     data.PRODUCTNAME = txtProductName.Text.Trim();
     data.WAREHOUSE = Convert.ToDouble(this.txtWarehouse.Text).ToString();
     return data;
 }
Пример #2
0
        public ArrayList GetSearchProduct(ControlStockSearchData data)
        {
            ArrayList arrResult = new ArrayList();
            string whStr = "";
            string sql = "";

            if (data.WAREHOUSE.Trim() != "")
                whStr += (data.WAREHOUSE == "" ? "" : " PM.WAREHOUSE = " + data.WAREHOUSE + "");
            if (data.BARCODE.Trim() != "")
                whStr += (data.BARCODE == "" ? "" : (whStr == "" ? "" : " AND ") + " PD.BARCODE >= '" + data.BARCODE + "'");
            if (data.BARCODETO.Trim() != "")
                whStr += (data.BARCODETO == "" ? "" : (whStr == "" ? "" : " AND ") + " PD.BARCODE <= '" + data.BARCODETO + "'");
            if (data.PRODUCTNAME.Trim() != "")
                whStr += (data.PRODUCTNAME == "" ? "" : (whStr == "" ? "" : " AND ") + " UPPER(PD.NAME) LIKE UPPER('%" + data.PRODUCTNAME + "%')");
            
            sql = "SELECT PD.BARCODE, PD.NAME, PM.LOID AS PDMINMAXLOID, PM.STANDARD, PM.MINIMUM, PM.MAXIMUM";
            sql += " FROM PRODUCTMINMAX PM INNER JOIN PRODUCT PD ON PM.PRODUCT = PD.PRODUCTMASTER AND PD.ISDEFAULT = 'Y' ";
            sql += (whStr == "" ? "" : " WHERE" + whStr);
            sql += " ORDER BY PD.BARCODE"; 

            try
            {
                OracleDataReader zRd = OracleDB.ExecQueryCmd(sql);
                arrResult.Clear();
                int i = 1;

                while (zRd.Read())
                {
                    ControlStockResultData irData = new ControlStockResultData();
                    irData.ORDERNO = i;
                    irData.PDMINMAXLOID = zRd["PDMINMAXLOID"].ToString();
                    irData.BARCODE = zRd["BARCODE"].ToString();
                    irData.PRODUCTNAME = zRd["NAME"].ToString();
                    irData.STANDARD = Convert.ToDouble(zRd["STANDARD"]).ToString("#,##0.00");
                    irData.MINIMUM = Convert.ToDouble(zRd["MINIMUM"]).ToString("#,##0.00");
                    irData.MAXIMUM = Convert.ToDouble(zRd["MAXIMUM"]).ToString("#,##0.00");
                   
                    arrResult.Add(irData);
                    i += 1;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return arrResult;
        }