예제 #1
0
 private BasketSearchData GetSearchData()
 {
     BasketSearchData data = new BasketSearchData();
     data.BARCODE = txtBarcode.Text.Trim();
     data.PRODUCTNAME = txtBasketName.Text.Trim();
     return data;
 }
예제 #2
0
        public ArrayList GetSearchBasket(BasketSearchData data)
        {
            ArrayList arrResult = new ArrayList();
            string whStr = "";
            string sql = "";

            whStr += (data.BARCODE == "" ? "" : (whStr == "" ? "" : " AND ") + " PD.BARCODE = '" + data.BARCODE + "'");
            whStr += (data.PRODUCTNAME == "" ? "" : (whStr == "" ? "" : " AND ") + " PD.NAME LIKE '%" + data.PRODUCTNAME + "%'");

            sql = "SELECT DISTINCT PD.LOID, PD.BARCODE, PD.NAME, PD.COST, PD.PRICE";
            sql += " FROM PRODUCT PD INNER JOIN PACKAGE PK ON PK.MAINPRODUCT = PD.LOID";
            sql += (whStr == "" ? "" : " WHERE" + whStr);
            sql += " ORDER BY PD.BARCODE";

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

                while (zRd.Read())
                {
                    BasketSearchResultData irData = new BasketSearchResultData();
                    irData.ORDERNO = i;
                    irData.LOID = zRd["LOID"].ToString();
                    irData.BARCODE = zRd["BARCODE"].ToString();
                    irData.PRODUCTNAME = zRd["NAME"].ToString();
                    irData.COST = Convert.ToDouble(zRd["COST"]).ToString("#,##0.00");
                    irData.PRICE = Convert.ToDouble(zRd["PRICE"]).ToString("#,##0.00");

                    arrResult.Add(irData);
                    i += 1;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return arrResult;
        }