计算机毕业设计论文分享 计算机毕业论文范文(12)


list2.add(rs.getInt(1));
list2.add(rs.getString(2));
list2.add(rs.getString(4));
list2.add(rs.getInt(5));
list2.add(rs.getInt(6));
list2.add(rs.getInt(7));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
//delete manager
public int delManager(int id){
String sql = "delete from admin where id = '"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1)return Constant.SUCCESS;
else return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//delete login note
public int delLog(int id[]){
DBO dbo=new DBO();
dbo.open();
try{
for(int i = 0;i<id.length;i++){
dbo.executeUpdate("delete from adminlog where id = '"+id[i]+"'");
}
return Constant.SUCCESS;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
}
package com.bean;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.util.Constant;
import com.util.DBO;
/**** @author Administrator**/
public class AfficheBean {
private ResultSet rs;
private List list;
private String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
//增加
public int addAffiche(String title,String content,String adder,String ifhide){
String sql = "insert into affiche (title,content,addtime,adder,ifhide) " +
"values ('"+title+"','"+content+"','"+date+"','"+adder+"','"+ifhide+"')";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1){
return Constant.SUCCESS;
}
else{
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// update affiche
public int updateAffiche(int id,String title,String content,String adder,String ifhide){
String sql = "update affiche set title = '"+title+"',content='"+content+"',addtime='"+date+"'," +
"adder='"+adder+"',ifhide='"+ifhide+"' where id = '"+id+"' ";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1){
return Constant.SUCCESS;
}
else{
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//delete affiche
public int delAffiche(int id[]){
DBO dbo = new DBO();
dbo.open();
try{
for(int i = 0;i<id.length;i++){
dbo.executeUpdate("delete from affiche where id = '"+id[i]+"'");
}
return Constant.SUCCESS;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//open.close affiche
public int hideAffiche(int id){
String sql = "update affiche set ifhide='1' where id='"+id+"'";
String sql2 = "update affiche set ifhide='0' where id='"+id+"'";
String sql3 = "select ifhide from affiche where id='"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
rs = dbo.executeQuery(sql3);
rs.next();
int i = rs.getInt(1);
if(i == 1){
int flag = dbo.executeUpdate(sql2);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}
else{
int flag = dbo.executeUpdate(sql);

推荐阅读