@Override protected ArrayList vAddRow(Connection conn) throws Exception { RBDocTypesDPanel p = new RBDocTypesDPanel(); AUniversalAddDialog d = new AUniversalAddDialog(p, null, true); d.setTitleIcon( new javax.swing.ImageIcon( getClass().getResource("/tradeterminal/icons/TT_icons/32X32/typplus.png"))); d.setVisible(true); d.dispose(); if (d.getReturnStatus() == ADialog.RET_OK) { CallableStatement proc = conn.prepareCall("{? = call rb_doc_types_insert(?,?)}"); proc.registerOutParameter(1, Types.INTEGER); proc.setString(2, p.get_Name()); proc.setString(3, p.getDescription()); proc.execute(); int id = proc.getInt(1); proc.close(); ArrayList newRow = new ArrayList(); newRow.add(id); newRow.add(p.get_Name()); newRow.add(p.getDescription()); return newRow; } else { return null; } }
@Override protected ArrayList vEditRow(Connection conn, ArrayList curRow) throws Exception { RBDocTypesDPanel p = new RBDocTypesDPanel(); AUniversalEditDialog d = new AUniversalEditDialog(p, null, true); p.set_Name(curRow.get(1).toString()); p.setDescription(curRow.get(2).toString()); d.setTitleIcon( new javax.swing.ImageIcon( getClass().getResource("/tradeterminal/icons/TT_icons/32X32/typred.png"))); d.setVisible(true); d.dispose(); if (d.getReturnStatus() == ADialog.RET_OK) { int id = Integer.parseInt(curRow.get(0).toString()); CallableStatement proc = conn.prepareCall("{call rb_doc_types_update(?,?,?)}"); proc.setInt(1, id); proc.setString(2, p.get_Name()); proc.setString(3, p.getDescription()); proc.execute(); proc.close(); ArrayList newRow = new ArrayList(); newRow.add(id); newRow.add(p.get_Name()); newRow.add(p.getDescription()); return newRow; } else { return null; } }