📄 roominfosetting.java~38~
字号:
//-----------------------------------------------------------------------------------------------------
while (rs1l.next()) {
String strRoomID = rs1l.getString("RoomID");
String strClass = rs1l.getString("Class");
String strRoomArea = rs1l.getString("RoomArea");
String strBedNo = rs1l.getString("BedNo");
String strStandardPri = rs1l.getString("StandardPri");
String strRebatePri = rs1l.getString("RebatePri");
String strPlace = rs1l.getString("Place");
String strRoomIntro = rs1l.getString("RoomIntro");
String strRemark = rs1l.getString("Remark");
if (strRoomID.equals(strRoomifID)) {
jTFGetRoomID.setText(strRoomID);
jTFStandardPri.setText(strStandardPri);
jTFRebatePri.setText(strRebatePri);
jTFRoomArea.setText(strRoomArea);
jTFBedNo.setText(strBedNo);
jTAPlace.setText(strPlace);
jTARoomIntro.setText(strRoomIntro);
jTARemark.setText(strRemark);
jCBRoomClass.removeAllItems();
jCBRoomClass.addItem(strClass);
jBEdit.setEnabled(true);
jBDelete.setEnabled(true);
strSearchRoomID = strRoomifID;
jTFQueryRoomID.setText("");
return;
}
} //while
JOptionPane.showMessageDialog(null, "您所查找的内容不在库中!", "系统警告",
JOptionPane.WARNING_MESSAGE);
jTFQueryRoomID.setText("");
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
try {
if (Connect1.con1 != null) {
Connect1.con1.close(); //关闭数据库admin
Connect1.stmt1.close();
} //if
} catch (SQLException ex) {
System.out.println(ex);
} //catch
} //finally
}
public void jBEditFinish_actionPerformed(ActionEvent e) {//修改完成
String strRoomID = jTFGetRoomID.getText();
String strClass = jCBRoomClass.getSelectedItem().toString();
if (strClass.equals(" ")) {
JOptionPane.showMessageDialog(null,
"客房类型不能为空,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
return;
}
String strRoomArea = jTFRoomArea.getText();
if (!judgeval.IsNumberAndLetter(strRoomArea)) {
JOptionPane.showMessageDialog(null,
"客房面积需由数字和字母组成,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFRoomArea.setText("");
return;
}
String strBedNo = jTFBedNo.getText();
if (!judgeval.isFigure(strBedNo)) {
JOptionPane.showMessageDialog(null,
"房位数必须是数字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFBedNo.setText("");
return;
}
if (strBedNo.length() > 4) {
JOptionPane.showMessageDialog(null,
"房位数不能超过四位,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFBedNo.setText("");
return;
}
String strStandardPri = jTFStandardPri.getText();
if (!judgeval.isFigureWhitPoint(strStandardPri)) {
JOptionPane.showMessageDialog(null,
"标准价必须是数字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFStandardPri.setText("");
return;
}
if (strStandardPri.length() > 8) {
JOptionPane.showMessageDialog(null,
"标准价不能超过八位,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFStandardPri.setText("");
return;
}
String strRebatePri = jTFRebatePri.getText();
if (!judgeval.isFigureWhitPoint(strRebatePri)) {
JOptionPane.showMessageDialog(null,
"折扣价必须是数字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTFRebatePri.setText("");
return;
}
String strPlace = jTAPlace.getText();
if (strPlace.length() > 100) {
JOptionPane.showMessageDialog(null,
"具体位置不能超过50个汉字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTAPlace.setText("");
return;
}
String strRoomIntro = jTARoomIntro.getText();
if (strRoomIntro.length() > 500) {
JOptionPane.showMessageDialog(null,
"具体位置不能超过250个汉字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTARoomIntro.setText("");
return;
}
String strRemark = jTARemark.getText();
if (strRoomIntro.length() > 500) {
JOptionPane.showMessageDialog(null,
"备注不能超过250个汉字,请重新输入!",
"酒店信息管理系统警告",
JOptionPane.WARNING_MESSAGE);
jTARemark.setText("");
return;
}
//-------------------------------------------------------------------------
try {
Connect1 = new DataConnect();
Connect1.con1 = DriverManager.getConnection(Connect1.url); //建立连接
Connect1.stmt1 = Connect1.con1.createStatement(); //创建语句
Connect1.sql1 = " UPDATE HIMS_RoomInfo SET RoomID = '" + strRoomID +
"' , Class = '" + strClass +
"', RoomArea = '" + strRoomArea + "', BedNo= '" +
strBedNo + "', StandardPri = '"
+ strStandardPri + "', RebatePri = '" +
strRebatePri +
"', Place= '" + strPlace + "', RoomIntro = '"
+ strRoomIntro + "', Remark = '" + strRemark +
"'where RoomID = '" + strRoomID +
"'";
Connect1.stmt1.executeUpdate(Connect1.sql1);
JOptionPane.showMessageDialog(this, "修改成功!", "酒店信息管理系统警告",
JOptionPane.INFORMATION_MESSAGE);
jBSetRoomState.setEnabled(false);
jBQueryRoomID.setEnabled(true);
jTFQueryRoomID.setEnabled(true);
jBEdit.setEnabled(false);
jBEditFinish.setEnabled(false);
jBDelete.setEnabled(false);
jBNewBuild.setEnabled(true);
jBNewBuildFinish.setEnabled(false);
jCBRoomClass.setEnabled(false);
jTFStandardPri.setEnabled(false);
jTFRebatePri.setEnabled(false);
jTARoomIntro.setEnabled(false);
jTARemark.setEnabled(false);
jTFRoomArea.setEnabled(false);
jTFBedNo.setEnabled(false);
jTAPlace.setEnabled(false);
jTFGetRoomID.setEnabled(false);
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
try {
if (Connect1.con1 != null) {
Connect1.con1.close(); //关闭数据库
Connect1.stmt1.close();
} //if
} catch (SQLException ex) {
System.out.println(ex);
} //catch
} //finally
}
}
class RoomInfoSetting_jBEditFinish_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBEditFinish_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBEditFinish_actionPerformed(e);
}
}
class RoomInfoSetting_jBQueryRoomID_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBQueryRoomID_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBQueryRoomID_actionPerformed(e);
}
}
class RoomInfoSetting_jBEdit_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBEdit_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBEdit_actionPerformed(e);
}
}
class RoomInfoSetting_jBDelete_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBDelete_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBDelete_actionPerformed(e);
}
}
class RoomInfoSetting_jBNewBuildFinish_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBNewBuildFinish_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBNewBuildFinish_actionPerformed(e);
}
}
class RoomInfoSetting_jBValRoomID_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBValRoomID_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBValRoomID_actionPerformed(e);
}
}
class RoomInfoSetting_jBNewBuild_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBNewBuild_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBNewBuild_actionPerformed(e);
}
}
class RoomInfoSetting_jBSetRoomState_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBSetRoomState_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBSetRoomState_actionPerformed(e);
}
}
class RoomInfoSetting_jBQuit_actionAdapter implements ActionListener {
private RoomInfoSetting adaptee;
RoomInfoSetting_jBQuit_actionAdapter(RoomInfoSetting adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jBQuit_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -