餐饮管理系统(核心代码)

上传人:宝路 文档编号:22187689 上传时间:2017-11-26 格式:DOC 页数:30 大小:522.35KB
返回 下载 相关 举报
餐饮管理系统(核心代码)_第1页
第1页 / 共30页
餐饮管理系统(核心代码)_第2页
第2页 / 共30页
餐饮管理系统(核心代码)_第3页
第3页 / 共30页
餐饮管理系统(核心代码)_第4页
第4页 / 共30页
餐饮管理系统(核心代码)_第5页
第5页 / 共30页
点击查看更多>>
资源描述

《餐饮管理系统(核心代码)》由会员分享,可在线阅读,更多相关《餐饮管理系统(核心代码)(30页珍藏版)》请在金锄头文库上搜索。

1、餐饮管理系统教学单位 长春工业大学 姓 名 岳继武 学 号 20093561 年 级 093306 专 业 软件工程 指导教师 刘寒梅 职 称 副教授 2013 年 03 月 01 日一、 数据库连接类构建(文件 DBconn.java)package com;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class DBconn private Con

2、nection con;private String classname=com.microsoft.jdbc.sqlserver.SQLServerDriver;private String url=jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=canyin;public Connection getCon() tryClass.forName(classname);con=DriverManager.getConnection(url,sa,);catch(Exception e)e.printStackTrace(System

3、.err);con=null;return con;public void closed()tryif(con!=null)con.close();catch(Exception e)e.printStackTrace(); /用于注册,添加public int GetCount(String SQL)tryConnection Con = getCon();Statement Smt = Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);int counts = Smt.execut

4、eUpdate(SQL);return counts;catch(SQLException e)System.out.println(失败!);return 0;/用于查询,登陆public ResultSet GetRs(String SQL)tryConnection Con = getCon();Statement Smt = Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);ResultSet Rs = Smt.executeQuery(SQL);return Rs;catch

5、(SQLException e)System.out.println(失败!);return null;/修改和删除public boolean executeUpdate(String sql) if (con = null) getCon();try Statement stmt = con.createStatement();int iCount = stmt.executeUpdate(sql);System.out.println(操作成功,所影响的记录数为 + String.valueOf(iCount); catch (SQLException e) System.out.pri

6、ntln(e.getMessage();System.out.println(executeUpdaterError!);return true;二、 中文字符处理类(文件 Char.java)package com;import java.io.UnsupportedEncodingException;public class Char public Char()/* 对字符进行转码处理* param str 要转码的字符串* return 编码后的字符串*/public String toString(String str)/ 转换字符String text = ;/ 判断要转码的字符串是

7、否有效if(str != null & !.equals(str)try / 将字符串进行编码处理text = new String(str.getBytes(iso8859-1),GB18030); catch (UnsupportedEncodingException e) e.printStackTrace();/ 返回后的字符串return text;三、 字符串过滤类(文件 DoString.java)package com;public class DoString private String getstr;private String checkstr;public DoStr

8、ing()public void setGetstr(String getstr)this.getstr=getstr;dostring();public String getGetstr()return this.getstr;public String getCheckstr()return this.checkstr;public void dostring()this.checkstr=this.getstr;this.checkstr=this.checkstr.replaceAll(&,&);this.checkstr=this.checkstr.replaceAll(;,);th

9、is.checkstr=this.checkstr.replaceAll(,);this.checkstr=this.checkstr.replaceAll(,);this.checkstr=this.checkstr.replaceAll(-,);this.checkstr=this.checkstr.replaceAll(,);this.checkstr=this.checkstr.replaceAll(/,);this.checkstr=this.checkstr.replaceAll(%, );四、 提示信息类(文件 PopDialog.java)package com;public

10、class PopDialog /*功能:返回弹出提示对话框并重定向网页到指定页面的字符串*message:指定要显示的提示信息*url:指定重定向到的页面*/public String messageBox(String message,String url)String str=alert(+message+);str=str+window.location.href=+url+;return str;五、 时间函数类(文件 Shijian.java)package com;import java.text.DateFormat;import java.util.Date;public c

11、lass Shijian public String showTodayTime()Date date=new Date();return DateFormat.getDateInstance().format(date); 六、 CSS 样式表(文件 style.css)body,td,th font-size: 12px;body background-image: url(./image/dw.gif);margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;body font-size: 12px;co

12、lor: #000000;a:link font-size: 12px;color: #000000;text-decoration: none;a:visited font-size: 12px;color: #000000;text-decoration: none;a:hover font-size: 12px;color: #0000FF;.style7 color: #FFFFE1七、 系统登录界面(login.jsp 和 login_chuli.jsp)核心代码:function check()/判断用户名是否为空if(form1.username.value=)alert(请输入

13、用户名!);form1.username.focus();return false;/判断密码是否为空if(form1.password.value=)alert(请输入密码!);form1.password.focus();return false; 账号:密码:权限:员工管理员 后台处理:alert(管理员登陆错误,请核实用户名和密码是否输入正确,重新输入);javascript:history.go(-1););Login_chuli.closed();/同上if(quanxian.equals(员工)String sql=select * from register where r_n

14、ame=+username+ and r_pass=+password+;ResultSet rs=Login_chuli.GetRs(sql);if(rs.next()session.setAttribute(id,+rs.getString(r_no) +);session.setAttribute(jibie,+quanxian+);session.setAttribute(yonghu,+username+);out.println(popDialog.messageBox(登录成功!,index.jsp);elseout.println(alert(员工登陆错误,请核实用户名和密码是

15、否输入正确,重新输入);javascript:history.go(-1););Login_chuli.closed();%八、 注册界面(文件 zhuce.jsp 和 zhuce_chuli.jsp)核心代码:function check()/判断 ID 是否为空if(form1.r_no.value=)alert(请输入编号!);form1.r_no.focus();return false;/判断用户名是否为空if(form1.r_name.value=)alert(请输入用户名!);form1.r_name.focus();return false;/判断密码是否为空if(form1.r_pas

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号