阳光酒店管理系统完整源码
------清华IT
------------
网上很流行的一个系统。特此公布其完整源码。以飨博友。
设计测试过程中没有实现,其数据库的链接和操作。日后自会加强这点。也望高人指点。
作者:顾
俊
董丰。测试:July。
---------------------------------------------------------------------------------
//package com.sunshine.about;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
public class About extends JDialog
implements ActionListener {
JLabel top, li, fee, tit, ver, user, co, boss,
temp;
JPanel pm, info, i1, i2, bott, bp;
JButton bt1;
public About (JFrame frame) {
super (frame, "关于我们",
true);
top = new JLabel (new
ImageIcon("pic/about.gif"));
li = new
JLabel (new ImageIcon("pic/line1.gif"));
fee = new JLabel
("<html>技术支持: >版权所有
(C) 2006 SunshineSOFT
Corporation.</html>");
tit = new JLabel
("
欢 迎 使 用 阳 光 酒 店 管 理 系 统");
ver = new JLabel
("版本: 2006
Bate1
");
user= new JLabel
("软件用户: " + sunini.getIniKey("UserName"));
co = new
JLabel
("
所属公司: " + sunini.getIniKey("CompName"));
boss= new JLabel
("
阳光设计组 组长:
顾俊
小组成员:
董丰、杨芳、齐帅、彭宏伟、刘楠楠
");
temp= new JLabel
("
");
bt1 = new TJButton
("pic/choose.gif", "确 定", "");
pm = new
JPanel (new BorderLayout ());
info = new JPanel (new
GridLayout (4, 1, 0, 0));
bott = new JPanel (new
BorderLayout ());
i1 = new
JPanel ();
i2 = new
JPanel (new FlowLayout (FlowLayout.RIGHT));
bp = new
JPanel (new FlowLayout (FlowLayout.RIGHT, 10 ,8));
//制作信息面板
i1.add (user);
i1.add (co);
i2.add (ver);
info.add (tit);
info.add (i2);
info.add (i1);
info.add (boss);
//制作下边组件
bp.add (bt1);
bott.add ("North", li);
bott.add ("West", temp);
bott.add ("East", bp);
bott.add ("Center", fee);
//制作主面板
pm.add ("North", top);
pm.add ("South", bott);
pm.add ("Center", info);
bt1.addActionListener
(this);
this.setContentPane (pm);
this.setResizable
(false);
pack();
sunswing.setWindowCenter(this);
}
public void actionPerformed (ActionEvent ae)
{
this.setVisible (false);
}
}
----------------------------------------------------
//package com.sunshine.setup;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class AddCustomerType
extends JDialog
implements ActionListener {
private JTextField tf1, tf2, tf3;
private JButton bt1, bt2;
public AddCustomerType(JDialog dialog) {
super(dialog, "客户类型",
true);
JLabel lb, lb1, lb2, lb4;
JPanel panelMain, panelInfo,
p1, p2, p3, p4,
p5; //定义各组件面板
p1 = new JPanel(new
FlowLayout(FlowLayout.CENTER, 10, 0));
p2 = new JPanel(new
FlowLayout(FlowLayout.CENTER, 10, 0));
p3 = new JPanel(new
FlowLayout(FlowLayout.CENTER, 10, 0));
p5 = new JPanel(new
FlowLayout(FlowLayout.CENTER, 10, 0));
p4 = new JPanel(new
FlowLayout(FlowLayout.CENTER, 30, 6));
panelInfo = new JPanel(new
GridLayout(4, 1, 0, 0));
panelMain = new JPanel(new
BorderLayout());
lb1 = new
JLabel("客户类型:");
lb2 = new
JLabel("打折比例:");
lb4 = new
JLabel("类型编号:");
lb = new
JLabel("<html>注:此打折比例仅适用于商品项目!<br> 8为八折,10为不打折<html>");
lb.setForeground(new Color(255,
138, 0));
tf1 = new TJTextField(7);
tf2 = new TJTextField(7);
tf3 = new TJTextField("10",
7);
bt1 = new TJButton
("pic/save.gif", "确定", "确定添加客户类型");
bt2 = new TJButton
("pic/cancel.gif", "取消", "取消操作");
//加入组件
p1.add(lb1);
p1.add(tf2);
p2.add(lb2);
p2.add(tf3);
p3.add(lb);
p4.add(bt1);
p4.add(bt2);
p5.add(lb4);
p5.add(tf1);
panelInfo.add(p5);
panelInfo.add(p1);
panelInfo.add(p2);
panelInfo.add(p3);
panelMain.add("Center",
panelInfo);
panelMain.add("South",
p4);
//加事件监听
addListener();
panelInfo.setBorder
(BorderFactory.createTitledBorder("新客户类型信息"));
this.setContentPane(panelMain);
this.setPreferredSize (new
Dimension (250,255));
this.setMinimumSize (new
Dimension (250,255));
this.setResizable(false); //不允许改变窗口大小
pack();
sunswing.setWindowCenter(this); //窗口屏幕居中
}
private void addListener() {
bt1.addActionListener(this);
bt2.addActionListener(this);
tf1.addActionListener(this);
tf2.addActionListener(this);
tf3.addActionListener(this);
}
private boolean isValidity() {
if(tf1.getText().length() == 0)
{
JOptionPane.showMessageDialog(null,
"客户 [ 类型编号 ] 不能为空", "提示",
JOptionPane.INFORMATION_MESSAGE);
tf1.requestFocus(true);
return
false;
}else if(tf2.getText().length()
== 0) {
JOptionPane.showMessageDialog(null,
"客户 [ 类型名称 ] 不能为空", "提示",
JOptionPane.INFORMATION_MESSAGE);
tf2.requestFocus(true);
return
false;
}else
if(!suntools.isNum(tf3.getText(), 2, 1, 10)) {
JOptionPane.showMessageDialog(null,
"[ 折扣比例 ] 只能是数字,且范围在 1-10 之间",
"提示",
JOptionPane.INFORMATION_MESSAGE);
tf3.requestFocus(true);
return
false;
}//Endif
return true;
}
private void saveAddCustomerType() {
if(isValidity())
{ //栓测用户输入的数据是否合法
try {
ResultSet
rs = sunsql.executeQuery("select c_type from customertype " +
"where
delmark=0 and id='" + tf1.getText() + "'");
if(rs.next())
{ //检测新的类型编号是否存在
JOptionPane.showMessageDialog(null,
"新的客户类型编号 [ " + tf1.getText() +
"
] 已存在,不能执行添加操作,请重新核对 ...", "提示",
JOptionPane.INFORMATION_MESSAGE);
tf1.requestFocus(true);
return;
}//Endif
rs
= sunsql.executeQuery("select id from customertype " +