Skip to content

Commit

Permalink
Demand service code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shashirajraja authored Oct 22, 2023
1 parent 28504fa commit 2ede2ec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/com/shashi/service/impl/DemandServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@
import com.shashi.beans.DemandBean;
import com.shashi.service.DemandService;
import com.shashi.utility.DBUtil;

//This class is to process the demand items which are
//not available at the time of purchase by any customer
//the customer will receive mail once the product is avaible
//back into the store
public class DemandServiceImpl implements DemandService {

@Override
public boolean addProduct(String userId, String prodId, int demandQty) {
boolean flag = false;

//get the database connection
Connection con = DBUtil.provideConnection();

PreparedStatement ps = null;
PreparedStatement ps2 = null;
ResultSet rs = null;

try {
//create the prepared statement with the query
ps = con.prepareStatement("select * from user_demand where username=? and prodid=?");

ps.setString(1, userId);
Expand Down Expand Up @@ -58,7 +63,7 @@ public boolean addProduct(String userId, String prodId, int demandQty) {
DBUtil.closeConnection(ps);
DBUtil.closeConnection(ps2);
DBUtil.closeConnection(rs);

//return true if the product is added into the db
return flag;
}

Expand Down

0 comments on commit 2ede2ec

Please sign in to comment.