package com.chapter15;
import java.util.*;
import java.sql.*;
import java.text.*;
public class User extends ExecuteDB
{
//定义类成员变量
private long UserID;
private String UserName;
private String UserPassword;
private String RealName;
private long DepartmentID;
private String Sex;
private String Degree;
private String BornDate;
private String UserSN;
private String Telephone;
private String Mobile;
private String Email;
private String InDate;
private String Intro;
private String Role;
private String strSql;
//初始化类成员变量
public User()
{
this.UserID=0;
this.UserName="";
this.UserPassword="";
this.RealName="";
this.DepartmentID=0;
this.Sex="";
this.Degree="";
this.BornDate = "";
this.UserSN="";
this.Telephone="";
this.Mobile="";
this.Email="";
this.InDate= "";
this.Intro="";
this.Role="0";
this.strSql="";
}
//向users数据表中添加一条新记录
public boolean add()
{
this.strSql="insert into users ";
this.strSql=this.strSql + "(";
this.strSql=this.strSql + "UserName,";
this.strSql=this.strSql + "UserPassword,";
this.strSql=this.strSql + "RealName,";
this.strSql=this.strSql + "DepartmentID,";
this.strSql=this.strSql + "Sex,";
this.strSql=this.strSql + "Degree,";
this.strSql=this.strSql + "BornDate,";
this.strSql=this.strSql + "UserSN,";
this.strSql=this.strSql + "Telephone,";
this.strSql=this.strSql + "Mobile,";
this.strSql=this.strSql + "Email,";
this.strSql=this.strSql + "InDate,";
this.strSql=this.strSql + "Intro,";
this.strSql=this.strSql + "Role";
this.strSql=this.strSql + ") ";
this.strSql=this.strSql + "values(";
this.strSql=this.strSql + "'" + this.UserName + "',";
this.strSql=this.strSql + "'" + this.UserPassword + "',";
this.strSql=this.strSql + "'" + this.RealName + "',";
this.strSql=this.strSql + "'" + this.DepartmentID + "',";
this.strSql=this.strSql + "'" + this.Sex + "',";
this.strSql=this.strSql + "'" + this.Degree + "',";
this.strSql=this.strSql + "'" + this.BornDate + "',";
this.strSql=this.strSql + "'" + this.UserSN + "',";
this.strSql=this.strSql + "'" + this.Telephone + "',";
this.strSql=this.strSql + "'" + this.Mobile + "',";
this.strSql=this.strSql + "'" + this.Email + "',";
this.strSql=this.strSql + "'" + this.InDate + "',";
this.strSql=this.strSql + "'" + this.Intro + "',";
this.strSql=this.strSql + "'" + this.Role + "'";
this.strSql=this.strSql + ")";
boolean isAdd = super.exeSql(this.strSql);
return isAdd;
}
//修改UserID对应的用户的信息
public boolean modify_info()
{
this.strSql="update users set";
this.strSql=this.strSql + " RealName=" + "'" + this.RealName + "',";
this.strSql=this.strSql + " DepartmentID=" + "'" + this.DepartmentID + "',";
this.strSql=this.strSql + " Sex=" + "'" + this.Sex + "',";
this.strSql=this.strSql + " Degree=" + "'" + this.Degree + "',";
this.strSql=this.strSql + " BornDate=" + "'" + this.BornDate + "',";
this.strSql=this.strSql + " UserSN=" + "'" + this.UserSN + "',";
this.strSql=this.strSql + " Telephone=" + "'" + this.Telephone + "',";
this.strSql=this.strSql + " Mobile=" + "'" + this.Mobile + "',";
this.strSql=this.strSql + " Email=" + "'" + this.Email + "',";
this.strSql=this.strSql + " InDate=" + "'" + this.InDate + "',";
this.strSql=this.strSql + " Intro=" + "'" + this.Intro + "'";
this.strSql=this.strSql + " where UserID='" + this.UserID + "'";
boolean isUpdate = super.exeSql(this.strSql);
return isUpdate;
}
//修改UserID对应的用户的密码
public boolean modify_UserPassword()
{
this.strSql="update users set ";
this.strSql=this.strSql + "UserPassword=" + "'" + this.UserPassword + "'";
this.strSql=this.strSql + " where UserID='" + this.UserID + "'";
boolean isUpdatekey = super.exeSql(this.strSql);
return isUpdatekey;
}
//验证用户名和密码是否正确
public boolean valid()
{
this.strSql="select UserID,UserName,Role from `users` ";
this.strSql=this.strSql + " where UserName='" + this.UserName + "'";
this.strSql=this.strSql + " and UserPassword='"+ this.UserPassword + "'";
try
{
ResultSet rs = super.exeQuery(this.strSql);
if (rs.next())
{
this.UserID=rs.getLong("UserID");
this.UserName=rs.getString("UserName");
this.Role = rs.getString("Role");
return true;
}
else
{
return false;
}
}
catch(Exception e)
{
return false;
}
}
//判断用户名是否存在
public boolean exist()
{
this.strSql="select * from users ";
this.strSql=this.strSql + " where UserName='" + this.UserName + "'";
try
{
ResultSet rs = super.exeQuery(this.strSql);
if (rs.next())
{
return true;
}
else
{
return false;
}
}
catch(Exception e)
{
return false;
}
}
//获取类成员变量UserID对应的用户信息
public boolean init()
{
this.strSql="select * from users where UserID=";
this.strSql=this.strSql + this.UserID;
try
{
ResultSet rs = super.exeQuery(this.strSql);
if (rs.next())
{
this.UserID=rs.getLong("UserID");
this.UserName=rs.getString("UserName");
this.UserPassword=rs.getString("UserPassword");
this.RealName=rs.getString("RealName");
this.DepartmentID=rs.getLong("DepartmentID");
this.Sex=rs.getString("Sex");
this.Degree=rs.getString("Degree");
this.BornDate=rs.getString("BornDate");
this.UserSN=rs.getString("UserSN");
this.Telephone=rs.getString("Telephone");
this.Mobile=rs.getString("Mobile");
this.Email=rs.getString("Email");
this.InDate=rs.getString("InDate");
this.Intro=rs.getString("Intro");
this.Role=rs.getString("Role");
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
return false;
}
}
//获取类UserName对应的用户信息
public boolean init_byUserName()
{
this.strSql="select * from users where UserName like ";
this.strSql=this.strSql + "'" + this.UserName + "'";
try
{
ResultSet rs = super.exeQuery(this.strSql);
if (rs.next())
{
this.UserID=rs.getLong("UserID");
this.UserName=rs.getString("UserName");
this.UserPassword=rs.getString("UserPassword");
this.RealName=rs.getString("RealName");
this.DepartmentID=rs.getLong("DepartmentID");
this.Sex=rs.getString("Sex");
this.Degree=rs.getString("Degree");
this.BornDate=rs.getString("BornDate");
this.UserSN=rs.getString("UserSN");
this.Telephone=rs.getString("Telephone");
this.Mobile=rs.getString("Mobile");
this.Email=rs.getString("Email");
this.InDate=rs.getString("InDate");
this.Intro=rs.getString("Intro");
this.Role=rs.getString("Role");
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
return false;
}
}
//获取成员变量DepartmentID对应的部门的所有人员信息,返回一个ResultSet类型对象
public ResultSet show_department_users()
{
this.strSql="select * from users where DepartmentID ="+this.DepartmentID;
ResultSet rs = null;
try
{
rs = super.exeQuery(this.strSql);
}
catch(Exception e)
{
System.out.println(e.toString());
}
return rs;
}
//获取所有人员信息,返回一个ResultSet类型对象
public ResultSet show_users()
{
this.strSql="select UserID,UserName,RealName,DepartmentID,UserSN from users where Role = 0 order by UserSN desc";
ResultSet rs = null;
try
{
rs = super.exeQuery(this.strSql);
}
catch(Exception e)
{
System.out.println
没有合适的资源?快使用搜索试试~ 我知道了~
JSP动态网站开发技术与实践光盘素材13-15
共189个文件
jsp:96个
jar:28个
class:21个
1星 需积分: 7 31 下载量 132 浏览量
2008-12-05
10:22:18
上传
评论 1
收藏 6.06MB RAR 举报
温馨提示
JSP动态网站开发技术与实践光盘素材13-15
资源推荐
资源详情
资源评论
收起资源包目录
JSP动态网站开发技术与实践光盘素材13-15 (189个子文件)
User.class 8KB
Movie.class 5KB
User.class 5KB
Ware.class 5KB
User.class 4KB
Email.class 4KB
Notice.class 4KB
Goods.class 3KB
Department.class 3KB
Words.class 3KB
Words.class 2KB
Sort.class 2KB
SplitPage.class 2KB
SplitPage.class 2KB
SplitPage.class 2KB
ExecuteDB.class 1KB
ExecuteDB.class 1KB
ExecuteDB.class 1KB
ConnectDB.class 1KB
ConnectDB.class 1KB
ConnectDB.class 1KB
movie.css 446B
ware.css 446B
enterprise.css 446B
00000000000000.gif 1KB
fullscreen.gif 309B
add_movie_form.html 2KB
user_reg_form.html 2KB
search_movie_form.html 1KB
user_reg_form.html 1KB
index.html 1KB
add_notice_form.html 1KB
add_department_form.html 660B
get_password_form.html 479B
get_password_form.html 478B
get_password_form.html 470B
xercesImpl.jar 1.17MB
xercesImpl.jar 1.17MB
mysql-connector-java-3.1.11-bin.jar 430KB
mysql-connector-java-3.1.11-bin.jar 430KB
mysql-connector-java-3.1.11-bin.jar 430KB
mail.jar 339KB
mail.jar 339KB
serializer.jar 272KB
serializer.jar 272KB
xml-apis.jar 190KB
xml-apis.jar 190KB
mailapi.jar 174KB
mailapi.jar 174KB
xercesSamples.jar 162KB
xercesSamples.jar 162KB
jdom.jar 150KB
jdom.jar 150KB
resolver.jar 82KB
resolver.jar 82KB
activation.jar 54KB
activation.jar 54KB
smtp.jar 23KB
smtp.jar 23KB
pop3.jar 20KB
pop3.jar 20KB
jspSmartUpload.jar 15KB
jspSmartUpload.jar 15KB
jspSmartUpload.jar 15KB
User.java 12KB
User.java 7KB
Movie.java 7KB
Ware.java 6KB
User.java 6KB
Email.java 5KB
Notice.java 5KB
Goods.java 4KB
Department.java 3KB
Words.java 3KB
Words.java 3KB
Sort.java 3KB
SplitPage.java 2KB
SplitPage.java 2KB
SplitPage.java 2KB
ExecuteDB.java 1KB
ExecuteDB.java 1KB
ExecuteDB.java 1KB
ConnectDB.java 952B
ConnectDB.java 952B
ConnectDB.java 952B
movie_detail.jsp 5KB
view_movie.jsp 5KB
ware_detail.jsp 5KB
info_management.jsp 5KB
user_management.jsp 5KB
notice_management.jsp 4KB
movie_list.jsp 4KB
goods_management.jsp 4KB
ware_management.jsp 4KB
modify_user_form.jsp 4KB
ware_list.jsp 4KB
notice_list.jsp 4KB
movie_management.jsp 4KB
search_movie_result.jsp 3KB
get_password_do.jsp 3KB
共 189 条
- 1
- 2
资源评论
- huzhancheng2012-07-24缺少源文件,根本无法运行啊,数据库也没有,只有jsp,js,等页面文件
danxing1981
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 常用工具集参考用于图像等数据处理
- 音乐展示网页、基于Stenography的图像数字水印添加与提取,以及基于颜色矩和Tamura算法的图像相似度评估算法py源码
- 基于EmguCV(OpenCV .net封装),图像数字水印加解密算法的实现,其中包含最低有效位算法,离散傅里叶变换算法+文档书
- 基于matlab+DWT的图像水印项目,数字水印+源代码+文档说明+图片+报告pdf
- (优秀毕业设计)基于python实现的数字图像可视化水印系统的设计与实现,多种数字算法实现+源代码+文档说明+理论演示pdf
- 基于DWT-DCT-SVD和deflate压缩的数字水印方法python源码+Gui界面+演示视频(高分毕业设计)
- 基于matlab实现DWT、DCT、SVD算法数字图像水印可视化系统+GUI界面+文档说明+详细注释(高分毕业设计)
- NCIAE-Data-Structure大一大二笔记
- 学习wireshark笔记
- digital-image-数据可视化笔记
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功