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; /** * 网站公告、站内调查bean 会员中心公告 * @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