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

电子商务毕业论文 第15页

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

电子商务网站毕业设计
num "+
                     " from allorder,cd,cdclass "+
                     "  where allorder.cdno=cd.id  "+
                     "  and cd.cdclass=cdclass.id "+
                     "  and cdclass.id='"+classid+"'"+
                     "  and cd.cdname like '%"+dataFormat.toUni(keyword)+"%' "+
                     "  group by cdname  "+
                     "  order by num desc ";
            }
          else
          {
            sql = "select top 100 cd.cdname cdname,sum(allorder.amount) num from allorder,cd " +
                    " where allorder.cdno=cd.id " +
                    " group by cdname " +
                    " order by num desc";
          }

         try{
             DataBase db = new DataBase();
             db.connect();
             stmt = db.conn.createStatement ();
             System.out.println(sql);
             rs=stmt.executeQuery(sql);
             while (rs.next())
                {
                   String [] result=new String[2];
                   result[0]=rs.getString("cdname");
                   result[1]=rs.getString("num");
                   al.add(result);
                 }
                   return al;
             } catch (Exception e){
                   System.out.println(e.getMessage());
                   return null;
             }

  }

}
op_user.java:
package cdshop.run;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @Singer not attributable
 * @version 1.0
 */
import java.sql.*;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import cdshop.util.*;
import cdshop.cd.*;

public class op_user extends DataBase{
        private user user = new user();                         //新的用户对象
        private javax.servlet.http.HttpServletRequest request;  //建立页面请求
        private Vector userlist;   //显示用户列表向量数组
        private int page = 1;     //显示的页码
        private int pageSize=8;     //每页显示的图书数
        private int pageCount =0;    //页面总数
        private long recordCount =0;           //查询的记录总数
        private String message = "";           //出错信息提示
        private String username = "";         //注册后返回的用户名
        private long userid = 0;        //注册后返回的用户ID

  public op_user() {
  }
  //添加新用户
  public boolean add(HttpServletRequest req) throws Exception {
        if (getRequest(req)) {
            DataBase db = new DataBase();
            db.connect();
            stmt = db.conn.createStatement ();
            sqlStr = "select * from shop_user where username = '" +
                      user.getUserName() +"'";
            sqlStr = "insert into shop_user (username,password,Names,sex,"+
                     "Address,Phone,Post,Email,RegTime,RegIpaddress) values ('";
            sqlStr = sqlStr + dataFormat.toSql(user.getUserName()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getPassWord()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getNames()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getSex()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getAddress()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getPhone()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getPost()) + "','";
            sqlStr = sqlStr + dataFormat.toSql(user.getEmail()) + "',GETDATE(),'";
            sqlStr = sqlStr + user.getRegIpAddress() + "')";
            try{
                stmt.executeUpdate(sqlStr);
                sqlStr = "select max(id) from shop_user where username = '" +
                         user.getUserName()+ "'";
                         rs = stmt.executeQuery(sqlStr);
                         while (rs.next()){
                              userid = rs.getLong(1);
                              }
                             close();
                             return true;
                }catch (Exception sqle){
                  System.out.print(sqle.getMessage());
                  return false;
                }
           } else{
            return false;
           }

  }
  //分析页面转递的参数
  public boolean getRequest(javax.servlet.http.HttpServletRequest newrequest) {
       boolean flag = false;
       try {
        request = newrequest;
        String ID = request.getParameter("userid");
        if (ID!=null ){
        userid = 0;
        try{
            userid = Long.parseLong(ID);
            user.setId(userid);
            }catch (Exception e){
                 message = message + "你要修改的用户号出错!";
            }
         }

         username = request.getParameter("username");
         if (username==null || username.equals("")){
              username = "";
              message = message + "用户名为空!";
              }
              user.setUserName(getGbk(username));
              String password = request.getParameter("passwd");
              if (password==null || password.equals("")){
                  password = "";
                  message = message + "密码为空!";
                  }
              String pwdconfirm = request.getParameter("passconfirm");
              if (!password.equals(pwdconfirm)){
                 message = message + "确认密码不相同!";
                 }
              user.setPassWord(getGbk(password));
              String names = request.getParameter("names");;
              if (names==null){
                   names = "";
                   }
              user.setNames(getGbk(names));
              String sex = request.getParameter("sex");
              user.setSex(getGbk(sex));
              String address = request.getParameter("address");
              if (address == null){
                   address = "";
                  }
              user.setAddress(getGbk(address));
              String post = request.getParameter("post");
              if (post == null){
                  post = "";
                 }
               user.setPost(getGbk(post));
              String phone = request.getParameter("phone");
              if (phone== null){
                  phone = "";
              }
             user.setPhone(phone);
             String email = request.getParameter("email");
             if (email == null){
                  email = "";

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

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

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