コード例 #1
0
  public void searchByRMA(CurrentProduct currentProduct) {
    con = dbCon.geConnection();

    currentProduct.currentProductList.clear();

    try {
      pst = con.prepareStatement("select * from Products where RMAId=?");
      pst.setString(1, currentProduct.rmaId);
      rs = pst.executeQuery();
      while (rs.next()) {
        currentProduct.id = rs.getString(1);
        currentProduct.productId = rs.getString(2);
        currentProduct.productName = rs.getString(3);
        currentProduct.quantity = rs.getString(4);
        currentProduct.description = rs.getString(5);
        currentProduct.supplierId = rs.getString(6);
        currentProduct.brandId = rs.getString(7);
        currentProduct.catagoryId = rs.getString(8);
        currentProduct.unitId = rs.getString(9);
        currentProduct.pursesPrice = rs.getString(10);
        currentProduct.sellPrice = rs.getString(11);
        currentProduct.rmaId = rs.getString(12);
        currentProduct.userId = rs.getString(13);
        currentProduct.date = rs.getString(14);
        currentProduct.supplierName =
            sql.getName(currentProduct.supplierId, currentProduct.supplierName, "Supplyer");
        currentProduct.brandName =
            sql.getName(currentProduct.brandId, currentProduct.brandName, "Brands");
        currentProduct.catagoryName =
            sql.getName(currentProduct.catagoryId, currentProduct.catagoryName, "Catagory");
        currentProduct.unitName =
            sql.getName(currentProduct.unitId, currentProduct.unitName, "Unit");
        currentProduct.rmaName = sql.getName(currentProduct.rmaId, currentProduct.rmaName, "RMA");
        currentProduct.userName =
            sql.getName(currentProduct.userId, currentProduct.userName, "User");
        currentProduct.currentProductList.addAll(
            new ListProduct(
                currentProduct.id,
                currentProduct.productId,
                currentProduct.productName,
                currentProduct.quantity,
                currentProduct.description,
                currentProduct.supplierName,
                currentProduct.brandName,
                currentProduct.catagoryName,
                currentProduct.unitName,
                currentProduct.pursesPrice,
                currentProduct.sellPrice,
                currentProduct.rmaName,
                currentProduct.userName,
                currentProduct.date));
      }
      pst.close();
      con.close();
      rs.close();
    } catch (SQLException ex) {
      Logger.getLogger(CurrentProductGetway.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
コード例 #2
0
  public void view(CurrentProduct currentProduct) {
    currentProduct.currentProductList.clear();
    con = dbCon.geConnection();

    try {
      pst = con.prepareStatement("SELECT SQL_NO_CACHE * FROM Products");
      rs = pst.executeQuery();
      while (rs.next()) {

        currentProduct.id = rs.getString(1);
        currentProduct.productId = rs.getString(2);
        currentProduct.productName = rs.getString(3);
        currentProduct.quantity = rs.getString(4);
        currentProduct.description = rs.getString(5);
        currentProduct.supplierId = rs.getString(6);
        currentProduct.brandId = rs.getString(7);
        currentProduct.catagoryId = rs.getString(8);
        currentProduct.unitId = rs.getString(9);
        currentProduct.pursesPrice = rs.getString(10);
        currentProduct.sellPrice = rs.getString(11);
        currentProduct.rmaId = rs.getString(12);
        currentProduct.userId = rs.getString(13);
        currentProduct.date = rs.getString(14);
        currentProduct.supplierName =
            sql.getName(currentProduct.supplierId, currentProduct.supplierName, "Supplyer");
        currentProduct.brandName =
            sql.getName(currentProduct.brandId, currentProduct.brandName, "Brands");
        currentProduct.catagoryName =
            sql.getName(currentProduct.catagoryId, currentProduct.catagoryName, "Catagory");
        currentProduct.unitName =
            sql.getName(currentProduct.unitId, currentProduct.unitName, "Unit");
        currentProduct.rmaName = sql.getName(currentProduct.rmaId, currentProduct.rmaName, "RMA");
        currentProduct.userName =
            sql.getName(currentProduct.userId, currentProduct.userName, "User");
        currentProduct.currentProductList.addAll(
            new ListProduct(
                currentProduct.id,
                currentProduct.productId,
                currentProduct.productName,
                currentProduct.quantity,
                currentProduct.description,
                currentProduct.supplierName,
                currentProduct.brandName,
                currentProduct.catagoryName,
                currentProduct.unitName,
                currentProduct.pursesPrice,
                currentProduct.sellPrice,
                currentProduct.rmaName,
                currentProduct.userName,
                currentProduct.date));
      }
      pst.close();
      con.close();
      rs.close();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
コード例 #3
0
  public void sView(CurrentProduct currentProduct) {
    con = dbCon.geConnection();

    try {
      pst = con.prepareStatement("select * from Products where ProductId=?");
      pst.setString(1, currentProduct.productId);
      rs = pst.executeQuery();
      while (rs.next()) {
        currentProduct.id = rs.getString(1);
        currentProduct.productId = rs.getString(2);
        currentProduct.productName = rs.getString(3);
        currentProduct.quantity = rs.getString(4);
        currentProduct.description = rs.getString(5);
        currentProduct.supplierId = rs.getString(6);
        currentProduct.brandId = rs.getString(7);
        currentProduct.catagoryId = rs.getString(8);
        currentProduct.unitId = rs.getString(9);
        currentProduct.pursesPrice = rs.getString(10);
        currentProduct.sellPrice = rs.getString(11);
        currentProduct.rmaId = rs.getString(12);
        currentProduct.userId = rs.getString(13);
        currentProduct.date = rs.getString(14);
        currentProduct.supplierName =
            sql.getName(currentProduct.supplierId, currentProduct.supplierName, "Supplyer");
        currentProduct.brandName =
            sql.getName(currentProduct.brandId, currentProduct.brandName, "Brands");
        currentProduct.catagoryName =
            sql.getName(currentProduct.catagoryId, currentProduct.catagoryName, "Catagory");
        currentProduct.unitName =
            sql.getName(currentProduct.unitId, currentProduct.unitName, "Unit");
        currentProduct.rmaName = sql.getName(currentProduct.rmaId, currentProduct.rmaName, "RMA");
        currentProduct.userName =
            sql.getName(currentProduct.userId, currentProduct.userName, "User");
        currentProduct.rmaDayesss = sql.getDayes(currentProduct.rmaDayesss, currentProduct.rmaId);
        long dateRMA = Long.parseLong(currentProduct.rmaDayesss);

        currentProduct.warrentyVoidDate = LocalDate.now().plusDays(dateRMA).toString();
      }
      pst.close();
      con.close();
      rs.close();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }