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

电子商务毕业论文 第17页

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

电子商务毕业论文 第17页
String sql="select userpoint from shop_user where id='"+userid+"'";
    try{
             DataBase db = new DataBase();
             db.connect();
             stmt = db.conn.createStatement ();
             rs=stmt.executeQuery(sql);
             if(rs.next())
               return rs.getInt("userpoint");
             else return 0;
        } catch (SQLException e){
         return 0;
        }

  }
  //根据用户积分,获得用户可以享受的折扣
  public float getUserRate(String userid)
  {
    int userPoint=this.getUserPoint(userid);
    int lerver=userPoint/100;
    switch (lerver)
    {
      case 0:return 1.0f;
      case 1:return 0.95f;
      case 2:return 0.90f;
      case 3:return 0.85f;
      case 4:return 0.80f;
      case 5:return 0.75f;
      default:return 0.75f;
    }

  }
  public String getGbk( String str) {
               try  {
                return new String(str.getBytes("ISO8859-1"));
                }catch (Exception e){
                  return str;
                  }
          }
  public int getPage() {    //显示的页码
                              return page;
                      }
                      public void setPage(int newpage) {
                              page = newpage;
                      }

                      public int getPageSize(){   //每页显示的CD数
                              return pageSize;
                      }
                      public void setPageSize(int newpsize) {
                              pageSize = newpsize;
                      }

                      public int getPageCount() {  //页面总数
                              return pageCount;
                      }
                      public void setPageCount(int newpcount) {
                              pageCount = newpcount;
                      }

                      public long getRecordCount() {
                              return recordCount;
                      }
                      public void setRecordCount(long newrcount) {
                              recordCount= newrcount;
                      }

                      public String getMessage() {
                              return message;
                      }

                      public void setMessage(String msg) {
                              message = msg;
                      }

                      public void setUserid(long uid) {
                              userid = uid;
                      }
                      public long getUserid() {
                              return userid;
                      }

                      public void setUserName(String uName) {
                              username = uName;
                      }

                      public String getUserName() {
                              return username;
                      }
                      public Vector getUserlist() {
                           return userlist;
                       }

};

Util包:
DataBase.java:
package cdshop.util;
/**
 * <p>数据库连接专用包 </p>
 * <p>Copyright: wxy Copyright (c) 2004</p>
 * <p>Company:CD Shop </p>
 * @by :wxy
 * @version 1.0
 */
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public class DataBase {
  public Connection conn;
  public Statement stmt;
  public ResultSet rs=null;
  public InitialContext ctx=null;
  DataSource ds = null;
  public String sqlStr="";

  public DataBase() {
    this.connect();
  }
 public boolean connect(){

   /*   try{
        Class.forName("org.gjt.mm.mysql.Driver").newInstance();
        String url ="jdbc:mysql://localhost/cdStore?user=wxy&useUnicode=true&characterEncoding=8859_1";
        conn=DriverManager.getConnection(url);
        stmt = conn.createStatement ();
       }catch(Exception ee){
        System.out.println("connect db error:"+ee.getMessage());
        return false;
       }
      */
     /* try{
       ctx = new InitialContext();
        if (ctx == null)
          throw new Exception("没有匹配的上下文环境");

        ds = (DataSource) ctx.lookup("java:comp/env/jdbc/SqlServermidp");
        if (ds == null)
          throw new Exception("没有匹配的数据库");
        conn = ds.getConnection();
        stmt=conn.createStatement();


      }catch(Exception ee){
       System.out.println("connect db error:"+ee.getMessage());
       return false;
      }
      */


       try{
       Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
       String url="jdbc:microsoft:sqlserver://localhost:1305;DatabaseName=cdstore";
       String user="sa";
       String password="sa";
       conn= DriverManager.getConnection(url,user,password);
       stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
     }catch(Exception ee){
     System.out.println("connect db error:"+ee.getMessage());
     return false;
    }      return true;
    }
 public void close()
 {

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

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

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