亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cdstore.java

?? 用jsp,tomcat,mysql
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
    PreparedStatement prepStmt=null;
    ResultSet rs =null;
    try {
      con=getConnection();
      String selectStatement = "select * " + "from customer where username = ? ";
      prepStmt = con.prepareStatement(selectStatement);
      prepStmt.setString(1, cdId);
      rs = prepStmt.executeQuery();

      if (rs.next()) {
        Customer bd = new Customer(rs.getString(1), rs.getString(2), rs.getInt(3),rs.getString(4), rs.getString(5)
          );
        prepStmt.close();

        return bd;
      }
      else {
        return null;
      }
    }finally{
      closeResultSet(rs);
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
  }
  
  
  public boolean deleteCd (String cdId) throws Exception {
    Connection con=null;
    PreparedStatement prepStmt=null;
   
    try {
      con=getConnection();
      String updateStatement = " delete from cd where id = ? ";

      prepStmt = con.prepareStatement(updateStatement);
      prepStmt.setString(1, cdId);
      prepStmt.executeUpdate();
      prepStmt.close();

      return true;
      

    }finally{
 
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
  }
    
  public boolean deleteUser (String cdId) throws Exception {
    Connection con=null;
    PreparedStatement prepStmt=null;
   
    try {
      con=getConnection();
      String updateStatement = " delete from customer where username = ? ";

      prepStmt = con.prepareStatement(updateStatement);
      prepStmt.setString(1, cdId);
      prepStmt.executeUpdate();
      prepStmt.close();

      return true;
      

    }finally{
 
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
  }
  
 public boolean deleteOrder (String cdId) throws Exception {
    Connection con=null;
    PreparedStatement prepStmt=null;
   
    try {
      con=getConnection();
      String updateStatement = " delete from cdorder where id = "+cdId+" ";

      prepStmt = con.prepareStatement(updateStatement);
      
      prepStmt.executeUpdate();
      prepStmt.close();

      return true;
      

    }finally{
 
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
  }
  

  public void buyCds(ShoppingCart cart,String username,String thedate)throws Exception {
    Connection con=null;
    Collection items = cart.getItems();
    Iterator i = items.iterator();
    try {
      con=getConnection();
      con.setAutoCommit(false);
      while (i.hasNext()) {
        ShoppingCartItem sci = (ShoppingCartItem)i.next();
        CdDetails bd = (CdDetails)sci.getItem();
        String id = bd.getCdId();
        int quantity = sci.getQuantity();
        buyCd(id, quantity,con,username,thedate);
      }
      con.commit();
      con.setAutoCommit(true);

    } catch (Exception ex) {
      con.rollback();
      throw ex;
    }finally{
       closeConnection(con);
    }
  }


  public void buyCd(String cdId, int quantity,Connection con,String username ,String thedate) throws Exception {
    PreparedStatement prepStmt=null;
    ResultSet rs=null;
    String cdname;
    
    try{
      String selectStatement = "select * " + "from cd where id = ? ";
      prepStmt = con.prepareStatement(selectStatement);
      prepStmt.setString(1, cdId);
      rs = prepStmt.executeQuery();
      cdname=getCdDetails(cdId).getTitle();
 

      if (rs.next()) {
          prepStmt.close();
          
          String updateStatement =
                  "update cd set saleamount = saleamount + ? where id = ?";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.setInt(1, quantity);
          prepStmt.setString(2, cdId);
          prepStmt.executeUpdate();
          String updateStatement1 =
                  "update cd set warehouse = warehouse - ? where id = ?";
          prepStmt = con.prepareStatement(updateStatement1);
          prepStmt.setInt(1, quantity);
          prepStmt.setString(2, cdId);
          prepStmt.executeUpdate();
          prepStmt.close();
          String insertStatement =
                  "insert into  account (username,cdname,saleAmount,thedate) values('"+username+"','"+cdname+"',"+quantity+",'"+thedate+"')";
          prepStmt = con.prepareStatement(insertStatement);
          prepStmt.executeUpdate();
          prepStmt.close();
      
       }

    }catch (SQLException e) 
{
			e.printStackTrace();
}finally{
      closeResultSet(rs);
      closePrepStmt(prepStmt);
    }
  }
  
public boolean checkMemberExist(String username) throws Exception {
		Connection con=null;
    PreparedStatement prepStmt=null;
    ResultSet rs =null;
    try {
      con=getConnection();
      String selectStatement = "select * from customer where username='" + username + "'";
      prepStmt = con.prepareStatement(selectStatement);
      rs = prepStmt.executeQuery();

		
		if(rs==null)return false;

		if (rs.next())
			return true;}
		 catch (SQLException e) {
			e.printStackTrace();
		}finally{
      closeResultSet(rs);
      closePrepStmt(prepStmt);
      closeConnection(con);
		}
		return false;

	}
public boolean addUser(Customer customer) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    con=getConnection();
    try{        
          String updateStatement =
                  "insert into customer values('"+customer.getUsername()+"','"+customer.getPassword()+"',0,'"+customer.getTel()+"','"+customer.getEmail()+"')";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;}
catch (SQLException e) 
{
			e.printStackTrace();
			return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
 
 public boolean addOrder(Order order) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    con=getConnection();
    try{        
          String updateStatement =
                  "insert into cdorder (username,name,amount,thedate,isorder) values('"+order.getUsername()+"','"+order.getName()+"','"+order.getAmount()+"','"+order.getThedate()+"','1')";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;}
catch (SQLException e) 
{
			e.printStackTrace();
			return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
	
public boolean verifyUser (String username,String password) throws Exception {
    Connection con=null;
    PreparedStatement prepStmt=null;
    ResultSet rs =null;
    try {
      con=getConnection();
      String selectStatement = "select * from customer where username='" + username + "'and password='"+password+"' and isadmin=0";
      prepStmt = con.prepareStatement(selectStatement);
      rs = prepStmt.executeQuery();
      if (rs.next())
      return true;
        } 
    catch (SQLException e) {
        
            e.printStackTrace();
        }finally{
      closeResultSet(rs);
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
		return false;
	}
	
		
public boolean verifyAdmin (String username,String password) throws Exception {
    Connection con=null;
    PreparedStatement prepStmt=null;
    ResultSet rs =null;
    try {
      con=getConnection();
      String selectStatement = "select * from customer where username='" + username + "'and password='"+password+"' and isadmin=1";
      prepStmt = con.prepareStatement(selectStatement);
      rs = prepStmt.executeQuery();
      if (rs.next())
      return true;
        } 
    catch (SQLException e) {
        
            e.printStackTrace();
        }finally{
      closeResultSet(rs);
      closePrepStmt(prepStmt);
      closeConnection(con);
    }
		return false;
	}
	
 public boolean updateCd(String cdId,String title,String name,String description,String saletype,String warehouse,String price ,String year ,String saleamount) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    ResultSet rs=null;
    try{
    	con=getConnection();
      String selectStatement = "select * " + "from cd where id = ? ";
      prepStmt = con.prepareStatement(selectStatement);
      prepStmt.setString(1, cdId);
      rs = prepStmt.executeQuery();

      if (!rs.next()) {

          return false;
          
          }
          else
          {
          String updateStatement =
                  "update cd set id='"+cdId+"',title='"+title+"',name='"+name+"',description='"+description+"',saletype='"+saletype+"',warehouse="+warehouse+",price="+price+" , yr="+year+",saleAmount="+saleamount+" where id=?";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.setString(1, cdId);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;
          }
          }
catch (SQLException e) 
{
return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
 
 public boolean insertCd(String cdId,String title,String name,String description,String saletype,String warehouse,String price ,String year ,String saleamount) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    con=getConnection();
    try{        
          String updateStatement =
                  "insert into cd values('"+cdId+"','"+name+"','"+title+"',"+price+","+year+",'"+description+"',"+saleamount+",'"+saletype+"',"+warehouse+")";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;}
catch (SQLException e) 
{
			e.printStackTrace();
			return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
 
 
 public boolean updateUser(String username,String password,String isadmin,String tel ,String email) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    ResultSet rs=null;
    try{
    	con=getConnection();
      String selectStatement = "select * " + "from customer where username = ? ";
      prepStmt = con.prepareStatement(selectStatement);
      prepStmt.setString(1, username);
      rs = prepStmt.executeQuery();

      if (!rs.next()) {

          return false;
          
          }
          else
          {
          String updateStatement =
                  "update customer set username='"+username+"',password='"+password+"',isadmin="+isadmin+",tel='"+tel+"',email='"+email+"' where username=?";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.setString(1, username);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;
          }
          }
catch (SQLException e) 
{
return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
 
 public boolean insertUser(String username,String password,String isadmin,String tel,String email) throws Exception {


		Connection con=null;
    PreparedStatement prepStmt=null;
    con=getConnection();
    try{        
          String updateStatement =
                  "insert into customer values('"+username+"','"+password+"',"+isadmin+",'"+tel+"','"+email+"')";
          prepStmt = con.prepareStatement(updateStatement);
          prepStmt.executeUpdate();
          prepStmt.close();
          return true;}
catch (SQLException e) 
{
			e.printStackTrace();
			return false;
}
    finally{
      closeConnection(con);
      closePrepStmt(prepStmt);
    }
 }
 

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩在线一二三区| 在线播放中文字幕一区| 欧美蜜桃一区二区三区| 国产午夜精品久久| 日本系列欧美系列| 色噜噜狠狠色综合欧洲selulu| 欧美大片国产精品| 亚洲乱码精品一二三四区日韩在线| 蜜桃av噜噜一区| 欧美日韩国产不卡| 亚洲欧美福利一区二区| 国产.欧美.日韩| 欧美videos大乳护士334| 一区二区三区.www| 99国产精品久久久久| 久久综合久色欧美综合狠狠| 日韩av一区二区在线影视| 99re热这里只有精品视频| 国产亚洲va综合人人澡精品| 蜜桃一区二区三区在线观看| 欧美久久一区二区| 亚洲成av人片在线观看无码| 91在线视频免费91| 中文字幕亚洲区| 9人人澡人人爽人人精品| 国产亚洲人成网站| 国产精品一级片| 久久精品一区二区三区不卡牛牛| 另类小说欧美激情| 日韩一区二区三区在线观看| 免费成人美女在线观看| 欧美精品久久99| 蜜臀av性久久久久蜜臀av麻豆 | 亚洲图片欧美综合| 色综合av在线| 亚洲综合一区二区精品导航| 欧美四级电影网| 日韩综合在线视频| 精品捆绑美女sm三区| 激情综合一区二区三区| 久久久99免费| av在线播放不卡| 亚洲欧美乱综合| 制服丝袜在线91| 美国欧美日韩国产在线播放| 91精品国产91久久综合桃花| 麻豆精品一区二区三区| 久久久久久久网| 91啪亚洲精品| 琪琪久久久久日韩精品| 欧美xxx久久| av成人动漫在线观看| 亚洲精品视频自拍| 欧美性大战xxxxx久久久| 日韩精品一级二级| 国产日韩精品一区二区三区在线| 95精品视频在线| 奇米亚洲午夜久久精品| 久久久精品影视| 欧美性一级生活| 久久精品72免费观看| 中文字幕av一区二区三区免费看| 色婷婷综合久久久久中文| 日本视频在线一区| 国产精品另类一区| 欧美精品日韩一区| 国产精品一区二区久久不卡 | 九九九久久久精品| 国产精品丝袜久久久久久app| 欧美午夜视频网站| 国产精品一区二区久激情瑜伽| 亚洲影院免费观看| 国产午夜精品久久| 欧美日韩视频一区二区| 国产精品综合在线视频| 亚洲综合成人在线| 国产女人水真多18毛片18精品视频 | 欧美三级日本三级少妇99| 国产最新精品免费| 亚洲电影一区二区三区| 国产日产精品1区| 91精品国产综合久久婷婷香蕉| heyzo一本久久综合| 久久国产尿小便嘘嘘尿| 亚洲在线视频免费观看| 国产日韩精品一区二区三区在线| 欧美日韩精品福利| 一本一道久久a久久精品| 国产在线视频精品一区| 天天色天天操综合| 亚洲欧美另类久久久精品| 国产亚洲一区字幕| 欧美一级xxx| 欧美人动与zoxxxx乱| www.av精品| 丰满白嫩尤物一区二区| 国产在线麻豆精品观看| 日韩国产欧美一区二区三区| 亚洲精品视频在线看| 国产精品久久99| 亚洲国产精品成人综合| 日韩欧美高清在线| 欧美一区二区三区思思人| 欧美色成人综合| 欧洲亚洲精品在线| 92国产精品观看| 91免费看片在线观看| 成人av集中营| 成人av网站在线| 成熟亚洲日本毛茸茸凸凹| 久久99精品网久久| 久久精品国产在热久久| 天天av天天翘天天综合网| 亚洲乱码日产精品bd| 亚洲精品综合在线| 一区二区三区四区在线免费观看| 中国色在线观看另类| 欧美高清在线一区| 国产精品区一区二区三| 国产精品久久久久影院色老大| 国产精品麻豆欧美日韩ww| 中文乱码免费一区二区| 亚洲日本青草视频在线怡红院| 中文字幕电影一区| 国产精品久久久久四虎| 亚洲精品写真福利| 亚洲国产综合色| 日韩极品在线观看| 六月丁香综合在线视频| 国产91露脸合集magnet| 色综合一区二区三区| 欧美日韩在线一区二区| 日韩视频一区二区三区在线播放| 精品毛片乱码1区2区3区| 久久亚洲二区三区| 国产精品不卡在线| 亚洲图片自拍偷拍| 久久99久久精品欧美| 国产盗摄一区二区| 色诱视频网站一区| 欧美一级黄色大片| 国产精品久久一卡二卡| 亚洲成人动漫一区| 美女网站一区二区| 成人av综合在线| 在线成人免费观看| 国产色91在线| 亚洲国产日日夜夜| 麻豆成人久久精品二区三区小说| 大白屁股一区二区视频| 欧美日韩成人综合天天影院 | 亚洲已满18点击进入久久| 日本视频一区二区| 高清成人在线观看| 91成人网在线| 国产亚洲人成网站| 三级影片在线观看欧美日韩一区二区| 极品少妇一区二区三区精品视频 | 2024国产精品视频| 亚洲一区二区五区| 懂色av一区二区三区蜜臀| 欧美老年两性高潮| 国产精品久久久久久久浪潮网站| 日韩成人一区二区| 99久久精品国产导航| 久久综合中文字幕| 五月天亚洲精品| 91天堂素人约啪| 国产亚洲午夜高清国产拍精品| 亚洲成人综合在线| av动漫一区二区| 国产亚洲欧美日韩在线一区| 五月婷婷激情综合网| aaa亚洲精品| 国产欧美精品一区aⅴ影院| 日韩黄色免费网站| 欧美性大战xxxxx久久久| 国产精品久久综合| 国产精品123区| 久久美女高清视频| 麻豆成人av在线| 日韩一区二区在线观看视频播放| 亚洲成人综合网站| 在线视频亚洲一区| 亚洲精品久久7777| 99re亚洲国产精品| 亚洲欧洲韩国日本视频| 国产一区二区精品久久91| 日韩小视频在线观看专区| 婷婷国产在线综合| 欧美日韩国产片| 亚洲午夜私人影院| 色哟哟日韩精品| 一个色综合av| 精品视频123区在线观看| 一个色妞综合视频在线观看| 在线亚洲一区观看| 亚洲一区欧美一区| 欧美视频在线一区| 午夜视频一区二区三区|