⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 supplymanager.java

📁 基于J2EE的网络物流系统 用户操作: 1. 录入出库商品信息 2. 查询出库单信息 3. 录入入库商品信息 4. 查询入库单信息 5. 查询商品位置信息 6. 查询商品信息 7. 查
💻 JAVA
字号:
package com.logistic.business;

import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Vector;
import com.logistic.data.DataConnect;
import com.logistic.dao.*;
import com.logistic.model.SupplyInfo;;

public class SupplyManager implements ISupplyDAO {
	
	DataConnect dc=new DataConnect();
	Statement   stat=null;
	ResultSet   rs=null;
	
    //添加供应商信息的AddSupply方法
	public int AddSupply(String supplyid,String supplyname,String supplycharge,String supplyaddress,String supplyphone,String supplymobile,String supplyfax,String supplyemail,String supplyhttp){
	
		int flag=-10;
		
		try{
			
			String id=supplyid;
			String name=supplyname;
			String charge=supplycharge;
			String address=supplyaddress;
			String phone=supplyphone;
			String mobile=supplymobile;
			String fax=supplyfax;
			String email=supplyemail;
			String http=supplyhttp;
			String sqls="insert into supplytable(SupplyId,SupplyName,SupplyCharge,SupplyAddress,SupplyPhone,SupplyMobile,SupplyFax,SupplyEmail,SupplyHttp)" +
					    "values('"+id+"','"+name+"','"+charge+"','"+address+"','"+phone+"','"+mobile+"','"+fax+"','"+email+"','"+http+"')";
			
			flag=0;
			flag=dc.updata(sqls);
			if(flag>0){
				System.out.print("供应商数据插入成功!");
			}else{
				System.out.print("供应商数据插入失败!");
			}
		}catch(Exception ex){
			ex.printStackTrace();
		}finally{dc.close();}
	
		return flag;
	}
	
	//得到供应商数据信息集合的SupplySearch方法
	public Vector SupplySearch(String strsql,int page){
		
		Vector items=new Vector();
		try{
			stat=dc.getStmtread();
			rs  =stat.executeQuery(strsql);
		 if(rs.next()){
			PageAble pgb=new PageAble(rs);
			pgb.setPagesize(5);
			pgb.setCurrentpage(1);
			pgb.gotoPage(page);
			rs.absolute(pgb.getRowscount());
			int i=0;
			do{
				
			    items.add(new SupplyInfo(rs.getString("SupplyId"),rs.getString("SupplyName"),rs.getString("SupplyCharge"),rs.getString("SupplyAddress"),rs.getString("SupplyPhone"),rs.getString("SupplyMobile"),rs.getString("SupplyFax"),rs.getString("SupplyEmail"),rs.getString("SupplyHttp")));
				
			   }while(rs.next()&&i<pgb.getCurrentPageRowsCount());
		 }else{
			 
			 System.out.println("供应商数据为空!");
		 }
			
		}catch(Exception ex){ex.printStackTrace();}finally{dc.close();}
		
		return items;
	}
	
	//删除指定编号的供应商信息的DelSupply方法
	public int DelSupply(String supplyid){
		
	String strsql="delete from supplytable where SupplyId="+supplyid;
	
		int flag=0;
		try{
			
			flag=dc.updata(strsql);
			if(flag>0){
				System.out.print("编号为:"+supplyid+"供应商信息删除成功");
			  }else{
				System.out.print("编号为:"+supplyid+"供应商信息删除失败"); 
			  }
			
		}catch(Exception ex){ex.printStackTrace();}finally{dc.close();}
		
		return flag;
	} 

	public int ModifySupply(String supplyid,String supplyname,String supplycharge,String supplyaddress,String supplyphone,String supplymobile,String supplyfax,String supplyemail,String supplyhttp){
		
		int flag=-10;
		try{
			String sid=supplyid;
			String sname=supplyname;
			String scharge=supplycharge;
			String saddress=supplyaddress;
			String sphone=supplyphone;
			String smobile=supplymobile;
			String sfax=supplyfax;
			String semail=supplyemail;
			String shttp=supplyhttp;
			
			String strsql="update supplytable set SupplyName='"+sname+"',SupplyCharge='"+scharge+"',SupplyAddress='"+saddress+"',SupplyPhone='"+sphone+"',SupplyMobile='"+smobile+"',SupplyFax='"+sfax+"',SupplyEmail='"+semail+"',SupplyHttp='"+shttp+"' where SupplyId="+sid;
			flag=dc.updata(strsql);
			if(flag>0){
				System.out.println("编号="+sid+"的供应商信息更新成功!");
			}else{
				System.out.println("编号="+sid+"的供应商信息更新失败!");
			}
			
		}catch(Exception ex){ex.printStackTrace();}finally{dc.close();}
	return flag;	
	}

	public SupplyInfo SupplySearchById(String supplyid){
		
		String strsql="select * from supplytable where SupplyId="+supplyid;
		SupplyInfo si=new SupplyInfo();
		
		try{
			stat=dc.getStmtread();
			rs  =stat.executeQuery(strsql);
			while(rs.next()){
				
				si.setSupplyid(rs.getString("SupplyId"));
				si.setSupplyname(rs.getString("SupplyName"));
				si.setSupplycharge(rs.getString("SupplyCharge"));
				si.setSupplyaddress(rs.getString("SupplyAddress"));
				si.setSupplyphone(rs.getString("SupplyPhone"));
				si.setSupplymobile(rs.getString("SupplyMobile"));
				si.setSupplyfax(rs.getString("SupplyFax"));
				si.setSupplyemail(rs.getString("SupplyEmail"));
				si.setSupplyhttp(rs.getString("SupplyHttp"));
			}
		}catch(Exception ex){ex.printStackTrace();}finally{dc.close();}
	return si;	
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -