计算机毕业设计论文分享 计算机毕业论文范文(11)


String sql4 = "update admin set logintimes = logintimes+1 where username = '"+username+"' ";
DBO dbo = new DBO();
String pwd;
dbo.open();
try{
rs = dbo.executeQuery(sql);
if(rs.next()){
pwd = rs.getString("password");
if(pwd.trim().equals(md5password)){
dbo.executeUpdate(sql2);
dbo.executeUpdate(sql4);
return Constant.SUCCESS;
}
else{
dbo.executeUpdate(sql3);
return Constant.PASSWORD_ERROR;
}
}
else{
dbo.executeUpdate(sql3);
return Constant.NAME_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//查询管理员信息
public List getAdminInfo(String username){
String sql = "select * from admin where username='"+username+"' ";
DBO dbo = new DBO();
dbo.open();
list = new ArrayList();
try{
rs = dbo.executeQuery(sql);
rs.next();
list.add(rs.getString("username"));
list.add(rs.getInt("flag"));
list.add(rs.getInt("logintimes"));
list.add(date);
list.add(rs.getString("quanxian"));
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
//admin edit password
public int editPassword(String username,String oldpwd,String newpwd){
String sql="select * from admin where username = '"+username+"' and password = '"+oldpwd+"'";
String sql2="update admin set password = '"+newpwd+"' where username = '"+username+"'";
DBO dbo = new DBO();
dbo.open();
try{
rs = dbo.executeQuery(sql);
if(rs.next()){
int i = dbo.executeUpdate(sql2);
if(i == 1){
return Constant.SUCCESS;
}
else{
return Constant.SYSTEM_ERROR;
}
}
else{
return Constant.PASSWORD_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//add manager
public int addManager(String username,String password,String type,String isuse){
String sql = "insert into admin(username,password,creattime,flag,isuse,logintimes,quanxian) values('"+username+"','"+password+"','"+date+"','"+type+"','"+isuse+"','0','111')";
String sql2 = "select * from admin where username = '"+username+"'";
DBO dbo = new DBO();
dbo.open();
try{
rs = dbo.executeQuery(sql2);
if(rs.next()){
return Constant.SAME_NAME;
}
else{
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 manager
public int updateManager(String username,String password,String type,String isuse){
String sql;
if(password.equals("")){
sql = "update admin set flag = '"+type+"' ,isuse = '"+isuse+"' where username = '"+username+"'";
}
else{
sql = "update admin set password = '"+password+"' ,flag = '"+type+"' ,isuse = '"+isuse+"' where username = '"+username+"'";
}
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();
}
}
//get all manager
public List getAllManager(){
String sql = "select * from admin where flag !='1' order by id asc";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
List list2 = new ArrayList();

推荐阅读