毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

电子商务毕业论文 第16页

更新时间:2009-3-9:  来源:毕业论文

电子商务网站毕业设计
     }
              user.setEmail(getGbk(email));
             String IP = request.getRemoteAddr();
             user.setRegIpAddress(IP);
             if (message.equals("")){
                  flag = true;
                  }
               return flag;
        }catch (Exception e){
            return flag;
            }
 }
 //查询商店所有的用户
public boolean get_alluser() throws Exception {
      sqlStr = "select count(*) from shop_user";    //取出记录数
      int rscount = pageSize;
      try{
        DataBase db = new DataBase();
        db.connect();
        stmt = db.conn.createStatement ();
        ResultSet rs1 = stmt.executeQuery(sqlStr);
        if (rs1.next()) recordCount = rs1.getInt(1);
        rs1.close();
        }catch (SQLException e){
          System.out.print("count:"+e.getMessage());
          return false;
        }
                                //设定有多少pageCount
        if (recordCount < 1)
           pageCount = 0;
        else
           pageCount = (int)(recordCount - 1) / pageSize + 1;
                                //检查查看的页面数是否在范围内
        if (page < 1)
           page = 1;
        else if (page > pageCount)
          page = pageCount;
          rscount = (int) recordCount % pageSize;  // 最后一页记录数
                                //sql为倒序取值
          sqlStr = "select  * from shop_user ";
          if (page == 1){
             sqlStr = sqlStr + " order by Id desc ";
             } else {
               sqlStr = "select top"+ pageSize+" from(select top "+(recordCount - pageSize * (page-1))+  sqlStr + " order by Id desc ))";
               }
        try{
          DataBase db = new DataBase();
          db.connect();
          stmt = db.conn.createStatement ();
          rs = stmt.executeQuery(sqlStr);
          userlist = new Vector();
          while (rs.next()){
                user user = new user();
                user.setId(rs.getLong("id"));
                user.setUserName(rs.getString("username"));
                user.setPassWord(rs.getString("password"));
                user.setNames(rs.getString("names"));
                user.setSex(rs.getString("sex"));
                user.setAddress(rs.getString("address"));
                user.setPhone(rs.getString("Phone"));
                user.setPost(rs.getString("post"));
                user.setEmail(rs.getString("email"));
                user.setRegTime(rs.getString("regtime"));
                user.setRegIpAddress(rs.getString("RegIpaddress"));
                user.setUserPoint(rs.getInt("userpoint"));
                userlist.addElement(user);
                }
                close();
                 return true;
            }catch (SQLException e){
              System.out.print(e.getMessage());
              return false;
              }


}
//修改用户
public boolean update(HttpServletRequest req) throws Exception {
if (getRequest(req)){
sqlStr = "update shop_user set ";
sqlStr = sqlStr + "username = '" + dataFormat.toSql(user.getUserName()) + "',";
sqlStr = sqlStr + "password = '" + dataFormat.toSql(user.getPassWord()) + "',";
sqlStr = sqlStr + "Names = '" + dataFormat.toSql(user.getNames()) + "',";
sqlStr = sqlStr + "sex = '" + dataFormat.toSql(user.getSex()) + "',";
sqlStr = sqlStr + "address = '" + dataFormat.toSql(user.getAddress()) + "',";
sqlStr = sqlStr + "phone = '" + dataFormat.toSql(user.getPhone()) + "',";
sqlStr = sqlStr + "post = '" + dataFormat.toSql(user.getPost()) + "',";
sqlStr = sqlStr + "Email = '" + dataFormat.toSql(user.getEmail()) + "' ";
sqlStr = sqlStr + " where id = '" + user.getId() + "'";
try{
                  DataBase db = new DataBase();
                  db.connect();
                  stmt = db.conn.createStatement ();
                  stmt.execute(sqlStr);
                  return true;
    } catch (SQLException e){
      return false;
       }
} else {
       return false;
       }

}
//删除用户
 public boolean delete( long aid ) throws Exception {
    sqlStr = "delete from shop_user where id = "  + aid ;
    try{
      DataBase db = new DataBase();
      db.connect();
      stmt = db.conn.createStatement ();
      stmt.execute(sqlStr);
      return true;
       }catch (SQLException e){
        System.out.println(e);
        return false;
        }
}
//查询指定id的用户,用于支持页面的查看详细资料请求
 public boolean  getUserinfo(long newid ) throws Exception {
    try{
      sqlStr="select  * from shop_user where Id = " + newid ;
      DataBase db = new DataBase();
      db.connect();
      stmt = db.conn.createStatement ();
      rs = stmt.executeQuery(sqlStr);
      userlist = new Vector();
      while (rs.next()){
        user.setId(rs.getLong("id"));
        System.out.print(rs.getLong("id"));
        user.setUserName(rs.getString("username"));
        user.setPassWord(rs.getString("password"));
        user.setNames(rs.getString("names"));
        user.setSex(rs.getString("sex"));
        user.setAddress(rs.getString("address"));
        user.setPhone(rs.getString("Phone"));
        user.setPost(rs.getString("post"));
        user.setEmail(rs.getString("email"));
        user.setRegTime(rs.getString("regtime"));
        user.setRegIpAddress(rs.getString("RegIpaddress"));
        user.setUserPoint(rs.getInt("userpoint"));
         userlist.addElement(user);
         }
         close();
         return true;
        }catch (Exception e){
          System.out.print(e.getMessage());
          return false;
        }
}
//修改用户积分
  public  boolean   updateUserPoint(String userid,int num)
  {
    String point=num+"";
    String sql="EXECUTE updateUserPoint "+userid+","+point;
    //String sql="update shop_user set userpoint=userpoint +"+num+" where id='"+userid+"'";
    try{
             DataBase db = new DataBase();
             db.connect();
             stmt = db.conn.createStatement ();
              System.out.println(sql);
             stmt.execute(sql);
             return true;
        } catch (SQLException e){
          System.out.println(e.toString());
         return false;
        }
  }
  //取得用户的积分
  public int getUserPoint(String userid)
  {

 << 上一页  [11] [12] [13] [14] [15] [16] [17] [18] [19] 下一页

电子商务毕业论文 第16页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。