




免費(fèi)預(yù)覽已結(jié)束,剩余32頁(yè)可下載查看
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1需求分析隨著近年來(lái)我國(guó)經(jīng)濟(jì)的發(fā)展,國(guó)民生活水平的提高,國(guó)內(nèi)的轎車(chē)產(chǎn)業(yè)開(kāi)始迅猛發(fā)展,人民群眾對(duì)于轎車(chē)的需求也是日益增多,也因此產(chǎn)生了很多轎車(chē)銷(xiāo)售公司。在這些轎車(chē)銷(xiāo)售公司里,由于業(yè)務(wù)繁忙,往往需要處理各種品牌型號(hào)轎車(chē)的銷(xiāo)售查詢(xún)工作,銷(xiāo)售員的管理工作等等。這些工作如果光靠人工來(lái)實(shí)現(xiàn),工作量就很大,而且容易出現(xiàn)錯(cuò)誤,造成管理上的混亂。因此,制作一套轎車(chē)銷(xiāo)售管理系統(tǒng)對(duì)于公司管理能夠提高轎車(chē)銷(xiāo)售公司的管理水平、工作效率、服務(wù)質(zhì)量、降低銷(xiāo)售成本,最終提高公司的市場(chǎng)競(jìng)爭(zhēng)力。1.1 編寫(xiě)目的轎車(chē)銷(xiāo)售管理系統(tǒng)可以有效的管理轎車(chē)信息、員工信息和客戶(hù)信息。它主要進(jìn)行轎車(chē)銷(xiāo)售公司的管理工作。本系統(tǒng)以MY SQL 為后臺(tái)數(shù)據(jù)庫(kù),利用MY SQL對(duì)數(shù)據(jù)庫(kù)進(jìn)行管理和操作。本系統(tǒng)將以轎車(chē)銷(xiāo)售公司的管理為背景,介紹如何以JAVA為前臺(tái)開(kāi)發(fā)工具,MY SQL為后臺(tái)數(shù)據(jù)庫(kù)管理系工具開(kāi)發(fā)數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)。本系統(tǒng)具有很強(qiáng)的使用性,用戶(hù)只要根據(jù)實(shí)際的使用情況稍加修改,就可以把它應(yīng)用到實(shí)際工作中。 1.1.1數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)的開(kāi)發(fā)涉及如下內(nèi)容:l 系統(tǒng)功能設(shè)計(jì);l 數(shù)據(jù)庫(kù)設(shè)計(jì);l 界面設(shè)計(jì)l 程序代碼設(shè)計(jì) 1.1.2項(xiàng)目?jī)?nèi)容:開(kāi)發(fā)一個(gè)轎車(chē)銷(xiāo)售管理系統(tǒng)對(duì)于該項(xiàng)目,主要注意以下兩個(gè)方面:l 轎車(chē)銷(xiāo)售公司的銷(xiāo)售員管理、轎車(chē)信息管理和客戶(hù)信息管理l 轎車(chē)銷(xiāo)售系統(tǒng)中涉及那些數(shù)據(jù)對(duì)象,各對(duì)象之間以及對(duì)象內(nèi)部的關(guān)系如何?如何保存?zhèn)€數(shù)據(jù)對(duì)象的相關(guān)數(shù)據(jù),以便轎車(chē)銷(xiāo)售管理系統(tǒng)進(jìn)行數(shù)據(jù)處理。1.2 分析 1.2.1轎車(chē)銷(xiāo)售系統(tǒng)的主要功能有:(1) 系統(tǒng)用戶(hù)管理功能。用戶(hù)根據(jù)姓名和密碼登錄系統(tǒng)。登錄用戶(hù)分為兩個(gè)等級(jí):普通用戶(hù)和管理員用戶(hù)。普通用戶(hù)只查看轎車(chē)信息、客戶(hù)信息、員工信息等功能;管理員用戶(hù)(admin)除了以上功能外,同時(shí)還有添加用戶(hù)、修改用戶(hù)密碼和刪除用戶(hù)的功能。(2) 轎車(chē)信息管理功能。錄入所銷(xiāo)售的轎車(chē)編號(hào)、型號(hào)、品牌、價(jià)格、保修期等信息,同時(shí)支持對(duì)轎車(chē)信息的添加、修改、刪除和查詢(xún)功能。(3) 客戶(hù)信息管理功能。錄入購(gòu)買(mǎi)轎車(chē)的客戶(hù)姓名、性別、年齡、聯(lián)系方式、所購(gòu)車(chē)型號(hào)、購(gòu)車(chē)價(jià)格等信息,同時(shí)還支持虧客戶(hù)信息的添加、修改、刪除和查詢(xún)功能。(4) 員工信息管理功能。錄入員工的員工號(hào)、姓名、性別等信息,同時(shí)支持對(duì)員工信息的添加、修改、刪除和查詢(xún)功能。 1.2.2數(shù)據(jù)庫(kù)信息經(jīng)過(guò)實(shí)際的需求分析,確定需要包含以下數(shù)據(jù)庫(kù)信息:【轎車(chē)庫(kù)存信息:】轎車(chē)編號(hào)(標(biāo)識(shí)列),轎車(chē)型號(hào),轎車(chē)名稱(chēng),轎車(chē)品牌,轎車(chē)銷(xiāo)量【員工信息:】員工編號(hào),姓名,性別,年齡,電話,業(yè)績(jī)【客戶(hù)信息:】客戶(hù)編號(hào),客戶(hù)姓名,客戶(hù)性別,客戶(hù)年齡,客戶(hù)電話【轎車(chē)銷(xiāo)售信息:】序號(hào)(標(biāo)識(shí)列),轎車(chē)型號(hào),銷(xiāo)售員編號(hào),客戶(hù)編號(hào),銷(xiāo)售日期2總體設(shè)計(jì)2.1系統(tǒng)流程圖根據(jù)系統(tǒng)的功能要求,采用模塊化的方法,設(shè)計(jì)圖書(shū)借閱系統(tǒng)的控制流程圖如圖: 登錄修改用戶(hù)密碼查詢(xún)用戶(hù)密碼系統(tǒng)用戶(hù)刪除系統(tǒng)用戶(hù)管理功能轎車(chē)信息管理功能客戶(hù)信息管理功能員工信息管理功能轎車(chē)信息查詢(xún)轎車(chē)信息添加轎車(chē)信息修改轎車(chē)信息刪除客戶(hù)信息查詢(xún)客戶(hù)信息添加客戶(hù)信息修改客戶(hù)信息刪除員工信息查詢(xún)員工信息添加員工信息修改員工信息刪除系統(tǒng)用戶(hù)添加 2.2 E-R模型用E-R模型描述系統(tǒng)中的實(shí)體集與實(shí)體集之間的關(guān)系,目的是以E-R圖為工具,設(shè)計(jì)關(guān)系型的數(shù)據(jù)庫(kù),即確定應(yīng)用系統(tǒng)所使用的數(shù)據(jù)庫(kù)應(yīng)包含哪些表,每個(gè)表的結(jié)構(gòu)是怎么樣的。 系統(tǒng)用戶(hù)員工信息客戶(hù)信息轎車(chē)信息管理用戶(hù)名密 碼用戶(hù)等級(jí)類(lèi)型描述用戶(hù)級(jí)別轎車(chē)型號(hào)轎車(chē)編號(hào)轎車(chē)品牌轎車(chē)價(jià)格轎車(chē)保修期轎車(chē)具體描述客戶(hù)編號(hào)客戶(hù)年齡客戶(hù)職業(yè)身份證號(hào)客戶(hù)電話客戶(hù)住址購(gòu)車(chē)價(jià)格購(gòu)車(chē)型號(hào)客戶(hù)性別客戶(hù)姓名員工編號(hào)員工性別員工姓名員工電話員工職務(wù)員工生日員工地址進(jìn)入公司時(shí)間所在部門(mén) 2.3 關(guān)系描述的設(shè)計(jì) 根據(jù)以上各E-R圖,經(jīng)過(guò)轉(zhuǎn)換,可以導(dǎo)出各個(gè)關(guān)系。這些實(shí)體涉及的數(shù)據(jù)項(xiàng)有: 系統(tǒng)用戶(hù):(用戶(hù)名,密碼,用戶(hù)等級(jí)) 管理:(用戶(hù)等級(jí),類(lèi)型描述) 轎車(chē)信息:(轎車(chē)編號(hào),轎車(chē)型號(hào),轎車(chē)品牌,轎車(chē)銷(xiāo)量) 客戶(hù)信息:(客戶(hù)編號(hào),客戶(hù)姓名,客戶(hù)性別,客戶(hù)年齡,客戶(hù)電話) 員工信息:(員工編號(hào),員工姓名,員工性別,員工年齡,員工電話,員工業(yè)績(jī)) 轎車(chē)銷(xiāo)售信息:(銷(xiāo)售記錄編號(hào),轎車(chē)型號(hào),銷(xiāo)售員編號(hào),客戶(hù)編號(hào),銷(xiāo)售日期) 2.4數(shù)據(jù)庫(kù)物理設(shè)計(jì) 2.4.1創(chuàng)建數(shù)據(jù)庫(kù) 在創(chuàng)建數(shù)據(jù)庫(kù)表之前,首先要?jiǎng)?chuàng)建一個(gè)數(shù)據(jù)庫(kù),本系統(tǒng)以MY SQL 為后臺(tái)數(shù)據(jù)庫(kù)。用戶(hù)可以在企業(yè)管理器中創(chuàng)建數(shù)據(jù)庫(kù),也可以在MY SQL執(zhí)行SQL語(yǔ)句。需要注意的是,在設(shè)計(jì)數(shù)據(jù)庫(kù)結(jié)構(gòu)時(shí),通常需要考慮主文件,從文件和日志文件的存儲(chǔ)位置和大小。文件大小可以根據(jù)數(shù)據(jù)庫(kù)的用途,用戶(hù)數(shù)量和存儲(chǔ)數(shù)據(jù)等因素綜合考慮。一般初始大小不宜設(shè)置過(guò)大,以免浪費(fèi)存儲(chǔ)空間。而文件最大尺寸需要設(shè)置大些,以保證有足夠的存儲(chǔ)空間。日志文件則不需要太多的空間。 2.4.2轎車(chē)銷(xiāo)售管理系統(tǒng)庫(kù)表結(jié)構(gòu)設(shè)計(jì) 該系統(tǒng)設(shè)計(jì)了五個(gè)數(shù)據(jù)庫(kù)表:用戶(hù)信息表Users、用戶(hù)類(lèi)型表UserType、轎車(chē)信息表Car、客戶(hù)信息表Customer、員工信息表Staff。 具體結(jié)構(gòu)如下圖所示:Users表字段名稱(chēng)標(biāo)識(shí)名稱(chēng)數(shù)據(jù)類(lèi)型空否字段說(shuō)明User_name用戶(hù)名Varchar(10)N主鍵User_pwd密碼Varchar(20)NUser_type用戶(hù)等級(jí)smallintN限制用戶(hù)權(quán)限UserType表字段名稱(chēng)標(biāo)識(shí)名稱(chēng)數(shù)據(jù)類(lèi)型空否字段說(shuō)明User_type用戶(hù)等級(jí)SmallintN限制用戶(hù)權(quán)限Type_discription類(lèi)型描述Varchar(50)NCar表字段名稱(chēng)標(biāo)識(shí)名稱(chēng)數(shù)據(jù)類(lèi)型空否字段說(shuō)明Car_ip轎車(chē)編號(hào)IntN自增,主鍵Car_name轎車(chē)型號(hào)Varchar(20)NCar_brand轎車(chē)品牌Varchar(10)NCar_cout轎車(chē)銷(xiāo)量Int NCustomer表字段名稱(chēng)標(biāo)識(shí)名稱(chēng)數(shù)據(jù)類(lèi)型空否字段說(shuō)明Customer_id客戶(hù)編號(hào)IntN自增,主鍵Customer_name客戶(hù)姓名Varchar(10)NCustomer_sex客戶(hù)性別Varchar(2)NCustomer_age客戶(hù)年齡IntYCustomer_tel客戶(hù)電話Varchar(10)YStaff表字段名稱(chēng)標(biāo)識(shí)名稱(chēng)數(shù)據(jù)類(lèi)型空否字段說(shuō)明Staff_id員工編號(hào)IntN自增,主鍵Staff_name員工姓名Varchar(10)NStaff_sex員工性別Varchar(2)NStaff_tel員工電話Varchar(10)YStaff_age員工年齡IntY2.4.3 用SQL建立各個(gè)表(1)建立Users表:CREATE TABLE dbo.Users( User_name VARCHAR(10) Primary Key User_pwd VARCHAR(20) NOT NULL User_type SMALLINT NOT NULL)(2) 建立UserType表CREATE TABLE dbo.UserType( User_type SMALLINT Primary Key Type_discription VARCHAR(100) NOT NULL)(3)建立Car表CREATE TABLE dbo.Car(Car_id INT Primary Key Car_name VARCHAR(20) NOT NULL Car_brand VARVHAR(20) NOT NULL Car_cout INT )(4) 建立Customer表CREATE TABLE dbo.Customer(Customer_id INT Primary KeyCustomer_name VARCHAR(10) NOT NULLCustomer_sex VARCHAR(2) NULLCustomer_age INT NULLCustomer_tel VARCHAR(10) NULL)(5) 建立Staff表CREATE TABLE dbo.staff( Staff_id INT Primary KeyStaff_name VARCHAR(10) NOT NULLStaff_sex VARCHAR(2) NOT NULL Staff_age INT NULLStaff_tel VARCHAR(10) NULL)3 詳細(xì)設(shè)計(jì)3.1銷(xiāo)售界面的設(shè)計(jì)及功能描述(1)轎車(chē)管理系統(tǒng)啟動(dòng)時(shí)的界面點(diǎn)擊運(yùn)行按鈕,出現(xiàn)如圖所示的啟動(dòng)界面,進(jìn)行轎車(chē)銷(xiāo)售處理(2)車(chē)輛信息 員工信息 客戶(hù)信息 銷(xiāo)售記錄查詢(xún)界面點(diǎn)擊界面的車(chē)輛信息、員工信息、客戶(hù)信息、銷(xiāo)售記錄查看按鈕,運(yùn)行出對(duì)應(yīng)數(shù)據(jù)庫(kù)中已存的車(chē)輛、員工、客戶(hù)以及銷(xiāo)售記錄信息(3)新建車(chē)輛界面點(diǎn)擊界面的新建車(chē)輛按鈕,填寫(xiě)車(chē)輛的有關(guān)信息,并對(duì)應(yīng)的存儲(chǔ)到相應(yīng)的數(shù)據(jù)庫(kù)中(4)新建員工界面點(diǎn)擊界面的新建員工按鈕,填寫(xiě)員工的有關(guān)信息,并對(duì)應(yīng)的存儲(chǔ)到相應(yīng)的數(shù)據(jù)庫(kù)中(5)新建客戶(hù)界面點(diǎn)擊界面的新建客戶(hù)按鈕,填寫(xiě)客戶(hù)的有關(guān)信息,并對(duì)應(yīng)的存儲(chǔ)到相應(yīng)的數(shù)據(jù)庫(kù)中(6)新建銷(xiāo)售記錄界面點(diǎn)擊界面的新建銷(xiāo)售記錄按鈕,填寫(xiě)銷(xiāo)售記錄的有關(guān)信息,并對(duì)應(yīng)的存儲(chǔ)到相應(yīng)的數(shù)據(jù)庫(kù)中(7)刪除信息界面點(diǎn)擊界面的刪除信息按鈕,填寫(xiě)車(chē)輛、客戶(hù)、員工、銷(xiāo)售記錄表的數(shù)據(jù)編號(hào),以及對(duì)應(yīng)的表名,刪除表中對(duì)應(yīng)的信息(8)清空界面點(diǎn)擊界面的晴空控制臺(tái)按鈕,清除在界面中顯示的所有銷(xiāo)售信息3.2 源代碼(1) Car.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Car extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -2567952878290133643L;Container context;JTextField id;JTextField brand;JTextField type;JButton ok,cancle;JLabel lbrand,ltype,lid;Car()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);lbrand=new JLabel(品牌:);ltype=new JLabel(型號(hào):);id=new JTextField(10);brand=new JTextField(10);type=new JTextField(10);lid.setLabelFor(id);lbrand.setLabelFor(brand);ltype.setLabelFor(type);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(lbrand);context.add(brand);context.add(ltype);context.add(type);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try String _id = id.getText();String _type = type.getText();String _brand = brand.getText();Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = insert into cars(id,brand,type) value(+_id+,+_brand+,+_type+);System.out.print(sql);stmt.execute(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();/需要在此添加過(guò)濾代碼過(guò)濾非法輸入/manage.insertclass(Integer.parseInt(id.getText(), name.getText();this.setVisible(false);else if(s=cancle)this.setVisible(false);/public static void main(String args) /new Car();/(2) Client.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Client extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -6547959361972952105L;Container context;JTextField id;JTextField name;JTextField sex;JTextField age;JTextField cell;JButton ok,cancle;JLabel lid,lname,lsex,lage,lcell;Client()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);lname=new JLabel(名稱(chēng):);lsex=new JLabel(性別:);lage=new JLabel(年齡:);lcell=new JLabel(電話:);id=new JTextField(10);name=new JTextField(10);sex=new JTextField(2);age=new JTextField(3);cell=new JTextField(10);lid.setLabelFor(id);lname.setLabelFor(name);lsex.setLabelFor(sex);lage.setLabelFor(age);lcell.setLabelFor(cell);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(lname);context.add(name);context.add(lsex);context.add(sex);context.add(lage);context.add(age);context.add(lcell);context.add(cell);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try String _id = id.getText();String _name = name.getText();String _sex = sex.getText();String _age = age.getText();Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = insert into clinet(id,name,sex,age) value(+_id+,+_name+,+_sex+,+_age+);System.out.print(sql);stmt.execute(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();this.setVisible(false);/(Integer.parseInt(id.getText(), name.getText();else if(s=cancle)this.setVisible(false);/public static void main(String args) /new Client();/(3) Connections.javaimport java.sql.Connection;import java.sql.DriverManager;public class Connections public Connection connect()Connection connection = null;try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/localhost:3306/car;String user = root;String password = root;connection = DriverManager.getConnection(url, user, password); catch (Exception e) e.printStackTrace();/ TODO: handle exceptionreturn connection;(4) Del.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class del extends JDialog implements ActionListener/* * */private static final long serialVersionUID = 3712830203472566152L;Container context;JTextField id;JTextField target;JButton ok,cancle;JLabel lid,ltarget;del()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);ltarget=new JLabel(所在的表:);id=new JTextField(10);target=new JTextField(10);lid.setLabelFor(id);ltarget.setLabelFor(target);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(ltarget);context.add(target);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = delete from +target.getText()+ where id=+id.getText()+;stmt.execute(sql); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();this.setVisible(false);else if(s=cancle)this.setVisible(false);(5) Mainframe.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.*;import javax.swing.*;public class Mainframe extends JFrame implements ActionListener /* * */private static final long serialVersionUID = -3254015039949474992L;public static void main(String agrv)new Mainframe();private Container cpanel;JTextArea text;JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10;Mainframe()cpanel=this.getContentPane();cpanel.setLayout(new FlowLayout();this.setSize(720, 500);text=new JTextArea(控制臺(tái)輸出:+n,20,55);JScrollPane scroll=new JScrollPane(text);/text.add(scroll);b1=new JButton(車(chē)輛信息);b2=new JButton(員工信息);b3=new JButton(客戶(hù)信息);b10=new JButton(銷(xiāo)售記錄查看);b4=new JButton(新建車(chē)輛);b5=new JButton(新建員工);b6=new JButton(新建客戶(hù));b9=new JButton(新建銷(xiāo)售記錄);b7=new JButton(刪除信息);b8=new JButton(清空控制臺(tái));cpanel.add(b1);cpanel.add(b2);cpanel.add(b3);cpanel.add(b10);cpanel.add(b4);cpanel.add(b5);cpanel.add(b6);cpanel.add(b9);cpanel.add(b7);cpanel.add(b8);cpanel.add(text);this.setVisible(true);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);b10.addActionListener(this);b4.addActionListener(this);b5.addActionListener(this);b6.addActionListener(this);b9.addActionListener(this);b7.addActionListener(this);b8.addActionListener(this);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=b1)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from cars;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) e1.printStackTrace();text.append(ID 品牌 型號(hào) 銷(xiāo)量+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印車(chē)輛信息else if(s=b2)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from staff;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(ID 名字 性別 年齡 業(yè)績(jī)+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( );text.append(r.getString(3);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印員工信息else if(s=b3)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from clinet;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(ID 名字 性別 年齡+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();else if(s=b10)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from orders;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(銷(xiāo)售記錄ID 汽車(chē)ID 銷(xiāo)售員ID 客戶(hù)ID 日期+n);for(int i = 0; r.next(); i+)text.append(String.valueOf(r.getInt(1);text.append( );text.append(String.valueOf(r.getInt(2);text.append( );text.append(String.valueOf(r.getInt(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( );text.append(String.valueOf(r.getInt(5);text.append( );text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印客戶(hù)信息else if(s=b4)new Car();else if(s=b5)new Staff();else if(s=b6)new Client();else if(s=b7)new del();else if(s=b9)new Order();else if(s=b8)text.setText(null);(6) Order.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Order extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -2567952878290133643L;Container context;JTextField id;JTextField brand;JTextField type;JTextField date;JButton ok,cancle;JLabel lbrand,ltype,lid,ldate;Order()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(汽車(chē)ID:);lbrand=new JLabel(銷(xiāo)售人員ID:);ltype=new JLabel(客戶(hù)ID:);ldate=new JLabel(日期:);id=new JTextField(10);brand=new JTextField(10);type=new JTextField(10);date=new JTextField(10);lid.setLabelFor(id);lbrand.setLabelFor(brand);ltype.setLabelFor(type);ldate.
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 收購(gòu)草場(chǎng)合同協(xié)議
- 芯片居間合同協(xié)議
- 影院包場(chǎng)合同協(xié)議
- 現(xiàn)場(chǎng)直播合同協(xié)議
- 泰安購(gòu)房合同協(xié)議
- 線纜采購(gòu)合同協(xié)議
- 權(quán)益轉(zhuǎn)讓合同協(xié)議
- 退休材料合同協(xié)議
- 植物抗旱合同協(xié)議
- 游樂(lè)安全協(xié)議合同
- 裝配式建筑發(fā)展存在的問(wèn)題及對(duì)策分析
- 中國(guó)古典文獻(xiàn)學(xué)(全套)
- 自身免疫性腦炎
- 銀行保險(xiǎn)客戶(hù)KYC基礎(chǔ)信息表
- 醫(yī)院質(zhì)控科工作質(zhì)量考核指標(biāo)
- GB/T 4857.14-1999包裝運(yùn)輸包裝件傾翻試驗(yàn)方法
- GB/T 11881-2006羽毛球
- 煤礦從業(yè)人員安全培訓(xùn)考試題庫(kù)(附答案)
- 《詩(shī)意中國(guó)》朗誦稿
- 第十章-國(guó)際政治與世界格局-(《政治學(xué)概論》課件)
- 信息技術(shù)與小學(xué)數(shù)學(xué)教學(xué)的深度融合課件
評(píng)論
0/150
提交評(píng)論