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

📄 client.java

📁 一个货物管理系
💻 JAVA
字号:
package good;

import java.sql.ResultSet;
import java.util.Vector;

public class Client {

	/**
	 * @param args
	 */
	private String clientName;
	private String clientNumber;
	private String clientAddress;
	//private String goodPrice;
	public String getClientName() {
		return clientName;
	}
	public void setClientName(String clientName) {
		this.clientName = clientName;
	}
	public String getClientNumber() {
		return clientNumber;
	}
	public void setClientNumber(String clientNumber) {
		this.clientNumber = clientNumber;
	}
	public String getClientAddress() {
		return clientAddress;
	}
	public void setClientAddress(String clientAddress) {
		this.clientAddress = clientAddress;
	}
	//public String getGoodPrice() {
		//return goodPrice;
	//}
//	public void setGoodPrice(String goodPrice) {
	//	this.goodPrice = goodPrice;
	//}
	public boolean clientAdd()
	{
		DataConn storCon = new DataConn();
		String addSql = null;
		storCon.dataConnDerectForMySql();
		System.out.println(clientName);
		addSql="Insert into client(clientName,clientNumber,clientAddress) values('"+clientName
		+"','"+clientNumber+"','"+clientAddress+"')";
		System.out.println(addSql);
		storCon.executeDerectUpdate(addSql);
		return true;
	}
	public boolean clientModi()
	{
		DataConn storCon = new DataConn();
		String addSql = null;
		storCon.dataConnDerectForMySql();
		addSql="update client set clientNumber='"+clientNumber+"',clientAddress='"+clientAddress+
		"' where clientName='"+clientName+"'";
		storCon.executeDerectUpdate(addSql);
		return true;
	}
	public Vector GetAllclientName() {
		String quy;
		String temp;
		int i = 0;
		DataConn storCon = new DataConn();
		Vector list = new Vector();
		storCon.dataConnDerectForMySql();
		ResultSet rs = null;
		quy = "select clientname from client order by clientName";
		try {
			rs = storCon.executeDerectQuery(quy);

			while (rs.next()) {
				
				temp=rs.getString(1);
				System.out.println(temp);
				list.add(temp==null? "":temp.trim());

			}
		} catch (Exception e) {
			e.printStackTrace();

		}
		return list;

	}
	public void resultData() {
		String quy;
		DataConn storCon = new DataConn();
		String addSql = null;
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from client where clientName='" + this.getClientName()+"'" ;
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				//this.setClientName(rs.getString("clientName"));
				this.setClientNumber(rs.getString("clientnumber"));
				this.setClientAddress(rs.getString("clientaddress"));
			} else {

			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();

		}
	}
	public boolean checkData() {
		String quy;
		DataConn storCon = new DataConn();
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from client where clientname='" + this.getClientName() + "'";
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				return false;
			} else {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

	}
	private void clientName(String string) {
		// TODO Auto-generated method stub
		
	}
	public boolean checkExist(String name) {
		String quy;
		DataConn storCon = new DataConn();
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from client where clientname='" + name + "'";
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				return false;
			} else {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

	}
  
}

⌨️ 快捷键说明

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