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<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);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// get one affiche to update
public List getOneAffiche(int id){
String sql = "select * from affiche where id = '"+id+"'";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
list.add(rs.getInt(1));
list.add(rs.getString(2));
list.add(rs.getString(3));
list.add(rs.getString(4));
list.add(rs.getString(5));
list.add(rs.getString(6));
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
//首页显示所有公告
public List getAllAffiche(){
String sql = "select id,content,addtime from affiche where ifhide='1' order by addtime desc ";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
List list2=new ArrayList();
list2.add(rs.getInt(1));
list2.add(rs.getString(2));
list2.add(rs.getString(3));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
// 后台显示所有公告
public List getAllAfficheManage(){
String sql = "select id,title,addtime,adder,ifhide from affiche order by addtime desc ";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
List list2=new ArrayList();
list2.add(rs.getInt("id"));
list2.add(rs.getString("title"));
list2.add(rs.getString("addtime"));
list2.add(rs.getString("adder"));
list2.add(rs.getInt("ifhide"));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
// 增加投票
public int addVote(String title,String ifhide ,String item1,String item2,String item3,String item4,String item5,String item6,
String tick1,String tick2 ,String tick3 ,String tick4,String tick5,String tick6 ){
String sql = "insert into vote ( title, ifhide , item1, item2, item3, item4,item5,item6,tick1, tick2 , tick3 , tick4,tick5,tick6,addtime ) " +
"values( '"+title+"', '"+ifhide+"' , '"+item1+"', '"+item2+"', '"+item3+"', '"+item4+"','"+item5+"','"+item6+"','"+tick1+"', '"+tick2+"' ," +
" '"+tick3+"' , '"+tick4+"' , '"+tick5+"' , '"+tick6+"' , '"+date+"' )";
DBO dbo = new DBO();
dbo.open();
try{
if(ifhide.equals("1")){
dbo.executeUpdate("update vote set ifhide='0' ");
}
int flag = dbo.executeUpdate(sql);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// 修改投票
public int updateVote(int id,String title,String ifhide ,String item1,String item2,String item3,String item4,String item5,String item6,
String tick1,String tick2 ,String tick3 ,String tick4,String tick5,String tick6 ){
String sql = "update vote set title='"+title+"', ifhide='"+ifhide+"' , item1='"+item1+"', item2='"+item2+"'," +
" item3='"+item3+"', item4='"+item4+"',item5='"+item5+"',item6='"+item6+"',tick1='"+tick1+"', tick2='"+tick2+"' ,tick3='"+tick3+"' , " +
"tick4='"+tick4+"',tick5='"+tick5+"',tick6='"+tick6+"' where id='"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
if(ifhide.equals("1")){
dbo.executeUpdate("update vote set ifhide='0' ");
}
int flag = dbo.executeUpdate(sql);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// 删除投票
public int delVote(int id){
String sql = "delete from vote where id='"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
int flag = dbo.executeUpdate(sql);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//查询某个投票修改
public List getVote(int id){
String sql = "select * from vote where id='"+id+"' ";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
list.add(rs.getInt(1));
list.add(rs.getString(2));
list.add(rs.getString(3));
list.add(rs.getString(4));
list.add(rs.getString(5));
list.add(rs.getString(6));
list.add(rs.getString(7));
list.add(rs.getString(8));
list.add(rs.getString(9));
list.add(rs.getString(10));
list.add(rs.getString(11));
list.add(rs.getString(12));
list.add(rs.getString(13));
list.add(rs.getString(14));
list.add(rs.getString(15));
list.add(rs.getString(16));
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
// 查询所有投票
public List getAllVote(){
String sql = "select * from vote order by id desc ";
DBO dbo = new DBO();
list = new ArrayList()
没有合适的资源?快使用搜索试试~ 我知道了~
169JSP社团管理系统 源码可运行
共643个文件
gif:196个
js:181个
jsp:90个
1星 需积分: 50 47 下载量 161 浏览量
2018-05-11
14:43:59
上传
评论 10
收藏 3.45MB ZIP 举报
温馨提示
169JSP社团管理系统采用java+mysql+jsp开发的一款社团管理系统,里面数据库已经设计好,代码也是全的,亲测可以运行
资源推荐
资源详情
资源评论
收起资源包目录
169JSP社团管理系统 源码可运行 (643个子文件)
class_upload.asp 6KB
class_upload.asp 6KB
commands.asp 5KB
upload.asp 3KB
connector.asp 3KB
io.asp 2KB
basexml.asp 2KB
config.asp 2KB
config.asp 2KB
util.asp 1KB
io.asp 836B
connector.aspx 1KB
upload.aspx 1KB
connector.cfm 11KB
spellchecker.cfm 6KB
upload.cfm 6KB
config.cfm 3KB
config.cfm 3KB
connector.cgi 4KB
AfficheBean.class 13KB
AdminBean.class 8KB
DBO.class 3KB
AdminServlet.class 3KB
MemberManageServlet.class 3KB
Common.class 2KB
Filter.class 987B
CheckCode.class 922B
Constant.class 674B
.classpath 1KB
org.eclipse.wst.common.component 538B
org.eclipse.wst.jsdt.ui.superType.container 49B
css.css 10KB
fck_editor.css 8KB
fck_editor.css 8KB
fck_editor.css 8KB
Admin_Style.css 6KB
Admin_Style.css 6KB
style.css 4KB
style.css 4KB
fck_internal.css 2KB
fck_dialog.css 2KB
fck_dialog.css 2KB
fck_dialog.css 2KB
fck_editorarea.css 2KB
browser.css 2KB
fck_dialog_common.css 2KB
fck_showtableborders_gecko.css 1KB
spellerStyle.css 888B
default.css 463B
MainBg.gif 25KB
MainBg.gif 25KB
banner.gif 19KB
fck_strip.gif 9KB
girl.gif 7KB
boy.gif 6KB
fck_strip.gif 4KB
fck_strip.gif 4KB
5.gif 4KB
4.gif 3KB
8.gif 3KB
11.gif 2KB
Key.gif 2KB
logo_fckeditor.gif 2KB
6.gif 2KB
10.gif 2KB
7.gif 2KB
zhuce.gif 2KB
Title.gif 2KB
1.gif 2KB
qq_22.gif 2KB
qq_22.gif 2KB
Title.gif 2KB
html.gif 1KB
htm.gif 1KB
logo.gif 1KB
rdp.gif 1KB
12.gif 1KB
back.gif 1KB
sub.gif 1KB
9.gif 1KB
3.gif 1KB
button.gif 1KB
13.gif 1KB
2.gif 1KB
ufopp.gif 1KB
ai.gif 1KB
embaressed_smile.gif 1KB
ip.gif 1KB
menu.gif 1KB
menu.gif 1KB
teeth_smile.gif 1KB
shades_smile.gif 1KB
sys.gif 1KB
sys.gif 1KB
tounge_smile.gif 1KB
wink_smile.gif 1KB
sad_smile.gif 1KB
regular_smile.gif 1KB
whatchutalkingabout_smile.gif 1KB
envelope.gif 1KB
共 643 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- bgf_me2019-01-01用不了,报了很多错误
凌研研
- 粉丝: 18
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功