package Conductor;
//改票的子界面
import MovieBook.*;
import java.sql.*;
import java.awt.*;
import javax.swing.*;
import Connection.MySQLCon;
import java.awt.event.*;
public class TicketCView extends JPanel implements ActionListener {
//数据库
Connection con=null;
Statement sql=null;
ResultSet rs=null;
//
Ticket ticket;
JComboBox<String> comBox,comBox2; // 下拉列表
JComboBox<String> startTime,startTime2; // 下拉列表
JComboBox<String> column1; // 下拉列表
JComboBox<String> row1; // 下拉列表
JComboBox<String> column2; // 下拉列表
JComboBox<String> row2; // 下拉列表
int co1=1,co2=1,ro1=1,ro2=1,id=0,Session=0;
String[] name = { "哆啦A梦:伴我同行","白蛇:缘起", "千与千寻", "龙猫", "西游记之大圣归来", "大鱼海棠" };
String[] time = { "9:30:00","12:00:00", "14:40:00","17:20:00" };
JButton comfirm;
String old_movie="哆啦A梦:伴我同行",new_movie="哆啦A梦:伴我同行",old_time="9:30:00",new_time="9:30:00";//默认值
TicketCView(int id) {
this.id=id;
comBox = new JComboBox<String>();
startTime = new JComboBox<String>();
comBox2 = new JComboBox<String>();
startTime2 = new JComboBox<String>();
column1= new JComboBox<String>();
column2= new JComboBox<String>();
row1= new JComboBox<String>();
row2= new JComboBox<String>();
for(int m=0;m<6;m++)
comBox.addItem(name[m]);
for(int m=0;m<4;m++)
startTime.addItem(time[m]);
for(int m=0;m<6;m++)
comBox2.addItem(name[m]);
for(int m=0;m<4;m++)
startTime2.addItem(time[m]);
int c = 8, r = 8;
for (int m = 1; m <=r; m++) {
column1.addItem(m + "");
}
for (int m = 1; m <=c; m++) {
row1.addItem(m + "");
}
for (int m = 1; m <=r; m++) {
column2.addItem(m + "");
}
for (int m = 1; m <=c; m++) {
row2.addItem(m + "");
}
comfirm = new JButton("确认修改!");
add(new JLabel("原本选择的电影名:"));
add(comBox);
add(new JLabel("原本电影开场时间::"));
add(startTime);
add(new JLabel("原本选择的座位:排:"));
add(column1);
add(new JLabel("列::"));
add(row1);
add(new JLabel("目标电影名:"));
add(comBox2);
add(new JLabel("目标电影开场时间::"));
add(startTime2);
add(new JLabel("目标座位:排:"));
add(column2);
add(new JLabel("列::"));
add(row2);
add(comfirm);
//监听下拉框的事件
comBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
old_movie=(String) comBox.getSelectedItem(); }
}
});
comBox2.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
new_movie=(String) comBox2.getSelectedItem(); }
}
});
startTime.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
old_time=(String) startTime.getSelectedItem(); }
}
});
startTime2.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
new_time=(String) startTime2.getSelectedItem(); }
}
});
column1.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
co1=Integer.parseInt((String) column1.getSelectedItem()); }
}
});
column2.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
co2=Integer.parseInt((String) column2.getSelectedItem()); }
}
});
row1.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
ro2=Integer.parseInt((String) row1.getSelectedItem()); }
}
});
row2.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e)
{
//如果选中了一个
if (e.getStateChange() == ItemEvent.SELECTED)
{
//这里写你的任务 ,比如取到现在的值
ro2=Integer.parseInt((String) row2.getSelectedItem()); }
}
});
comfirm.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
//操作数据库——修改
//旧电影的删了,加入新电影
int old_id=0,new_id=0,m,ok=0;
for(m=0;m<6;m++)
{
if(old_movie.equals(name[m]))
old_id=m+1;
if(new_movie.equals(name[m]))
new_id=m+1;
if(new_time.equals("9:30:00"))
Session=1;
if(new_time.equals("12:00:00"))
Session=2;
if(new_time.equals("14:40:00"))
Session=3;
if(new_time.equals("17:20:00"))
Session=4;
}
try {
//连接数据库
con=MySQLCon.connectDB("movieticketing", "root", "123456");
System.out.println("加载成功");
}
catch(Exception e1) { System.out.println(e1);}
//删除旧的
String str;
str="delete from orders where Mid="+old_id+" and "+"clmn="+co1+" and "+"rws="+ro1+" and "+"StartTime="+"'"+old_time+"'"+";";
try {
sql=con.createStatement();
ok=sql.executeUpdate(str);
//插入新的
str="Insert into orders values("+new_id+","+new_id+","+"'"+
new_time+"'"+","+co2+","+ro2+","+id+","+"59.9,"+Session+")";
ok=sql.executeUpdate(str);
con.close();
}
catch(SQLException e1) {
System.out.println(e1);
}
if(ok!=0)
JOptionPane.showMessageDialog(null, "改票成功!","欢迎下次观影!",JOptionPane.WARNING_MESSAGE);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
电影票管理系统.rar (132个子文件)
ChangeInfo.class 6KB
ChangeVView.class 6KB
TicketCView.class 6KB
ChangeMovie.class 5KB
BoxOffice.class 5KB
MovieManage.class 5KB
TicketRView.class 5KB
CheckInfo.class 4KB
NewVedio.class 4KB
EmployeeManage.class 4KB
NewMovie.class 4KB
NewEmployee.class 4KB
ChangeVedio.class 4KB
LoginView.class 4KB
InfoView.class 4KB
TicketInfo$1.class 3KB
Find.class 3KB
HomePage.class 3KB
Enroll.class 3KB
TicketInfo.class 3KB
MovieView.class 3KB
M1View.class 3KB
RegisterView.class 3KB
M5View.class 2KB
M3View.class 2KB
M6View.class 2KB
M4View.class 2KB
M2View.class 2KB
UserLogin.class 2KB
Seat.class 2KB
InsertData.class 2KB
MovieManage$2.class 2KB
Ticket.class 2KB
OrderlyQuery.class 2KB
Seat$1.class 2KB
MainWindow.class 2KB
MySQLCon.class 2KB
M3View$RadioButtonListener.class 2KB
M1View$RadioButtonListener.class 2KB
M4View$RadioButtonListener.class 2KB
M2View$RadioButtonListener.class 2KB
M6View$RadioButtonListener.class 2KB
M5View$RadioButtonListener.class 2KB
MovieBook.class 2KB
TicketRView$1.class 1KB
Register.class 1KB
TicketRView$3.class 1KB
TicketRView$4.class 1KB
TicketRView$2.class 1KB
RLView.class 1KB
MovieView$6.class 1KB
MovieView$1.class 1KB
MovieView$3.class 1KB
MovieView$4.class 1KB
MovieView$2.class 1KB
MovieView$5.class 1KB
Login.class 1KB
HomePage$7.class 1KB
HomePage$2.class 1022B
TicketCView$5.class 1014B
TicketCView$6.class 1014B
TicketCView$7.class 1011B
TicketCView$8.class 1011B
HomePage$5.class 1002B
VedioManage.class 984B
TicketCRView.class 978B
TicketCView$4.class 968B
TicketCView$3.class 967B
TicketCView$2.class 966B
TicketCView$1.class 965B
HomePage$3.class 964B
HomePage$6.class 922B
HomePage$1.class 919B
HomePage$4.class 915B
HomePage$9.class 910B
HomePage$8.class 910B
FEView.class 886B
MemberView.class 784B
TicketCR.class 781B
EmployeeManage$1.class 740B
MovieManage$1.class 714B
BookView.class 686B
test.class 530B
.classpath 545B
运行事项.docx 298KB
mysql-connector-java-8.0.16.jar 2.19MB
TicketCView.java 6KB
MovieView.java 6KB
ChangeInfo.java 5KB
TicketRView.java 5KB
HomePage.java 4KB
ChangeVView.java 4KB
BoxOffice.java 4KB
MovieManage.java 4KB
ChangeMovie.java 4KB
TicketInfo.java 3KB
CheckInfo.java 3KB
EmployeeManage.java 3KB
NewMovie.java 3KB
NewVedio.java 3KB
共 132 条
- 1
- 2
资源评论
zz的大穗禾
- 粉丝: 225
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- base.apk
- Vue 结合 D3.js 进行数据可视化开发的练手案例.zip
- 语音模块使用说明_jr6001调试工具.html
- 毕业设计-reat18货物运输后台管理系统
- Qt tcp通信(exe)
- tensorflow-gpu-2.7.3-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-2.8.0-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.4-cp39-cp39-manylinux2010-x86-64.whl
- HTML后台管理系统源49套合集 H5模板源码下载 总有一款适合你 静态页面
- DDColor-PDF文献
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功