电信IP资费管理系统9-15.doc_第1页
电信IP资费管理系统9-15.doc_第2页
电信IP资费管理系统9-15.doc_第3页
电信IP资费管理系统9-15.doc_第4页
电信IP资费管理系统9-15.doc_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

.电信IP资费管理系统代码重庆文理学院java课9添加资费import java.awt.*;import javax.swing.*;import java.sql.*;import java.awt.event.*;public class 添加资费 extends JPanel implements ActionListener private JPanel p1;private JTextFieldjt=new JTextField 4;private String s=资费名称,月租费用,每小时费用,资费描述;private JButton b=new JButton2;public 添加资费()p1=new JPanel(new BorderLayout();p1.add(new JLabel(添加新的资费政策,JLabel.CENTER),North);JPanel p2=new JPanel(new GridLayout(1,2);JPanel p3=new JPanel(new GridLayout(4,2);p1.add(p2);p2.add(p3);for(int i=0;ijt.length;i+)p3.add(new JLabel(si);jti=new JTextField();p3.add(jti);JPanel p4=new JPanel(new GridLayout(4,1);p2.add(p4);String s2=请输入新建资费名称,请选择新建的月租费用,请输入每小时费用,请输入对新建资费的简单描述;for(int j=0;js2.length;j+)p4.add(new JLabel(s2j);JPanel p5=new JPanel(new java.awt.FlowLayout(FlowLayout.CENTER);String s3=提交,清除;for(int i=0;ib.length;i+)bi=new JButton(s3i);p5.add(bi);bi.addActionListener(this);p1.add(p5,South);this.add(p1);this.setVisible(true);public void actionPerformed(ActionEvent e)if(e.getSource()=b0)tryConnection conn;Statement stmt;Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);conn = DriverManager.getConnection(jdbc:odbc:电信IP资费管理系统);stmt = conn.createStatement();String s1 = ;String s2 = ;s1=p+jt1.getText()+-+jt2.getText();s2=月租+jt1.getText()+元+,+每小时+jt2.getText()+元;jt0.setText(s1);jt1.setText(s2);String sql=insert into source values(+jt0.getText()+,+jt1.getText()+,+jt2.getText()+,+s2+);stmt.executeUpdate(sql);stmt.close();conn.close();this.setVisible(false);this.removeAll();this.add(new 资费列表();this.setVisible(true);catch (SQLException ex) ex.printStackTrace();catch (ClassNotFoundException ex) ex.printStackTrace();if(e.getSource()=b1)for(int i=0;ijt.length;i+)jti.setText(); 10修改个人信息import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 修改个人信息 extends JPanel implements ActionListener,ItemListenerprivate JButton 修改;private JLabel label1=new JLabel14;private JTextField textfield1=new JTextField16;private String string1=,密码*,重复密码*,姓名*,联系方式*,电子邮箱*,付款方式*,职业,省份,性别,公司,公司邮箱,邮编;private JPasswordField mima,chongfumima;private JRadioButton fukuanfangshi=new JRadioButton3;private JRadioButton 男,女;private JComboBox 省份,职业;private String st1,st2,st3,st4,st5,st6,st7,st8,st9,st10;public 修改个人信息()JPanel p1=new JPanel();p1.setLayout(new BorderLayout();JPanel p3=new JPanel();p1.add(p3,South);修改=new JButton(修改);p3.add(修改);修改.addActionListener(this);JPanel p4=new JPanel(new GridLayout(14,1);p1.add(p4,West);for(int i=0;i14;i+)label1i=new JLabel(string1i);p4.add(label1i);JPanel p5=new JPanel(new GridLayout(1,2,0,20);p1.add(p5,Center);JPanel p6=new JPanel(new GridLayout(14,1);p5.add(p6);p6.add(new JLabel();mima=new JPasswordField(123);p6.add(mima);chongfumima=new JPasswordField(132);p6.add(chongfumima);String string2=aaa,62136369,;for(int j=0;j3;j+)textfield1j=new JTextField(string2j);p6.add(textfield1j);JPanel p7=new JPanel(new GridLayout(1,3);p6.add(p7);ButtonGroup fangshi=new ButtonGroup();String s_fangshi=现金支付,银行转账,IP卡充值;for(int i=0;i3;i+)fukuanfangshii=new JRadioButton(s_fangshii);fangshi.add(fukuanfangshii);if(fukuanfangshii.isSelected()st3=+s_fangshi+;p6.add(new JLabel();Object zhiye=软件工程师,部门经理,销售经理,业务经理;职业=new JComboBox(zhiye);职业.addItemListener(this);p6.add(职业);Object shengfen=北京,上海,河南,吉林,黑龙江,天津;省份=new JComboBox(shengfen);p6.add(省份);省份.addItemListener(this);JPanel p8=new JPanel();p6.add(p8);ButtonGroup bg1=new ButtonGroup();男=new JRadioButton(男,true);bg1.add(男);p8.add(男);女=new JRadioButton(女);bg1.add(女);p8.add(女);for(int i=3;i6;i+)textfield1i=new JTextField();p6.add(textfield1i);JPanel p9=new JPanel(new GridLayout(14,1);p5.add(p9);p9.add(new JLabel(aaa的资料管理 状态正常);p9.add(new JLabel(请输入用户的密码);p9.add(new JLabel(请重复以上密码);p9.add(new JLabel(请输入用户的真实姓名);p9.add(new JLabel(请输入有效的联系方式);p9.add(new JLabel(请输入有效的电子邮箱);p9.add(new JLabel();p9.add(new JLabel(以下是附加信息(可不填);p9.add(new JLabel();p9.add(new JLabel();p9.add(new JLabel();p9.add(new JLabel(请输入公司名称(可不填);p9.add(new JLabel(请输入公司的电子邮箱(可不填);p9.add(new JLabel(请输入公司邮政编码(可不填);this.add(p1);this.setVisible(true);public void itemStateChanged(ItemEvent f)st1=+职业.getSelectedItem()+;st2=+省份.getSelectedItem()+;if(男.isSelected()st4=男;if(女.isSelected()st4=女;char mm=mima.getPassword();for(int i=0;imm.length;i+)st5+=+mmi+;public void actionPerformed(ActionEvent e)if(e.getSource()=修改)int message=0;Connection con;Statement sql;ResultSet rs;tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);con=DriverManager.getConnection(jdbc:odbc:电信IP资费管理系统);sql=con.createStatement(1005,1008);rs=sql.executeQuery(select * from consumer);while(rs.next()if(textfield10.getText().equals(rs.getString(name);message=1;String str1=UPDATE consumer SET password=+st5+,+name=+textfield10.getText()+,+telephone=+textfield11.getText()+,+mail+textfield12.getText()+,+methord=+st3+,work=+st1+,+province=+st2+,sex=+st4+,+workplace=+textfield13.getText()+,+mail2=+textfield14.getText()+,+post=+textfield15.getText()+,+WHERE name=+textfield10.getText()+;sql.executeUpdate(str1);break;if(message=0)JOptionPane.showMessageDialog(this, 对不起!此用户名不存在 +请重新输入!, 系统提示,JOptionPane.INFORMATION_MESSAGE);/rs.close();sql.close();con.close();this.setVisible(false);this.removeAll();this.add(new 用户列表();this.setVisible(true);catch(HeadlessException ex)ex.printStackTrace();catch(SQLException ex)ex.printStackTrace();catch(ClassNotFoundException ex)ex.printStackTrace();11用户管理import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 用户管理 extends JPanel implements ActionListenerprivate JButton 开通账户, 用户列表, 查询;private JTextField 账务账号;private JPanel p1, p2, p3, p4, p5;private JButton jb = new JButton3;private JScrollPane jsp1;private Connection con;private Statement sql;private ResultSet rs;private int message = 0;public 用户管理()p1 = new JPanel(new BorderLayout();p2 = new JPanel();p1.add(p2, North);p2.setLayout(new GridLayout(1, 5, 30, 0);开通账户 = new JButton(开通账户);开通账户.addActionListener(this);p2.add(开通账户);用户列表 = new JButton(用户列表);p2.add(用户列表);用户列表.addActionListener(this);p2.add(new JLabel(账务账号);账务账号 = new JTextField();p2.add(账务账号);查询 = new JButton(查询);p2.add(查询);查询.addActionListener(this);p4 = new JPanel(new BorderLayout();p5 = new JPanel(new GridLayout(17, 1);p4.add(p5, East);String s2 = 恢复, 暂停, 删除;int j = 0;for(j = 0; jjb.length; j+)jbj = new JButton(s2j);jbj.addActionListener(this);p5.add(jbj);p3 = new JPanel();p1.add(p3, Center);p3.add(new 用户列表();this.add(p1);this.setVisible(true);public void actionPerformed(ActionEvent e)tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);con = DriverManager.getConnection(jdbc:odbc:电信IP资费管理系统);sql = con.createStatement(1005, 1008);rs = sql.executeQuery(select * from consumer);while(rs.next()String st1 = rs.getString(id);String st2 = 账务账号.getText();if(st2.equals(st1)message = 1;Object ob = new Object16;String s1 = 账号, 姓名, 电话, 邮箱, 性别, 状态;String st4 = rs.getString(state);ob00 = st1;ob01 = rs.getString(name);ob02 = rs.getString(telephone);ob03 = rs.getString(mail);ob04 = rs.getString(sex);ob05 = st4;JTable table1 = new JTable(ob, s1);table1.setSize(500, 50);jsp1 = new JScrollPane(table1);jsp1.setPreferredSize(new Dimension(table1.getWidth(), table1.getHeight();p4.add(jsp1, Center);if(e.getSource() = jb1)String st3 = UPDATE consumer SET state = 暂停 WHERE id = + st2 + ;sql.executeUpdate(st3);if(e.getSource() = jb0)String st5 = UPDATE consumer SET state = 开通 WHERE id = + st2 + ;sql.executeUpdate(st5);if(e.getSource() = jb2)String st6 = DELETE from consumer WHERE id = + st2 + ;sql.executeUpdate(st6);p3.setVisible(false);p3.removeAll();p3.add(new 用户列表();p3.setVisible(true);break;sql.close();con.close();catch(HeadlessException ex)ex.printStackTrace();catch(SQLException ex)ex.printStackTrace();catch(ClassNotFoundException ex)ex.printStackTrace();if(e.getSource() = 开通账户)p3.setVisible(false);p3.removeAll();p3.add(new 开通账户();p3.setVisible(true);/break;if(e.getSource() = 用户列表)p3.setVisible(false);p3.removeAll();p3.add(new 用户列表();p3.setVisible(true);/break;if(e.getSource() = 查询)if(message = 0)JOptionPane.showMessageDialog(this, 您查询的用户不存在, 系统提示, JOptionPane.WARNING_MESSAGE);elsep3.setVisible(false);p3.removeAll();p3.add(p4);p3.setVisible(true);12用户列表import static java.lang.System.out;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.table.*;import java.util.Vector;import java.sql.*;public class 用户列表 extends JPanel implements ActionListenerprivate JTable m_view;private JPanel p1, p2, p3;public 用户列表()JPanel p1 = new JPanel(new BorderLayout();Connection con;Statement stmt;ResultSet rs;tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);catch(ClassNotFoundException f)out.println(SQLException: + f.getLocalizedMessage();trycon = DriverManager.getConnection(jdbc:odbc:电信IP资费管理系统);stmt = con.createStatement(1005, 1008);rs = stmt.executeQuery(select * from consumer);rs.last();int k = rs.getRow();if(k = 0)JOptionPane.showMessageDialog(this, 您查询的表为空表!, 系统提示, JOptionPane.WARNING_MESSAGE);rs.beforeFirst();String ob = new Stringk7;for(int i = 0; ik & rs.next(); i+)obi0 = rs.getString(state);obi1 = rs.getString(id);obi2 = rs.getString(name);obi3 = rs.getString(telephone);obi4 = rs.getString(mail);obi5 = rs.getString(date);String s = 状态, 账务账号, 姓名, 电话, 邮箱, 日期,;m_view = new JTable(ob, s);m_view.setSize(700, 700);m_view.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);JScrollPane sPane = new JScrollPane(m_view);sPane.setPreferredSize(new Dimension(m_view.getWidth() - 300, m_view.getHeight() - 300);p3 = new JPanel(new FlowLayout();p1.add(p3, Center);p3.add(sPane);this.add(p1);this.setVisible(true);con.close();catch(SQLException ex)ex.printStackTrace();public void actionPerformed(ActionEvent e)13用户自服务import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 用户自服务 extends JPanel implements ActionListenerprivate JButton button=new JButton2; private JPanel p1,p2,p3;public 用户自服务()p1=new JPanel(new BorderLayout();p2=new JPanel();p1.add(p2,North);String string=修改个人信息,账单查询;for(int i=0;ibutton.length;i+)buttoni=new JButton(stringi);buttoni.addActionListener(this);p2.add(buttoni);p3=new JPanel();p1.add(p3,Center);p3.add(new 账单查询();this.add(p1);this.setVisible(true);public void actionPerformed(ActionEvent e)if(e.getActionCommand()=修改个人信息)p3.setVisible(false);p3.removeAll();p3.add(new 修改个人信息();p3.setVisible(true);if(e.getActionCommand()=账单查询)p3.setVisible(false);p3.removeAll();p3.add(new 账单查询();p3.setVisible(true);14月账务查询import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 月账务查询 extends JPanel implements ActionListener,ItemListener private JComboBox 年,月; private JButton button; private JTable zhangwu; private String st1,st2,aline=; private JTextArea ta; private JPanel p4; public 月账务查询() JPanel p3=new JPanel(new BorderLayout(); p4=new JPanel(); Connection con; ResultSet rs; Statement sql; try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch(ClassNotFoundException ex) System.out.println(error:+ex); try con=DriverManager.getConnection(jdbc:odbc:电信IP资费管理系统); sql=con.createStatement(1005,1007); rs=sql.executeQuery(select * from serve); rs.last(); int k=rs.getRow(); if(k=0) JOptionPane.showMessageDialog(this,您查询的表为空表!,系统提 示,JOptionPane.WARNING_MESSAGE); rs.beforeFirst(); Object obj=new Objectk2; for(int i=0;ik&rs.next();i+) obji0=rs.getString(serve); obji1=rs.getString(all); String s1=服务器,总计(单位:小时); zhangwu=new JTable(obj,s1); zhangwu.setSize(500,500); JScrollPane jsp1=new JScrollPane(zhangwu); jsp1.setPreferredSize(new Dimension(zhangwu.getWidth(),zhangwu.getHeight(); p4.add(jsp1); p3.add(p4,Center); con.close(); catch(Exception el) System.out.println(el+error:); JPanel p1=new JPanel(new GridLayout(1,15,20,0); Object obj1=2004,2005,2006,2007; 年=new JComboBox(obj1); p1.add(年); 年.addItemListener(this); p1.add(new JLabel(年); Object obj2=1,2,3,4,5,6,7,8,9,10,11,12,; 月=new JComboBox(obj2); p1.add(月); 月.addItemListener(this); p1.add(new JLabel(月); button=new JButton(月账务查询); button.addActionListener(this); p1.add(button); p3.add(p1,North); ta=new JTextArea(); JPanel p2=new JPanel(); p2.add(ta); p3.add(p2,South); this.add(p3); this.setVisible(true)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论