package com.gym.control;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gym.pojo.BooklistE;
import com.gym.pojo.BooklistP;
import com.gym.pojo.Client;
import com.gym.pojo.Equipment;
import com.gym.pojo.Playground;
import com.gym.service.client.BookManager;
import com.gym.service.client.ClientManager;
import com.gym.service.client.DepartmentManager;
import com.gym.service.client.EquipmentManager;
import com.gym.service.client.PlaygroundManager;
public class BookAction extends HttpServlet {
PlaygroundManager playgroundManager = new PlaygroundManager();
EquipmentManager equipmentManager = new EquipmentManager();
BookManager bookManager = new BookManager();
DepartmentManager departmentManager = new DepartmentManager();
ClientManager clientManager = new ClientManager();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
this.doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String action = request.getParameter("action");
/**
* 用户权限判断,如果没有管理员登陆,将跳转到error.jsp页面里
*/
if(request.getSession().getAttribute("type")==null ||
request.getSession().getAttribute("username")==null)
{
String errMsg = "很抱歉,您没有权限执行该操作,请先登陆!";
request.setAttribute("errMsg", errMsg);
request.getRequestDispatcher("/client/error.jsp").forward(request, response);
return ;
}
if(action==null || action.equals(""))
{
action = "indexClient";
}
if(action.equals("indexClient"))
{
request.getRequestDispatcher("/client/index.jsp").forward(request, response);
}
//列出我的所有预约信息
if(action.equals("myBookList"))
{
String username = (String)request.getSession().getAttribute("username");
Client client = clientManager.findByClientName(username);
List bookListP = bookManager.playgroundBookByClientName(username);
List bookListE = bookManager.equipmentBookByClientName(username);
request.setAttribute("client", client);
request.setAttribute("bookListP", bookListP);
request.setAttribute("bookListE", bookListE);
request.getRequestDispatcher("/client/myBookList.jsp").forward(request, response);
}
//查看我的某个预约的详细信息
if(action.equals("bookListDetail"))
{
String type = request.getParameter("type");
String username = (String)request.getSession().getAttribute("username");
int bookListId = Integer.parseInt(request.getParameter("bookListId"));
Client client = clientManager.findByClientName(username);
request.setAttribute("client", client);
if(type.equals("1"))
{
BooklistP bookp = bookManager.playgroundBookById(bookListId);
request.setAttribute("bookp", bookp);
request.setAttribute("type", type);
request.getRequestDispatcher("/client/bookDetail.jsp").forward(request, response);
}
else if(type.equals("2"))
{
BooklistE booke = bookManager.equipmentBookById(bookListId);
request.setAttribute("booke", booke);
request.setAttribute("type", type);
request.getRequestDispatcher("/client/bookDetail.jsp").forward(request, response);
}
else
{
String errMsg = "您提交的数据不正确,请重试!";
request.getRequestDispatcher("/client/error.jsp").forward(request, response);
}
}
//取消某个预约信息
if(action.equals("quitBook"))
{
String type = request.getParameter("type");
String username = (String)request.getSession().getAttribute("username");
int bookListId = Integer.parseInt(request.getParameter("bookListId"));
if(type.equals("1"))
{
BooklistP book = bookManager.playgroundBookById(bookListId);
if(!book.getClient().getClientName().equals(username))
{
String errMsg = "您没有权限取消本预约,请核对后再试!";
request.getRequestDispatcher("/client/error.jsp").forward(request, response);
}
else
{
bookManager.deleteBookListP(bookListId);
Client client = clientManager.findByClientName(username);
List bookListP = bookManager.playgroundBookByClientName(username);
List bookListE = bookManager.equipmentBookByClientName(username);
request.setAttribute("client", client);
request.setAttribute("bookListP", bookListP);
request.setAttribute("bookListE", bookListE);
request.getRequestDispatcher("/client/myBookList.jsp").forward(request, response);
}
}
else if(type.equals("2"))
{
BooklistE book = bookManager.equipmentBookById(bookListId);
if(!book.getClient().getClientName().equals(username))
{
String errMsg = "您没有权限取消本预约,请核对后再试!";
request.getRequestDispatcher("/client/error.jsp").forward(request, response);
}
else
{
bookManager.deleteBookListE(bookListId);
Client client = clientManager.findByClientName(username);
List bookListP = bookManager.playgroundBookByClientName(username);
List bookListE = bookManager.equipmentBookByClientName(username);
request.setAttribute("client", client);
request.setAttribute("bookListP", bookListP);
request.setAttribute("bookListE", bookListE);
request.getRequestDispatcher("/client/myBookList.jsp").forward(request, response);
}
}
else
{
String errMsg = "您提交的数据不正确,请重试!";
request.getRequestDispatcher("/client/error.jsp").forward(request, response);
}
}
//跳转到预约场地预约的页面
if(action.equals("bookPlayground"))
{
int playground_id = Integer.parseInt(request.getParameter("playground_id"));
Playground playground = playgroundManager.findById(playground_id);
List bookList = bookManager.findByPlaygroundId(playground_id);
List allDepartment = departmentManager.findAllDepartment();
request.setAttribute("playground", playground);
request.setAttribute("bookList", bookList);
request.setAttribute("allDepartment", allDepartment);
request.getRequestDispatcher("/client/bookPlayground.jsp").forward(request, response);
}
//场地预约处理程序
if(action.equals("bookPlaygroundDeal"))
{
int playground_id = Integer.parseInt(request.getParameter("playground_id"));
int year = Integer.parseInt(request.getParameter("year"));
int month = Integer.parseInt(request.getParameter("month"));
int day = Integer.parseInt(request.getParameter("day"));
int starttime = Integer.parseInt(request.getParameter("starttime"));
int endtime = Integer.parseInt(request.getParameter("endtime"));
String username = (String)request.getSession().getAttribute("username");
Calendar c = Calendar.getInstance();
Client client = clientManager.findByClientName(username);
Playground playground = playgroundManager.findById(playground_id);
Timestamp book_time = new Timestamp(c.get(Calendar.YEAR)-1900,c.get(Calendar.MONTH),c.get(Calendar.DAY_OF_MONTH),c.get(Calendar.HOUR_OF_DAY),c.get(Calendar.MINUTE),0,0);
Timestamp start_time = new Timestamp(year-1900,month-1,day,starttime,0,0,0);
Timestamp end_time = new Timestamp(year-1900,month-1,day,endtime,0,0,0);
if(bookManager.testBookPlayground(playground, book_time, start_time, end_time).equals("ok"))
{
BooklistP bkltp = new BooklistP(client,playground,book_time,start_time,end_time);
bookManager.saveBookListP(bkltp);
playground = playgroundManager.findById(playground_id);
List bookList = bookManager.findByPlaygroundId(playground_id);
List allDepar
没有合适的资源?快使用搜索试试~ 我知道了~
体育馆场地管理系统 JSP
共233个文件
class:54个
java:54个
jsp:42个
5星 · 超过95%的资源 需积分: 50 118 下载量 113 浏览量
2009-06-20
10:52:48
上传
评论 10
收藏 6.79MB RAR 举报
温馨提示
本人自己编写的,没有抄袭过程...初学者推荐 jsp+servlet+hibernate编写的体育馆场地管理系统 开发环境:Myeclipse 5.5或以上 运行环境:Mysql5.0+Tomcat5.5 有数据库源文件
资源推荐
资源详情
资源评论
收起资源包目录
体育馆场地管理系统 JSP (233个子文件)
BookAction.class 8KB
BookManager.class 6KB
ClientDAO.class 6KB
EquipmentDAO.class 6KB
PlaygroundDAO.class 6KB
ManagerDAO.class 5KB
BulletinDAO.class 5KB
DepartmentDAO.class 5KB
BooklistEDAO.class 5KB
BooklistPDAO.class 5KB
AdminBulletin.class 4KB
AbstractClient.class 4KB
InfoAction.class 4KB
RegisterAction.class 3KB
AdminInfo.class 3KB
AbstractEquipment.class 3KB
AbstractPlayground.class 3KB
AdminDepartment.class 3KB
PlaygroundAction.class 3KB
EquipmentAction.class 3KB
DepartmentManager.class 3KB
InfoManager.class 3KB
AbstractManager.class 3KB
InfoManager.class 2KB
HibernateSessionFactory.class 2KB
HibernateSessionFactory.class 2KB
BulletinManager.class 2KB
AbstractBooklistE.class 2KB
FilterEncoding.class 2KB
LoginAction.class 2KB
BulletinAction.class 2KB
AdminLogin.class 2KB
AbstractBooklistP.class 2KB
AbstractDepartment.class 2KB
AbstractBulletin.class 2KB
test.class 2KB
PlaygroundManager.class 2KB
EquipmentManager.class 1KB
RegisterManager.class 1KB
Client.class 1KB
LoginManager.class 1KB
LoginManager.class 1KB
Equipment.class 1KB
Playground.class 1KB
Manager.class 923B
BulletinManager.class 808B
BooklistE.class 761B
Department.class 721B
ClientManager.class 708B
BooklistP.class 698B
Bulletin.class 636B
DepartmentManager.class 540B
BaseHibernateDAO.class 490B
IBaseHibernateDAO.class 177B
.classpath 2KB
org.eclipse.wst.jsdt.ui.superType.container 49B
styles.css 3KB
styles.css 3KB
login.gif 5KB
img06.gif 1KB
img06.gif 1KB
img05.gif 565B
img05.gif 565B
img03.gif 407B
img03.gif 407B
img02.gif 379B
img02.gif 379B
img08.gif 365B
img08.gif 365B
img11.gif 276B
img11.gif 276B
img01.gif 161B
img01.gif 161B
img04.gif 161B
img04.gif 161B
img07.gif 109B
img07.gif 109B
img09.gif 108B
img09.gif 108B
spacer.gif 43B
spacer.gif 43B
hibernate3.jar 2.15MB
xerces-2.6.2.jar 987KB
javassist.jar 460KB
antlr-2.7.6.jar 433KB
jboss-archive-browsing.jar 404KB
mysql-connector-java-3.1.7-bin.jar 388KB
log4j-1.2.11.jar 342KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
hibernate-annotations.jar 259KB
jaxen-1.1-beta-7.jar 222KB
ehcache-1.2.3.jar 203KB
commons-collections-2.1.1.jar 171KB
xml-apis.jar 121KB
hibernate-entitymanager.jar 114KB
jaas.jar 102KB
hibernate-commons-annotations.jar 65KB
hibernate-validator.jar 60KB
ejb3-persistence.jar 49KB
共 233 条
- 1
- 2
- 3
cdsnmdl
- 粉丝: 75
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- apk.tw_LineLite_v8a_v.2.17.1_sign.apk
- Elasticsearch实战:构建高效搜索系统的秘诀.zip
- HTML+CSS+JS网页设计:从入门到精通.zip
- 数据库课程设计:从理论到实践的全面指南.zip
- Python闭包:深入理解与应用场景解析.zip
- Win64OpenSSL-3-3-0.exe
- 课高分程设计-基于C++实现的民航飞行与地图简易管理系统-南京航空航天大学
- 航天器遥测数据故障检测系统python源码+文档说明+数据库(课程设计)
- 北京航空航天大学操作系统课设+ppt+实验报告
- 基于Vue+Echarts实现风力发电机中传感器的数据展示监控可视化系统+源代码+文档说明(高分课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页