rs = stmt.executeQuery(sqlStr);
order_list = new Vector();
while (rs.next()) {
allorder identlist = new allorder();
identlist.setId(rs.getLong("id"));
identlist.setOrderId(rs.getLong("orderId"));
identlist.setcdNo(rs.getLong("cdNo"));
identlist.setAmount(rs.getInt("Amount"));
order_list.addElement(identlist);
}
close();
return true;
}
catch (SQLException e) {
System.out.print(e.getMessage());
return false;
}
}
/**
* 修改订单,修改付款标志
* @param res
* @return
*/
public boolean update(HttpServletRequest res) {
request = res;
int payoff = 1;
int sales = 1;
//long orderId = 0;
try {
System.out.println("payoff:"+request.getParameter("payoff"));
payoff = Integer.parseInt(request.getParameter("payoff"));
sales = Integer.parseInt(request.getParameter("sales"));
orderId =request.getParameter("indentid");
sqlStr = "update orders set IsPayoff = '" + payoff + "',IsSales='" +
sales + "' where orderId =" + orderId;
DataBase db = new DataBase();
db.connect();
stmt = db.conn.createStatement ();
System.out.print(sqlStr);
stmt.execute(sqlStr);
return true;
}
catch (Exception e) {
System.out.print(e.getMessage());
return false;
}
}
/**
* 删除订单
* @param id
* @return
*/
public boolean delete(long id) {
try {
DataBase db = new DataBase();
db.connect();
stmt = db.conn.createStatement ();
sqlStr = "delete from allorder where id =" + id;
stmt.execute(sqlStr);
sqlStr = "delete from orders where id= " + id;
stmt.execute(sqlStr);
return true;
}
catch (SQLException e) {
return false;
}
}
}
op_cd.java类:
package cdshop.run;
/**
* <p>管理CD的类,包括CD的修改、查询,删除,添加 </p>
*/
import java.sql.*;
import java.util.Vector;
import cdshop.util.*;
import cdshop.cd.*;
import javax.servlet.http.HttpServletRequest;
public class op_cd extends DataBase{
private cd acds = new cd(); //新的CD类
private javax.servlet.http.HttpServletRequest request; //建立页面请求
private boolean sqlflag = true ; //对接收到的数据是否正确
private Vector cdlist; //显示CD列表向量数组
private int page = 1; //显示的页码
private int pageSize=10; //每页显示的CD数
private int pageCount =0; //页面总数
private long recordCount =0; //查询的记录总数
public String sqlStr="";
public Vector getcdlist() {
return cdlist;
}
public boolean getSqlflag() {
return sqlflag;
}
public String to_String( String str) {
try
{
return new String(str.getBytes("ISO8859-1"));
}
catch (Exception e)
{
return str;
}
}
/**
* 将页面表单传来的资料分解
*/
public boolean getRequest(javax.servlet.http.HttpServletRequest newrequest) {
boolean flag = false;
try{
request = newrequest;
String ID = request.getParameter("id");
long cdid = 0;
try{
cdid = Long.parseLong(ID);
}catch (Exception e){
}
acds.setId(cdid);
String cdname = request.getParameter("cdname");
if (cdname==null || cdname.equals(""))
{
cdname = "";
sqlflag = false;
}
acds.setcdName(to_String(cdname));
String Singer = request.getParameter("Singer");
if (Singer==null || Singer.equals(""))
{
Singer = "";
sqlflag = false;
}
acds.setSinger(to_String(Singer));
String publish = request.getParameter("publish");;
if (publish==null)
{
publish = "";
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] 下一页