Permalink
Browse files

No commit message

  • Loading branch information...
1 parent d63298a commit f71600f2fbecf0bf6c4505ff797fb0bc3a9a8d58 kumar committed May 10, 2012
Showing with 22 additions and 23 deletions.
  1. +21 −12 src/ims/DataLayer/DataAccess.java
  2. +1 −11 src/ims/UI/PizzaOrder.java
@@ -97,22 +97,20 @@
Ingredient ingredient = new Ingredient(rs.getString(9),rs.getDouble(10),rs.getDouble(11),rs.getString(12));
ingredientList.add(ingredient);
- if( rs.next() && idBranch != rs.getInt(1) ) {
- String bName = rs.getString(2);
- String bAddress = rs.getString(3);
- String bPhone = rs.getString(4);
- String bCity = rs.getString(5);
-
- branch = new Branch(bName, bAddress, bPhone, bCity);
- }
+ String bName = rs.getString(2);
+ String bAddress = rs.getString(3);
+ String bPhone = rs.getString(4);
+ String bCity = rs.getString(5);
+
+
if ( rs.next() && idOrder != rs.getInt(6) ) {
String oOrderDate = rs.getString(7);
double oOrderCost = rs.getDouble(8);
-
+ branch = new Branch(bName, bAddress, bPhone, bCity);
order = new Order(idOrder, oOrderDate, branch, oOrderCost, ingredientList);
orderList.add(order);
- ingredientList.clear();
+ ingredientList = new ArrayList<Ingredient>();
}
rs.previous();
@@ -292,12 +290,23 @@ else if (tempLocal == Location.Branch2)
String pizzaSize = resultSet.getString(8);
double cost = resultSet.getDouble(9);
- if(resultSet.next() && prevPizzaId != resultSet.getInt(1))
+ if(resultSet.next())
+ {
+ if(prevPizzaId != resultSet.getInt(1))
+ {
+ Pizza pizza = new Pizza (pizzaName,pizzaSize,ingredientList,cost);
+ pizza.setPizzaId(prevPizzaId);
+ pizzaList.add(pizza);
+ ingredientList = new ArrayList<Ingredient>();
+ }
+ }
+ else
{
Pizza pizza = new Pizza (pizzaName,pizzaSize,ingredientList,cost);
pizza.setPizzaId(prevPizzaId);
pizzaList.add(pizza);
- ingredientList.clear();
+ //ingredientList.clear();
+ break;
}
resultSet.previous();
}
View
@@ -87,17 +87,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- jtblOrderTable.setModel(new javax.swing.table.DefaultTableModel(
- new Object [][] {
- {null, null, null, null},
- {null, null, null, null},
- {null, null, null, null},
- {null, null, null, null}
- },
- new String [] {
- "Pizza Name", "Pizza Size", "Quantity", "Amount"
- }
- ));
+ jtblOrderTable.setModel(model);
jtblOrderTable.setToolTipText("");
jScrollPane1.setViewportView(jtblOrderTable);

0 comments on commit f71600f

Please sign in to comment.