餐饮管理系统核心代码.docx

上传人:b****6 文档编号:2923542 上传时间:2022-11-16 格式:DOCX 页数:38 大小:321.84KB
下载 相关 举报
餐饮管理系统核心代码.docx_第1页
第1页 / 共38页
餐饮管理系统核心代码.docx_第2页
第2页 / 共38页
餐饮管理系统核心代码.docx_第3页
第3页 / 共38页
餐饮管理系统核心代码.docx_第4页
第4页 / 共38页
餐饮管理系统核心代码.docx_第5页
第5页 / 共38页
点击查看更多>>
下载资源
资源描述

餐饮管理系统核心代码.docx

《餐饮管理系统核心代码.docx》由会员分享,可在线阅读,更多相关《餐饮管理系统核心代码.docx(38页珍藏版)》请在冰豆网上搜索。

餐饮管理系统核心代码.docx

餐饮管理系统核心代码

餐饮管理系统

 

教学单位长春工业大学

姓名岳继武

学号20093561

年级093306

专业软件工程

指导教师刘寒梅

职称副教授

2013年03月01日

一、数据库连接类构建(文件DBconn.java)

packagecom;

importjava.sql.Connection;

importjava.sql.DriverManager;

importjava.sql.ResultSet;

importjava.sql.SQLException;

importjava.sql.Statement;

publicclassDBconn{

privateConnectioncon;

privateStringclassname="com.microsoft.jdbc.sqlserver.SQLServerDriver";

privateStringurl="jdbc:

microsoft:

sqlserver:

//localhost:

1433;DatabaseName=canyin";

publicConnectiongetCon(){

try{

Class.forName(classname);

con=DriverManager.getConnection(url,"sa","");

}

catch(Exceptione){

e.printStackTrace(System.err);

con=null;

}

returncon;

}

publicvoidclosed(){

try{

if(con!

=null)con.close();

}

catch(Exceptione){e.printStackTrace();}

}

//用于注册,添加

publicintGetCount(StringSQL){

try

{

ConnectionCon=getCon();

StatementSmt=Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

intcounts=Smt.executeUpdate(SQL);

returncounts;

}

catch(SQLExceptione)

{

System.out.println("失败!

");

return0;

}

}

//用于查询,登陆

publicResultSetGetRs(StringSQL){

try

{

ConnectionCon=getCon();

StatementSmt=Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

ResultSetRs=Smt.executeQuery(SQL);

returnRs;

}

catch(SQLExceptione)

{

System.out.println("失败!

");

returnnull;

}

}

//修改和删除

publicbooleanexecuteUpdate(Stringsql){

if(con==null){

getCon();

}

try{

Statementstmt=con.createStatement();

intiCount=stmt.executeUpdate(sql);

System.out.println("操作成功,所影响的记录数为"+String.valueOf(iCount));

}catch(SQLExceptione){

System.out.println(e.getMessage());

System.out.println("executeUpdaterError!

");

}

returntrue;

}

}

二、中文字符处理类(文件Char.java)

packagecom;

importjava.io.UnsupportedEncodingException;

publicclassChar{

publicChar(){

}

/**

*对字符进行转码处理

*@paramstr要转码的字符串

*@return编码后的字符串

*/

publicStringtoString(Stringstr){

//转换字符

Stringtext="";

//判断要转码的字符串是否有效

if(str!

=null&&!

"".equals(str)){

try{

//将字符串进行编码处理

text=newString(str.getBytes("iso8859-1"),"GB18030");

}catch(UnsupportedEncodingExceptione){

e.printStackTrace();

}

}

//返回后的字符串

returntext;

}

}

三、字符串过滤类(文件DoString.java)

packagecom;

publicclassDoString{

privateStringgetstr;

privateStringcheckstr;

publicDoString(){}

publicvoidsetGetstr(Stringgetstr){

this.getstr=getstr;

dostring();

}

publicStringgetGetstr(){

returnthis.getstr;

}

publicStringgetCheckstr(){

returnthis.checkstr;

}

publicvoiddostring(){

this.checkstr=this.getstr;

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(">",">");

this.checkstr=this.checkstr.replaceAll("--","");

this.checkstr=this.checkstr.replaceAll("\"\"",""");

this.checkstr=this.checkstr.replaceAll("/","");

this.checkstr=this.checkstr.replaceAll("%","");

}

}

四、提示信息类(文件PopDialog.java)

packagecom;

publicclassPopDialog{

/*****************************

*功能:

返回弹出提示对话框并重定向网页到指定页面的字符串

*message:

指定要显示的提示信息

*url:

指定重定向到的页面

******************************/

publicStringmessageBox(Stringmessage,Stringurl){

Stringstr="alert('"+message+"');";

str=str+"window.location.href='"+url+"';";

returnstr;

}

}

五、时间函数类(文件Shijian.java)

packagecom;

importjava.text.DateFormat;

importjava.util.Date;

publicclassShijian{

publicStringshowTodayTime(){

Datedate=newDate();

returnDateFormat.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;

color:

#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)

核心代码:

functioncheck(){

//判断用户名是否为空

if(form1.username.value==""){

alert("请输入用户名!

");form1.username.focus();returnfalse;

}

//判断密码是否为空

if(form1.password.value==""){

alert("请输入密码!

");form1.password.focus();returnfalse;

}

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 调查报告

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1