RFID图书管理系统程序源代码
图书管理系统数据库源代码

图书管理系统数据库源代码//创建工程及设计主界面public class Main extends JFrame{private static final JDesktopPane{DESKTOP_PANE=new JDesktopPane(); //桌面窗体}public static void main(String[] args) //入口方法{try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //设置系统界面外观new BookLogin(); //登录窗口}catch(Exception ex){ex.printStackTrace();}}public static void addIFame(JInternalFrame iframe) //添加子窗体的方法{DESKTOP_PANE.add(iframe); //新增子窗体}public Main(){super(); //设置“关闭”按钮处理事件setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); //创建工具栏Toolkit tool=Toolkit,getDefaultToolkit(); //获得屏幕大小Dimension screenSize=tool.getScreenSize();setSize(800,600); //设置窗体大小setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2; //设置窗体位置setTitle("图书管理系统");//设置窗体标题JMenuBar menuBar=createMenu(); //创建菜单栏setJMenuBar(menuBar); //设置菜单栏JToolBar toolBar=createToolBar(); //创建工具栏的方法getContentPane(),add(toolBar,BorderLayout.NORTH); //设置工具栏final JLable lable=new JLable(); //创建一个标签,用来显示图片lable.setBounds(0,0,0,0); //设置窗体的大小和位置lable.setIcon(null); //窗体背景DESKTOP_PANE.addComponentListener(new ComponentAdapter()){public void componentResized(final ComponentEvent e){Dimension size=e.getComponent().getSize(); //获得组建大小lable.setSize(e.getComponent().getSize()); //设置标签大小lable.setText("<html><imgwidth="+size.width+"height="+size.height+"src='"+this.getClass().getResource("/bac kImg.jpg")+"'></html>");//设置标签文本,设置窗口背景}} //将标签添加到桌面窗体DESKTOP_PANE.add(lable,new Integer(Integer.MIN_V ALUE));getContentPane().add(DESKTOP_PANE); //将桌面窗体添加到主窗体中}}private JToolBar createToolBar() //创建工具栏的方法{JToolBar toolBar=new JToolBar(); //初始化工具栏toolBar.setFloatable(false); //设置是否可以移动工具栏toolBar.setBorder(new BevelBorder(BevelBorder.RAIZED)); //设置边框//图书信息添加按钮JButton bookAddButton=new JButton(MenuActions.BOOK_ADD);ImageIcon icon=new ImageIcon(Main.class.getResource("/bookAddtb.jpg")); //添加菜单栏图标bookAddButton.setIcon(icon); //设置按钮图标bookAddButton.setHideActionText(true); //显示提示文本toolBar.add(bookAddButton); //添加到工具栏中JButton bookModiAndDelButton=new JButton(MenuActions.BOOK_MODIFY); //图书信息修改按钮ImageIcon bookmodiicon=Icon.add("bookModiAndDeltb.jpg"); //创建图表方法bookModiAndDelButton.setIcon(bookmodiicon); //设置按钮图标bookModiAndDelButton.setHideActionText(true); //显示提示文本toolBar.add(bookModiAndDelButton); //添加到工具栏JButton bookTypeAddButton=new JButton(MenuActions.BOOKTYPE_ADD); //图书类别添加按钮ImageIcon bookTypeAddicon=Icon.add("bookTypeAddtb.jpg"); //创建图标方法bookTypeAddButton.setIcon(bookTypeAddicon); //设置按钮图标bookTypeAddButton.setHideActionText(true); //显示提示文本toolBar.add(bookTypeAddButton); //添加到工具栏JButton bookBorrowButton=new JButton(MenuActions.BORROW); //图书借阅按钮ImageIcon bookBorrowicon=Icon.add("bookBorrowtb.jpg"); //创建图标方法bookBorrowButton.setIcon(bookBorrowicon); //设置按钮图标bookBorrowButton.setHideActionText(true); //显示提示文本toolBar.add(bookBorrowButton); //添加到工具栏JButton bookOrderButton=new JButton(MenuActions.NEWBOOK_ORDER); //新书订购按钮ImageIcon bookOrdericon=Icon.add("bookOrdertb.jpg"); //创建图标方法bookOrderButton.setIcon(bookOrdericon); //设置按钮图标bookOrderButton.setHideActionText(true); //显示提示文本toolBar.add(bookOrderButton); //添加到工具栏JButton bookCheckButton=new JButton(MenuActions.NEWBOOK_CHECK); //验收新书按钮ImageIcon bookCheckicon=Icon.add("newbookChecktb.jpg"); //创建图标方法bookCheckButton.setIcon(bookCheckicon); //设置按钮图标bookCheckButton.setHideActionText(true); //显示提示文本toolBar.add(bookCheckButton); //添加到工具栏JButton readerAddButton=new JButton(MenuActions.READER_ADD); //读者信息添加按钮ImageIcon readerAddicon=Icon.add("readerAddtb.jpg"); //创建图标方法readerAddButton.setIcon(readerAddicon); //设置按钮图标readerAddButton.setHideActionText(true); //显示提示文本toolBar.add(readerAddButton); //添加到工具栏JButton readerModiAndDelButton=new JButton(MenuActions.READER_MODIFY); //读者信息修改按钮ImageIcon readerModiAndDelicon=Icon.add("readerModiAndDeltb.jpg"); //创建图标方法readerModiAndDelButton.setIcon(readerModiAndDelicon); //设置按钮图标readerModiAndDelButton.setHideActionText(true); //显示提示文本toolBar.add(readerModiAndDelButton); //添加到工具栏JButton ExitButton=new JButton(MenuActions.EXIT); //退出系统按钮ImageIcon Exiticon=Icon.add("exittb.jpg"); //创建图标方法ExitButton.setIcon(Exiticon); //设置按钮图标ExitButton.setHideActionText(true); //显示提示文本toolBar.add(ExitButton); //添加到工具栏return toolBar;}public class Business{protected static String dbClassName="com.mysql.jdbc.Driver"; //数据库驱动类protected static String dbUr1="jdbc:mysql://localhost/ts"; //连接URLprotected static String dbUser="root"; //数据库用户名protected static String dbpwd="root"; //数据库密码private static Connection conn=null; //数据库连接对象,初值为null public Business(){try{if(coon==null) //连接对象为空{Class.forName(dbClassName); //加载驱动类信息conn=DriverManager.getConnection(dbUr1,dbUser,dbPwd); //建立连接对象}}catch(Exception ee){ee.printStackTrace();}}public static ResultSet executeQuery(String sql) //执行查询方法{try{//如果连接对象为空,则重新调用构造方法if (conn==null){new Business();returnconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_ UPDATABLE).executeQuery(sql);//执行查询}}catch(SQLException e){e.printStackTrace();return null; //返回null值}finally{}}public static int executeUpdata(String sql) //更新方法{try{if(conn==null){new Business(); //如果连接对象为空,则重新调用构造方法return conn.createStatement().executeUpdate(sql); //执行更新}}catch(SQLException e){e.printStackTrace();return -1;}finally{}}public static void close() //关闭方法try{conn.close(); //关闭连接对象}catch(SQLException e){e.printStackTrace();}finally{conn=null; //设置连接对象为null值}}}//为数据库添加对应的类public class BookInfo{private String Book_id; //图书编号private String typeid; //类别编号private String writer; //作者private String translator; //译者private String publisher; //出版社private Date date; //出版日期private Double price; //图书单价private String getBookname; //图书名称public String getBookname(){return bookname;}public void setBookname(String bookname){this.bookname=bookname;}public Date getDate(){return date;}public void setDate(Date date){this.date=date;}public string getBook_id()return Book_id;}public void setBook_id(String Book_id) {this.Book_id=Book_id;}public Double getPrice(){return price;}public void setprice(Double price){this.price=price;}public String getPublisher(){return Publisher;}public void setPublisher(String publisher) {this.Publisher=Publisher;}public String getTranslator(){return translator;}public void setTranslator(String translator) {this.translator=translator;}public String getTypeid(){return typeid;}public void setTypeid(String typeid){this.typeid=typeid;}public String getWriter(){return writer;}public void setWriter(String writer)this.writer=writer;}}public class BookType //图书列表信息类{private String id; //图书类别编号private String typeName; //图书类别名称private String days; //可解天数private String fk; //每罚款金额public String getFk(){return fk;}public void setFk(String fk){this.fk=fk;}public String getDays(){return days;}public void setDays(String days){this.days=days;}public string getId(){return id;}public void setId(String id){this.Bid=id;}public String getTypeName(){return typeName;}public void setTypeName(String typeName){this.typeName=typeName;}}public class Order //图书订单信息类{private String Book_id; //图书编号private Date date; //下单时间private String number; //图书数量private String operator; //操作员private String checkAndAccept; //是否收到货private String zk; //图书折扣public String getcheckAndAccept(){return checkAndAccept;}public void setcheckAndAccept(String checkAndAccept) {this.checkAndAccept=checkAndAccept;}public Date getDate(){return date;}public void setDate(Date date){this.date=date;}public string getBook_id(){return book_id;}public void setBook_id(String book_id){this.book_id=book_id;}public String getNumber(){return number;}public void setNumber(String number){this.number=number;}public String getOperator(){return operator;}public void setOperator(String operator){this.operatorr=operator;}public String getZk(){return zk;}public void setZk(String Zk){this.zk=zk;}}public class Operater{private String id; //操作员编号private String name; //操作员用户名private String grade; //操作员等级private String password; //操作员密码private String type; //出版社public String getType(){return type;}public void setType(String type){this.type=type;}public string getGrade(){return grade;}public void setGrade(String grade){this.grade=grade;}public String getId(){return id;}public void setId(String id){this.id=id;}public String getName()return name;}public void setName(String name){=name;}public String getPassword(){return password;}public void setPassword(String password){this.password=password;}}public class Borrow //书籍借阅信息类{private int id; //借阅编号private String book_id; //图书编号private String reader_id; //读者编号private String num; //借书数量private String borrowDate; //借书日期private String backDate; //应还日期private String Bookname; //图书名称public String getBookname(){return bookname;}public void setBookname(String bookname){this.bookname=bookname;}public string getBackDate(){return backDate;}public void setBackDate(String backDate){this.backDate=backDate;}public string getBorrowDate(){return borrowDate;public void setBorrowDate(String borrowDate){this.borrowDate=borrowDate;}public String getNum(){return num;}public void setNum(String num){this.num=num;}public String getBook_id(){return book_id;}public void setBook_id(String book_id){this.book_id=book_id;}public String getReader_id(){return reader_id;}public void setReader_id(String reader_id){this.reader_id=reader_id;}public int getId(){return id;}public void setId(Int id){this.id=id;}}public class Back //图书归还信息类{private String book_id; //图书编号private String bookname; //图书名称private String operatorId; //操作员编号private String borrowDate; //图书借阅时间private String backDate; //图书归还时间private String readerName; //读者姓名private String reader_id; //读者编号private int typeId;private int id;public int getId(){return id;}public void setId(int id){this.id=id;}public int getTypeId(){return typeid;}public void setTypeId(int typeid){this.typeId=typeId;}public string getBackDate(){return backDate;}public void setBackDate(String backDate) {this.backDate=backDate;}public String getBookname(){return bookname;}public void setBookname(String bookname) {this.bookname=bookname;}public string getBorrowDate(){return borrowDate;}public void setBorrowDate(String borrowDate) {this.borrowDate=borrowDate;}public String getOperatorId(){return operatorId;}public void setOperatorId(String operatorId){this.operatorId=operatorId;}public String getBook_id(){return book_id;}public void setBook_id(String book_id){this.book_id=book_id;}public String getReader_id(){return reader_id;}public void setReader_id(String reader_id){this.reader_id=reader_id;}public String getReaderName(){return readerName;}public void setReaderName(String readerName){this.readerName=readerName;}}//系统登录模块设计public class BookLogin extends JFrame{private static final Operater Type=null; //人员类型private static Operater user; //用户名private JPasswordField password;private JTextField username;private JButton login;private JButton reset;public BookLogin(){super();final BorderLayout borderLayout=new BorderLayout(); //创建布局管理器setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置“关闭”按钮处理事件borderLayout.setVgap(10); //设置组件间的垂直关系getContentPane().setLayout(borderLayout); //使用布局管理器setTitle("图书管理系统登录") //设置窗体标题Toolkit tool=Toolkit.getDefaultToolkit(); //获得默认的工具箱Dimension screenSize=tool.getScreenSize(); //获得屏幕的大小setSize(285,194);setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2); //设置窗体位置final JPanel mainPanel=new JPanel(); //创建主面板mainPanel.setLayout(new BorderLayout()); //设置边框布局mainPanel.setBorder(new EmptyBorder(0,0,0,0)) //设置边框为0getContentPane().add(mainPanel); //在窗体中加入主面板final JLabel imageLabel=new JLabel; //创建一个标签,用来显示图片ImageIcon loginIcon=Icon.add("login.jpg"); //创建一个图像图标imagelabel.setIcon(loginIcon); //设置图片imageLabel.setOpaque(true); //设置绘制其边界内的所有像素imageLabel.setBackground(Color.GREEN); //设置背景颜色imageLabel.setpreferredSize(new Dimension(260,60)); //设置标签大小mainPanel.add(imageLabel,BorderLayout.NORTH); //添加标签到主面板final JPanel centerPanel=new JPanel(); //添加一个中心面板final GridLayout gridLayout=new GridLayout(2,2); //创建网络布局管理器gridLayout.setHgap(5); //设置组件之间平行的距离gridLayout.setVgap(20); //设置组件之间垂直的距离centerPanel.setLayout(gridLayout); //使用布局管理器mainPanel.add(centerPanel); //添加到主桌面final JLabel userNamelabel=new JLabel(); //创建一个标签userNameLabel.setHorizontalAlignment(SwingConstants.CENTER); //设置对齐方式userNameLabel.setPreferredSize(new Dimension(0,0)); //设置组件大小userNameLabel.setMinimumSize(new Dimension(0,0)); //设置组件最小的大小centerPanel.add(userNameLabel); //添加到中心面板userNameLabel.setText("用户名:"); //设置标签文本username=new JTextField(20); //创建文本框username.setPreferredSize(new Dimension(0,0)); //设置组件大小centerPanel.add(username); //添加到中心面板final JLabel passwordLabel=new JLabel(); //创建一个标签passwordLabel.setHorizontalAlignment(SwingConstants.CENTER); //设置对齐方式centerPanel.add(passwordLabel); //添加到中心面板passwordLabel.setText("密码:"); //设置标签文本password=new JPasswordField(20); //创建密码框password.setDocument(new Document(6)); //设置密码长度为6password.addKeyListener(new KeyAdapter() //监听密码框{public void keyPressed(final keyEvent e) //监听键盘案件事件{if(e.getKeyCode()==10) //如果按了回车键{login.doClick(); //进行登录}}})centerPanel.add(password); //添加到中心面板final JPanel southPanel=new JPanel; //新增一个底部面板mainPanel.add(southPanel,BorderLayout.SOUTH); //添加到主面板中login=new JButton(); //创建按钮组件login.addActionListener(new BookLoginAtion()); //添加监听器login.setText("登录"); //设置按钮文本southPanel.add(login); //把按钮添加到底部面板reset=new JButton(); //创建按钮组件reset.addActionListener(new BookResetAction()); //添加监听器reset.setText("重置");//设置按钮文本southPanel.add(reset); //把按钮添加到底部面板setVisible(true); //设置创建可见setResizable(false); //设置窗体不可改变大小}public static Operater getUser(){return user;}public static Operater getType(){return Type;}public static void setUser(Operater user){er=user;}}private class BookResetAction implements ActionListener{public void actionPerformed(final ActionEvent e){username.setText(""); //设置用户名输入框为空password.setText(""); //设置密码输入框为空}}private class BookLoginAction implements ActionListener{public void actionPerformed(final ActionEvent e){user=Business.check(username.getText(),newString(password.getPassword())); //调用business方法if(user.getName()!=null) //判断用户名是否为null{try{Main frame=new Main(); //创建一个主窗体frame.setVisible(true); //设置其可见BookLogin.this.setVisible(false); //设置登录窗体为不显示}catch(Exception ex){ex.printStackTrace();}}else{JOptionPane.showMessageDialog(null,"请输入正确的用户名和密码!"); //弹出提示框username.setText(""); //设置用户名输入框为空password.setText(""); //设置密码输入框为空}}}//基本信息管理模块public class ReaderAdd extends JInternalFrame //添加读者信息{public ReaderAdd(){super();setTitle("读者相关信息添加");setIconifiable(true); //设置窗体可最小化setClosable(true); //设置窗体可关闭setBounds(100,100,500,350);final JLabel logoLabel=new JLabel();ImageIcon readerAddIcon=Icon.add("readerAdd.jpg");logoLabel.setIcon(readerAddIcon);logoLabel.setOpaque(true);logoLabel.setBackground(Color.CYAN);logoLabel.setPreferredSize(new Dimension(400,60));getContentPane().add(logoLabel,BorderLayout.NORTH);final JPanel panel=new JPanel();panel.setLayout(new FlowLayout());getContentPane().add(panel);final JPanel panel_1=new JPanel();final GridLayout gridLayout=new GridLayout(0,4);gridLayout.setVgap(15);gridLayout.setHgap(15);panel_1.setLayout(gridLayout);panel_1.setPreferredSize(new Dimension(450,200));panel.add(panel_1);final JLabel label_2=new JLabel();label_2.setText("姓名:");panel_1.add(label_2);readername=new JTextField();readername.setDocument(new Document(10));panel_1.add(readername);final JLabel label_3=new JLabel();public void actionPerformed(final ActionEvent e){Check validator=new Check(); //校验类String zj=String.valueof(comboBox.getSelectedIndex());String id=read_id.getText().trim();Vector v1=new Vector();v1.clear();v1.add("reader"); //读取配置文件中相应的查询语句v1.add(id);if(l==validator.Validate(V1)) //检查是否存在该读者{JOptionPane.showMessageDialog(null,"添加失败,该读者编号已存在!");}else{Inti=Business.InsertReader(readername.getText().trim(),sex.trim(),age.getText().trim(),zj number.getText().trim(),Date.valueOf(date.getText().trim()),maxnumber.getText().trim().tel.getText().trim (),Double.valueof(keepmoney.getText().trim()),zj,zy.getText().trim(),Date.valueOf(bztime.getText().trim()),read_id.getText().tri m());if(i==1){JOptionPane.showMessageDialog(null,"添加成功!");doDefaultCloseAction();}}}}class TelListener extends KeyAdapter{public void keyTyped(KeyEvent e){String numStr="0123456789-"+(char)8; //类型转换if(numStr.indexOf(e.getKeyChar())<0){e.consume();}}}//添加“关闭”按钮的事件监听器class CloseActionListener implements ActionListener{public void actionPerformed(final ActionEvent e){doDefaultCloseAction();}}private String[] columnNames("名称","性别","年龄","证件号码","借书证有效日期","借书量","电话","押金","证件","职业","读者编号","办证时间");private String[] array=new String[]{"身份证","军人证","学生证"};String id;private Object[][] getFileStates(List list){Object[][]results=new Object[list.size()][columnNames.length];for(int i=0;i<list.size();i++){Reader reader=(Reader)list.get(i);result[i][0]=reader.getName(); //定义二维数组String sex;if(reader.getSex().equals("1")){sex="男";}else{sex="女";}results[i][1]=sex; //读取读者歌属性值results[i][2]=reader.getAge();results[i][3]=reader.getIdentityCard();results[i][4]=reader.getDate();results[i][5]=reader.getMaxNum();results[i][6]=reader.getTel();results[i][7]=reader.getKeepMoney();results[i][8]=array[reader.getZj()];results[i][9]=reader.getZy();results[i][10]=reader.getBook_id();results[i][11]=reader.getBZtime();}return results;}//图书类别管理//添加图书信息utton.addActionListener(new ActionListener(){public void actionPerformed(final ActionEvent e){if(bookTypeName.getText().length()==0){JOptionPane.showMMessageDialog(null,"图书类别文本框不可为空");return;}if(days.getText().length()==0){JOptionPane.showMessageDialog(null,"可借天数文本框不可为空");return;}if(!check.isNumeric(days.getText().trim())){JOptionPane.showMessageDialog(null,"可借天数必须为数字");return;}if(fakuan.getText().length()==0){JOptionPane.showMessageDialog(null,"罚款文本框不可为空");return;}if(!check.isNumeric(fakuan.getText().trim())){JOptionPane.showMessageDialog(null,"罚款必须为数字");return;}inti=Business.InsertBookType(bookTypeName.getText().trim(),days.getText().trim(),Do uble.valueof(fakuan.getText.trim())/10);if(i==1){JOptionPane.showMessageDialog(null,"添加成功!");doDefaultCloseAction();}}});panel_6.add(button);final JButton buttonDel=new JButton();buttonDel.setText("关闭");buttonDel.addActionListener(new ActionListener(){public void actionPerformed(final ActionEvent e){doDefaultCloseAction();}});panel_6.add(buttonDel);setVisibel(true);}//修改图书类class ButtonAddListener implements ActionListener{public void actionPerformed(ActionEvent e){Object selectedItem=bookTypeModel.getSelectedItem();inti=Business.UpdatebookType(BookTypeId.getText().trim(),selectedItem.toString(),day s.getText().trim(),fk.getText().trim());if(i==1){JOptionPane.showMessageDialog(null,"修改成功");object[][] results=getFileStates(Business.selectBookCategory());model.setDataVector(results.columnNames);table.setModel(model);}}}。
C语言课程设计图书馆管理系统程序代码

#include〈stdio.h〉#include<windows.h〉#include〈string。
h〉#include<conio。
h>#define M 100struct books{char tsmc[12];inttsbh;float dj;char zz[12];char czzt[12];char xm[12];char xb[12];intxh; }s[M];int N;bool flag;intmain (){intsele;flag=0;sele=1;void sr();void cx();void sc();void js();void hs();void tc();void jsh();//system ("tsgl”);printf("\n\n");printf(" ************************\n"); printf(" 1:输入2:查询3:删除\n");printf(”4:借书5:还书0:退出\n");printf(” ************************\n"); while(1){printf(”\n\n请输入功能序号:");scanf (”%d",&sele);if(sele>=0 && sele<=5){switch(sele){case 1:sr();break;case 2:cx();break;case 3:sc();break;case 4:js();break;case 5:hs();break;case 0:jsh();break;}if(flag)break;printf(”\n\n");printf(” ************************\n”); printf(" 1:输入2:查询3:删除\n");printf(”4:借书5:还书0:退出\n”);printf(” ************************\n”);}else{printf(”输入错误请再次输入|\n\n");printf("\n\n");printf(” ************************\n”);printf(" 1:输入2:查询3:删除\n”);printf(”4:借书5:还书0:退出\n");printf(" ************************\n");}printf("\n\n让任意键继续\n”);} //wr_file();}/******主函数***//*********输入*********/void sr(){intn,i;N=0;printf("可输入的书本数:");scanf("%d",&n);N=n+N;printf("请输入相关信息:\n");for(i=1;i<=n;i++){printf(”图书名称:”);scanf(”%s",s[N-n-1+i]。
图书馆管理系统源代码

源程序清单1、文件名 login(login.frm)功能说明:整个系统的登陆界面,需要输入用户名和登陆密码才能进入到系统中,进行借阅等操作。
源代码:Option ExplicitDim cnt As IntegerPrivate Sub Command1_Click()Dim sql As StringDim rs_login As New ADODB.RecordsetIf Trim(Combo1.Text) = "" ThenMsgBox "没有这个用户", vbOKOnly + vbExclamation, ""Combo1.SetFocusElsesql = "select * from 系统管理 where 用户名='" & Combo1.Text & "'" rs_login.Open sql, conn, adOpenKeyset, adLockPessimisticIf rs_login.EOF = True ThenMsgBox "没有这个用户", vbOKOnly + vbExclamation, ""Combo1.SetFocusElseIf Trim(rs_login.Fields(1)) = Trim(txtpwd.Text) ThenuserID = Combo1.Textrs_login.CloseUnload Meform1.ShowElseMsgBox "密码不正确", vbOKOnly + vbExclamation, ""txtpwd.SetFocusEnd IfEnd Ifcnt = cnt + 1If cnt = 3 ThenUnload MeEnd IfExit SubEnd SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Dim connectionstring As Stringconnectionstring = "provider=Microsoft.Jet.oledb.4.0;" & _"data source=book.mdb"conn.Open connectionstringcnt = 0End SubPrivate Sub txtuser_Change()End Sub2、文件名 form1(form1.frm)功能说明:整个系统的主界面,其中包括图书管理、读者管理、图书借阅管理、系统管理、关于,以及在这下面的子菜单。
图书馆管理系统完整代码

out.println("<h3>"+login+"</h3>"); %> </div></body> </html>
logon.jsp <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 "/TR/html4/loose.dtd"> <html> <script language="JavaScript">
{ alert("请输入有效电话!"); return false;
} } var em,index; em=myform.email.value; index=myform.email.value.indexOf('@'); if(index<=0||index>=em.length-1) {
alert("请输入合法的电子邮件地址!"); return false; } } </script> <head> <title>用户注册</title> </head> <body><div align="center"><h2> 用户注册 </h2> <%!String sex=null; %> <form action="dealLogon.jsp" method="post" onSubmit="return check()" name="myform"> <table height="100%" border="1" align="center" width="90%"> <tbody><tr> <td align="right">用户名:<br></td> <td align="left"><input type="text" name="username"></td></tr> <tr> <td align="right">真实姓名:<br></td> <td align="left"><input type="text" name="truename"></td></tr> <tr> <td align="right">密码:</td> <td align="left"><input type="password" name="password"></td></tr> <tr> <td align="right">确认密码:</td> <td align="left"><input type="password" name="confirmPassword"></td></tr> <tr> <td align="right">年龄: </td> <td align="left"><input type="text" name="age"></td></tr> <tr> <td align="right">性别:</td> <td align="left"><input type="radio" name="sex" value="男" <%if(sex.equals("男")) out.println("checked");%>> <img src="Images/boy.gif" width="24" height="24">男
(完整word版)图书管理系统源代码

图书管理系统源代码(一)程序代码1。
主窗口界面import java.awt。
*;import java.awt。
event.*;import javax。
swing.*;import javax.swing.border.TitledBorder;import java.awt。
Font;import javax.swing。
JMenu;public class MainWindow extends JFrame implements ActionListener { private static final long serialVersionUID = 1L;static String loginName;static String loginNo;JLabel mlabel;JPanel jp=new JPanel();//建立菜单栏JMenu a=new JMenu();JMenu b=new JMenu();JMenu c=new JMenu();//建立系统管理菜单组JMenuItem aa=new JMenuItem();JMenuItem ab=new JMenuItem();JMenuItem ac=new JMenuItem();//建立读者管理菜单组JMenuItem bb=new JMenuItem();//建立书籍管理菜单组JMenuItem ca=new JMenuItem();JMenuItem cb=new JMenuItem();JMenuItem cc=new JMenuItem();JMenuItem cd=new JMenuItem();public MainWindow(){super(”图书管理系统");addWindowListener(new WindowAdapter(){System.exit(0);}});Container d=getContentPane();this。
RFID图书管理系统程序源代码

登陆界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Labrary{public partial class FormLogin : Form{public FormLogin(){InitializeComponent();}页脚内容1///<summary>///验¨¦证¡è控?件t///</summary>///<returns></returns>private bool ValidControl(){if (this.tbID.Text == ""){MessageBox.Show("请填写用户名!ê?");this.tbID.Focus();return false;}if (this.tbID.Text != "admin"){if (!UserManage.ObjUser.IsHasID(All.dbo, this.tbID.Text)){页脚内容2MessageBox.Show("不存在此用户!ê?");this.tbID.Text = "";this.tbID.Focus();return false;}}if (this.tbID.Text != "admin"){UserManage.ObjUser user= new UserManage.ObjUser(this.tbID.Text, All.dbo);if (user.PWD != this.tbPWD.Text){MessageBox.Show("密码错误!ê?");this.tbPWD.Text = "";this.tbPWD.Focus();return false;}页脚内容3}else{if (this.tbPWD.Text != "123456"){MessageBox.Show("密码错误!");this.tbPWD.Text = "";this.tbPWD.Focus();return false;}}return true;}private void gbtnCancel_Click(object sender, EventArgs e) {页脚内容4this.Close();}private void gbtnOK_Click(object sender, EventArgs e){//如¨?果?验¨¦证¡è控?件t通ª¡§过yif (ValidControl()){if (this.tbID.Text != "admin"){erLogin = new UserManage.ObjUser(this.tbID.Text, All.dbo);}else{erLogin = new UserManage.ObjUser(All.dbo);erLogin.ID = "admin"; = "管理员";页脚内容5}this.DialogResult = DialogResult.OK;this.Close();}}}}主界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;页脚内容6namespace Labrary{public partial class FormMain : Form{public const int WM_USER = 0x0400;public const int WM_GETBUFFER_LOOP = WM_USER + 2;private RFID_dll.Reader rdr;private RFID_dll.RFID rfid;List<string> rfids = new List<string>();int directionFlag = 0;//1进;出?FormInAndOut fiao = new FormInAndOut();public FormMain(){InitializeComponent();页脚内容7this.rdr = new RFID_dll.Reader();//this.rfid = new RFID_dll.RFID(rdr);}private void FormMain_Load(object sender, EventArgs e) {Init();}///<summary>///初始化///</summary>private void Init(){fiao.StartPosition = FormStartPosition.Manual;//多窗体在不同时间显示Screen[] screens = Screen.AllScreens;页脚内容8if (screens.Length == 2){List<Screen> listScreen = new List<Screen>();foreach (Screen screen in Screen.AllScreens){if (screen.Primary == false){listScreen.Add(screen);}}fiao.Location = listScreen[0].WorkingArea.Location;}SetMenJin("PicIn");fiao.Show();//toolStripStatusLabel2显示登陆用户名? toolStripStatusLabel2.Text = ;页脚内容9this.panel1.BackgroundImage = null;//菜单栏全部显示º?this.用®?户¡ì管¨¹理¤¨ªToolStripMenuItem.Visible = true; this.系¦Ì统ª3初?始º?化¡¥CToolStripMenuItem.Visible = true;this.应®|用®?模¡ê式º?ToolStripMenuItem.Visible = true;this.图ª?书º¨¦管¨¹理¤¨ªToolStripMenuItem.Visible = true; this.退ª?办㨬卡¡§ToolStripMenuItem.Visible = true; this.借¨¨阅?ToolStripMenuItem.Visible = true;this.门?禁?ToolStripMenuItem.Visible = true;SetPurview();this.toolStrip1.Visible = false;this.toolStrip2.Visible = false;this.toolStrip3.Visible = false;页脚内容10//rfid.OpenSerial();////是º?否¤?找¨°到Ì?门?禁?设¦¨¨备À?//if (rfid.ChangeWorkModel(2))//{// rfid.StartInventory(this.Handle.ToInt32(),2);//}}///<summary>///权限设置///</summary>private void SetPurview(){if (erLogin.ID == "admin"){this.应®|用®?模¡ê式º?ToolStripMenuItem.Visible = false;页脚内容11}else{this.用户管理¨ªToolStripMenuItem.Visible = false;this.系统初始化¡¥CToolStripMenuItem.Visible = false;this.读书管理¨ªToolStripMenuItem.Visible = false;this.退办卡¡§ToolStripMenuItem.Visible = false;this.借阅ToolStripMenuItem.Visible = false;this.门禁?ToolStripMenuItem.Visible = false;for (int i = 0; i < erLogin.Purview.Count; i++){string purview = erLogin.Purview[i];if (purview == "1"){this.图书管理¨ªToolStripMenuItem.Visible = true;}页脚内容12else if (purview == "2"){this.办退卡¡§ToolStripMenuItem.Visible = true;}else if (purview == "3"){this.借阅?ToolStripMenuItem.Visible = true;}else if (purview == "4"){this.门禁ToolStripMenuItem.Visible = true;}}}}private void用户管理¨ªToolStripMenuItem_Click(object sender, EventArgs e)页脚内容13{UserManage.FormUserList ful = new UserManage.FormUserList(All.conn);ful.ShowDialog();}private void修改密码?ToolStripMenuItem_Click(object sender, EventArgs e){UserManage.FormUserPwd fup = new UserManage.FormUserPwd(All.conn, erLogin);fup.ShowDialog();}private void tsbtnBookType_Click(object sender, EventArgs e){FormBookTypeList fbtl = new FormBookTypeList();fbtl.ShowDialog();}private void tsbtnBookAdd_Click(object sender, EventArgs e)页脚内容14{FormBookAdd fba = new FormBookAdd();fba.ShowDialog();}private void tsbtnBookManage_Click(object sender, EventArgs e){FormBookInfoList fbil = new FormBookInfoList();fbil.ShowDialog();}private void tsbtnBookStatistics_Click(object sender, EventArgs e){FormBookStatistics fbs = new FormBookStatistics();fbs.ShowDialog();}private void退ª?出?XToolStripMenuItem_Click(object sender, EventArgs e)页脚内容15{this.Close();}private void tsbtnCardAdd_Click(object sender, EventArgs e){FormCardInfo fci = new FormCardInfo(1, new ObjCardInfo());fci.ShowDialog();}private void tsbtnCardManage_Click(object sender, EventArgs e) {FormCardList fcl = new FormCardList();fcl.ShowDialog();}private void tsbtnAddTime_Click(object sender, EventArgs e){页脚内容16string rfid = RfidOperate.GetCard();if (rfid == ""){MessageBox.Show("请把借阅卡放到桌面读写器上!"); }else{if (ObjCardInfo.IsHas(rfid)){ObjCardInfo oci = new ObjCardInfo(rfid);FormCardInfo fci = new FormCardInfo(5, oci);fci.ShowDialog();}else{MessageBox.Show("没有此借阅卡信息");}页脚内容17}}private void tsbtnCardDelete_Click(object sender, EventArgs e) {string rfid = RfidOperate.GetCard();if (rfid == ""){MessageBox.Show("请把借阅卡到读写器上?");}else{if (ObjCardInfo.IsHas(rfid)){ObjCardInfo oci = new ObjCardInfo(rfid);int count = oci.NotReturnCount();页脚内容18if (count == 0){if (MessageBox.Show("是否决定退卡!ê?", "", MessageBoxButtons.YesNo) == DialogResult.Yes){oci.Delete();MessageBox.Show("退卡成功|!ê?");}}else{MessageBox.Show( + "还有一本" + count.ToString() + " 本书未归还不能退卡?");}}else{MessageBox.Show("没有此借阅信息?");页脚内容19}}}private void tsbtnJie_Click(object sender, EventArgs e){FormBookJie fbj = new FormBookJie(1);fbj.ShowDialog();}private void tsbtnHuan_Click(object sender, EventArgs e){FormBookHuan fbh = new FormBookHuan();fbh.ShowDialog();}private void图ª?书º¨¦管¨¹理¤¨ªToolStripMenuItem_Click(object sender, EventArgs e) {页脚内容20this.toolStrip1.Visible = true;this.toolStrip2.Visible = false;this.toolStrip3.Visible = false;this.panel1.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\pic\\1.jpg");}private void退ª?办㨬卡¡§ToolStripMenuItem_Click(object sender, EventArgs e){this.toolStrip1.Visible = false;this.toolStrip2.Visible = true;this.toolStrip3.Visible = false;this.panel1.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\pic\\2.jpg");}private void借¨¨阅?ToolStripMenuItem_Click(object sender, EventArgs e){页脚内容21this.toolStrip1.Visible = false;this.toolStrip2.Visible = false;this.toolStrip3.Visible = true;this.panel1.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\pic\\3.jpg");}private void门?禁?ToolStripMenuItem_Click(object sender, EventArgs e){//MenJinInit();//this.toolStrip1.Visible = false;//this.toolStrip2.Visible = false;//this.toolStrip3.Visible = false;//this.panel1.BackgroundImage = null;//rfid.OpenSerial();页脚内容22////是否找到门禁设备?//if (rfid.IsOpen)//{// rfid.StartInventory(this.Handle.ToInt32());//}}private void注销²ToolStripMenuItem_Click(object sender, EventArgs e) {erLogin = null;FormLogin fl = new FormLogin();if (fl.ShowDialog() != DialogResult.OK){this.Close();}else{页脚内容23Init();}}private void帮助¨²ToolStripMenuItem1_Click(object sender, EventArgs e){}private void系统初始化¡¥CToolStripMenuItem_Click(object sender, EventArgs e){if (MessageBox.Show("是否初始化数据库?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) {All.dbo.excuteSql("delete from lendtable");All.dbo.excuteSql("delete from bookinfo");All.dbo.excuteSql("delete from booktype");All.dbo.excuteSql("delete from librarycard");All.dbo.excuteSql("delete from usertable");页脚内容24MessageBox.Show("初始化完成?");}}private void关于ToolStripMenuItem_Click(object sender, EventArgs e){FormAbout fa = new FormAbout();fa.ShowDialog();}protected override void DefWndProc(ref System.Windows.Forms.Message m) {if (m.Msg == WM_GETBUFFER_LOOP){//启动if (this.timer1.Tag.ToString() == "0")页脚内容25{this.timer1.Start();this.timer1.Tag = "1";}string uid = "";string direction = "";bool personWithMultCard = false;rdr.GetLoopGetBufferData(m, ref uid, ref direction, ref personWithMultCard); if (uid != "0000000000000000"){//进if (direction == "In"){this.directionFlag = 1;this.rfids.Add(uid);}页脚内容26//出if (direction == "Out"){this.directionFlag = 2;this.rfids.Add(uid);}if (uid == "FFFFFFFFFFFFFFFF"){}}}base.DefWndProc(ref m);}页脚内容27private void timer1_Tick(object sender, EventArgs e){if (this.directionFlag == 1){for (int i = 0; i < this.rfids.Count; i++){if (ObjCardInfo.IsHas(this.rfids[i])){ObjCardInfo oci = new ObjCardInfo(this.rfids[i]);if (oci.IsOverTime()){SetMenJin("PicInOutTime");MenJinInit();return;}else页脚内容28{SetMenJin("PicIn");MenJinInit();return;}}}SetMenJin("PicInNoCard");MenJinInit();}else if (this.directionFlag == 2){for (int i = 0; i < this.rfids.Count; i++){if (ObjBookInfo.IsHas(this.rfids[i])){页脚内容29ObjBookInfo obi = new ObjBookInfo(this.rfids[i]);if (obi.LendStatus == "为借出?"){this.rdr.WarningOutput(false, false, true, false, false);SetMenJin("PicOut");MenJinInit();return;}}}MenJinInit();}}///<summary>///门禁初始化///</summary>页脚内容30private void MenJinInit(){this.rfids.Clear();this.directionFlag = 0;this.timer1.Tag = "0";this.timer1.Stop();}private void SetMenJin(string message){this.fiao.Controls.Clear();UserControlMenJin ucmj = new UserControlMenJin(message);ucmj.Dock = DockStyle.Fill;this.fiao.Controls.Add(ucmj);}页脚内容31private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {//this.rfid.StopInventory();//this.rfid.CloseSerial();}}}图书统计using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;页脚内容32namespace Labrary{public partial class FormBookStatistics : Form{private int boolShelf;public FormBookStatistics(){InitializeComponent();BindTreeView();this.boolShelf = 0;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo");this.cboBookLendStatus.SelectedIndex = 0;}页脚内容33private void BindTreeView(){this.treeView1.Nodes.Clear();TreeNode nodeRoot = new TreeNode();nodeRoot.Text = "全部书架¹";this.treeView1.Nodes.Add(nodeRoot);for (int i = 0; i < 4; i++){TreeNode nodeChild = new TreeNode();if (i == 0){nodeChild.Text = "第一书架¹";}if (i == 1){nodeChild.Text = "第二书架¨¹";页脚内容34}if (i == 2){nodeChild.Text = "第三书架¨¹";}if (i == 3){nodeChild.Text = "第四书架¨¹";}nodeRoot.Nodes.Add(nodeChild);}nodeRoot.Expand();}private void BindListView(string sql){this.listView1.Items.Clear();页脚内容35this.listView1.Columns.Clear();string[] headerText = new string[] { "标签,100", "所属分类¤¨¤,100", "书名,150", "作者,80", "借阅状态,80", "所在书架,80" };for (int i = 0; i < headerText.Length; i++){ColumnHeader header = new ColumnHeader();string headerName = headerText[i].Split(',')[0];int headerWidth = Convert.ToInt32(headerText[i].Split(',')[1]);header.Text = headerName;header.Width = headerWidth;this.listView1.Columns.Add(header);}DataTable dtb = All.dbo.getDataTable(sql);页脚内容36for (int i = 0; i < dtb.Rows.Count; i++){ObjBookInfo bookInfo = new ObjBookInfo(dtb.Rows[i]["RFID"].ToString());ListViewItem item = new ListViewItem(new string[] { bookInfo.RFID, , , bookInfo.Author, bookInfo.LendStatus, bookInfo.BookShelf });this.listView1.Items.Add(item);}ListViewItem itemCount = new ListViewItem(new string[] { "统ª3计?", "", "", "", "",dtb.Rows.Count.ToString() + "本À?" });this.listView1.Items.Add(itemCount);}private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e){if (e.Node.Text == "全部书架¨¹")页脚内容37{this.boolShelf = 0;BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo"));}if (e.Node.Text == "第一书架¨¹"){this.boolShelf = 1;BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='1'"));}if (e.Node.Text == "第二书架¨¹"){this.boolShelf = 2;BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='2'"));}if (e.Node.Text == "第三书架¨¹")页脚内容38{this.boolShelf = 3;BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='3'"));}if (e.Node.Text == "第四书架¨¹"){this.boolShelf = 4;BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='4'"));}}private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e){if (this.boolShelf == 0){if (this.cboBookLendStatus.SelectedIndex == 0)页脚内容39{BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo"));}if (this.cboBookLendStatus.SelectedIndex == 1){BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='1'"));}if (this.cboBookLendStatus.SelectedIndex == 2){BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='0'"));}}if (this.boolShelf > 0){if (this.cboBookLendStatus.SelectedIndex == 0)页脚内容40{BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}'", this.boolShelf.ToString()));}if (this.cboBookLendStatus.SelectedIndex == 1){BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}' and LendStatus='1'", this.boolShelf.ToString()));}if (this.cboBookLendStatus.SelectedIndex == 2){BindListView(string.Format("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}' and LendStatus='0'", this.boolShelf.ToString()));}}}}}页脚内容41借阅卡管理using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Labrary{public partial class FormCardList : Form{public FormCardList(){InitializeComponent();SetListView();页脚内容42}private void SetListView(){this.listView1.Items.Clear();List<ObjCardInfo> listCard = ObjCardInfo.GetAllCard();for (int i = 0; i < listCard.Count; i++){ObjCardInfo oci = listCard[i];ListViewItem item = new ListViewItem(oci.Rfid);item.Tag = oci;ListViewItem.ListViewSubItem subitem1 = new ListViewItem.ListViewSubItem();subitem1.Text = ;item.SubItems.Add(subitem1);页脚内容43ListViewItem.ListViewSubItem subitem2 = new ListViewItem.ListViewSubItem(); subitem2.Text = oci.Sex;item.SubItems.Add(subitem2);ListViewItem.ListViewSubItem subitem3 = new ListViewItem.ListViewSubItem(); subitem3.Text = oci.Brithday.ToString("yyyy年¨ºMM月?dd日¨?");item.SubItems.Add(subitem3);ListViewItem.ListViewSubItem subitem4 = new ListViewItem.ListViewSubItem(); subitem4.Text = oci.SID;item.SubItems.Add(subitem4);ListViewItem.ListViewSubItem subitem5 = new ListViewItem.ListViewSubItem(); subitem5.Text = oci.StartTime.ToString();item.SubItems.Add(subitem5);ListViewItem.ListViewSubItem subitem6 = new ListViewItem.ListViewSubItem(); subitem6.Text = oci.EndTime.ToString();页脚内容44item.SubItems.Add(subitem6);ListViewItem.ListViewSubItem subitem7 = new ListViewItem.ListViewSubItem();subitem7.Text = ;item.SubItems.Add(subitem7);this.listView1.Items.Add(item);}}private void SetListView(List<ObjCardInfo> listCard){this.listView1.Items.Clear();for (int i = 0; i < listCard.Count; i++){ObjCardInfo oci = listCard[i];页脚内容45ListViewItem item = new ListViewItem(oci.Rfid);item.Tag = oci;ListViewItem.ListViewSubItem subitem1 = new ListViewItem.ListViewSubItem(); subitem1.Text = ;item.SubItems.Add(subitem1);ListViewItem.ListViewSubItem subitem2 = new ListViewItem.ListViewSubItem(); subitem2.Text = oci.Sex;item.SubItems.Add(subitem2);ListViewItem.ListViewSubItem subitem3 = new ListViewItem.ListViewSubItem(); subitem3.Text = oci.Brithday.ToString("yyyy年¨ºMM月?dd日¨?");item.SubItems.Add(subitem3);ListViewItem.ListViewSubItem subitem4 = new ListViewItem.ListViewSubItem(); subitem4.Text = oci.SID;item.SubItems.Add(subitem4);页脚内容46ListViewItem.ListViewSubItem subitem5 = new ListViewItem.ListViewSubItem();subitem5.Text = oci.StartTime.ToString();item.SubItems.Add(subitem5);ListViewItem.ListViewSubItem subitem6 = new ListViewItem.ListViewSubItem();subitem6.Text = oci.EndTime.ToString();item.SubItems.Add(subitem6);ListViewItem.ListViewSubItem subitem7 = new ListViewItem.ListViewSubItem();subitem7.Text = ;item.SubItems.Add(subitem7);this.listView1.Items.Add(item);}}private void tsbtnExit_Click(object sender, EventArgs e)页脚内容47{this.Close();}private void tsbtnInsert_Click(object sender, EventArgs e){FormCardInfo fci = new FormCardInfo(1, new ObjCardInfo());if (fci.ShowDialog() == DialogResult.OK){SetListView();IsEnabled(false);}}private void IsEnabled(bool Enabled){//this.tsbtnAddTime.Enabled = Enabled;this.tsbtnUpdate.Enabled = Enabled;页脚内容48this.tsbtnDelete.Enabled = Enabled;this.tsbtnRecord.Enabled = Enabled;}private void listView1_SelectedIndexChanged(object sender, EventArgs e) {if (this.listView1.SelectedItems.Count > 0){IsEnabled(true);}else{IsEnabled(false);}}private void tsbtnAddTime_Click(object sender, EventArgs e){页脚内容49if (this.listView1.SelectedItems.Count > 0){ObjCardInfo oci = this.listView1.SelectedItems[0].Tag as ObjCardInfo;FormCardInfo fci = new FormCardInfo(5, oci);if (fci.ShowDialog() == DialogResult.OK){SetListView();IsEnabled(false);}}}private void tsbtnUpdate_Click(object sender, EventArgs e){if (this.listView1.SelectedItems.Count > 0){ObjCardInfo oci = this.listView1.SelectedItems[0].Tag as ObjCardInfo;页脚内容50。
图书管理系统实验报告+源代码

图书信息管理系统课程设计:图书信息管理系统设计人员:林俊柱开发环境: eclipse数据库: sql server 2005说明:数据库里面的用户名为”sa”, 密码为:”1111”登录程序所用的用户名为: ljz ,密码为: 0000,当然,也可以使用注册功能,注册完成后使用自己的用户名和密码登录设计思路:该图书信息管理系统主要便于图书管理员管理教师的书籍借阅情况。
该程序实现的功能总共有五个板块:1、教师信息管理:包含了增加、删除、修改、查询教师信息等功能;2、图书信息管理:包含了增加、删除、修改、查询图书信息等功能;3、借书登记:登记教师借阅图书的相关信息;4、还书登记:登记教师归还图书的相关信息;5、催还:查询出并列出教师借阅图书超过期限的相关信息,以便催促教师还书.数据库的设计思路为:Teacher(读者号,姓名,性别,年龄,部门,联系方式)Book(ISBN,书名,作者,出版社,价格,类型)Borrow(读者号,ISBN,借阅日期,归还日期,办理人,归还办理人)(横线为主键,蓝色字体为外键)管理员信息表:Administrator(管理员编号,管理员密码,管理员姓名,性别,年龄,联系电话)数据库的连接:public class Dataclass {private static Connection conn = null;String driverName= "com.microsoft.sqlserver.jdbc.SQLServerDriver";String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=Java 课程设计数据库 ";String userName="sa"; //默认用户名String userPwd="1111"; //密码//构造函数public Dataclass(){ //用于连接数库try {if (conn == null) {Class.forName(driverName);conn= DriverManager.getConnection(dbURL, userName, userPwd);}elsereturn;}catch (Exception e) { //捕获数据库连接不成功异常e.printStackTrace();}}public static ResultSet executeQuery(String sql) { //传送返回结果集的SQL语句try {if(conn==null)new Dataclass(); //调用构造函数连接数据库returnconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR _UPDATABLE).executeQuery(sql); //返回可滚动的并发事件}catch (SQLException e) { //捕获访问数据库失败异常e.printStackTrace();return null;}}public static boolean executeUpdate(String sql) { //发送不返回结果集的SQL语句try {if(conn==null)new Dataclass(); //调用构造函数连接数据库int i = conn.createStatement().executeUpdate(sql);if(i != 0)return true;}catch (SQLException e) { //捕获访问数据库失败异常System.out.println(e.getMessage());return false; //不成功返回-1}return false;}public static void close() { //断开数据库连接方法try {conn.close();}catch (SQLException e) {e.printStackTrace();}finally{conn = null; //设置数据库连接对象为空}}}登录界面的实现:代码为:public class KCSJDL extends JFrame{JTextField textField1;JPasswordField textField2;public KCSJDL(){t ry{// 设置Windows观感UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.Windows LookAndFeel");}catch(Exception e){System.out.println("Look and Feel Exception");System.exit(0);}setTitle("图书管理系统登录界面");setBounds(400, 200, 376, 300);setResizable(false);Container con=getContentPane();JLabel lblNewLabel = new JLabel();lblNewLabel.setIcon(new ImageIcon("images/head.jpg"));JPanel Jpanel1 = new JPanel();Jpanel1.setLayout(new GridLayout(2, 1, 0, 0));JPanel Jpanel1_1 = new JPanel();Jpanel1_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 30));Jpanel1.add(Jpanel1_1);JLabel lblNewLabel2 = new JLabel(" 管理员编号:");Jpanel1_1.add(lblNewLabel2);textField1 = new JTextField();Jpanel1_1.add(textField1);textField1.setColumns(25);JPanel Jpanel1_2 = new JPanel();Jpanel1_2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));Jpanel1.add(Jpanel1_2);JLabel label_1 = new JLabel(" 管理员密码:");Jpanel1_2.add(label_1);textField2 = new JPasswordField();Jpanel1_2.add(textField2);textField2.setColumns(25);JPanel Jpanel2 = new JPanel();JLabel label = new JLabel(" ");JButton button1 = new JButton(" 登录 ");JButton button2 = new JButton(" 注册 ");Jpanel2.add(label);Jpanel2.add(button1);Jpanel2.add(button2);con.add(lblNewLabel,"North");con.add(Jpanel1,"Center");con.add(Jpanel2,"South");textField1.addActionListener(new KCSJDLEvent(this));textField2.addActionListener(new KCSJDLEvent(this));button1.addActionListener(new KCSJDLEvent(this));button2.addActionListener(new KCSJDLEvent(this));}public static void main(String []args){K CSJDL test = new KCSJDL();t est.setVisible(true);t est.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}}注册界面的实现:代码为:public class KCSJZC extends JFrame{private ButtonGroup buttonGroup = new ButtonGroup();JTextField textField1_1;JTextField textField2_1;JTextField textField3_1;JTextField textField4_1;JTextField textField4_2;JRadioButton radioButton1;JRadioButton radioButton2;public KCSJZC(){try{// 设置Windows观感UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.Windows LookAndFeel");}catch(Exception e){System.out.println("Look and Feel Exception");System.exit(0);}setTitle("注册");setBounds(400, 200,500,550);setResizable(false);Container con=getContentPane();JLabel lblNewLabel = new JLabel();lblNewLabel.setIcon(new ImageIcon("images/ZC.png"));con.add(lblNewLabel,"North");JPanel Jpanel = new JPanel();Jpanel.setBorder(new TitledBorder(null, "管理员注册", TitledBorder.CENTER, TitledBorder.TOP, null, null));Jpanel.setLayout(new GridLayout(5, 1, 0, 0));con.add(Jpanel,"Center");JPanel J1 = new JPanel();J1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));Jpanel.add(J1);JLabel lb1_1 = new JLabel("管理员编号:");textField1_1 = new JTextField();textField1_1.setColumns(20);JLabel lb1_2 = new JLabel(" ");J1.add(lb1_1);J1.add(textField1_1);J1.add(lb1_2);JPanel J2 = new JPanel();J2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));Jpanel.add(J2);JLabel lb2_1 = new JLabel("管理员密码:");textField2_1 = new JTextField();textField2_1.setColumns(20);JLabel lb2_2 = new JLabel(" 确认密码:");JTextField textField2_2 = new JTextField();textField2_2.setColumns(20);J2.add(lb2_1);J2.add(textField2_1);J2.add(lb2_2);J2.add(textField2_2);JPanel J3 = new JPanel();J3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20)); Jpanel.add(J3);JLabel lb3_1 = new JLabel("管理员姓名:");textField3_1 = new JTextField();textField3_1.setColumns(20);JLabel lb3_2 = new JLabel(" 性别:");radioButton1 = new JRadioButton(" 男");//" " buttonGroup.add(radioButton1);JLabel lb3_3 = new JLabel(" ");radioButton2 = new JRadioButton(" 女");buttonGroup.add(radioButton2);J3.add(lb3_1);J3.add(textField3_1);J3.add(lb3_2);J3.add(radioButton1);J3.add(lb3_3);J3.add(radioButton2);JPanel J4 = new JPanel();J4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20)); Jpanel.add(J4);JLabel lb4_1 = new JLabel("年龄:");textField4_1 = new JTextField();textField4_1.setColumns(20);JLabel lb4_2 = new JLabel(" 联系电话:");textField4_2 = new JTextField();textField4_2.setColumns(20);J4.add(lb4_1);J4.add(textField4_1);J4.add(lb4_2);J4.add(textField4_2);JPanel J5 = new JPanel();J5.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20)); Jpanel.add(J5);JButton Jb1 = new JButton(" 注册 ");Jb1.setIcon(new ImageIcon("images/JY.png"));Jb1.addActionListener(new enrollEvent(this));JButton Jb2 = new JButton("返回登录界面");Jb2.setIcon(new ImageIcon("images/GH.png"));Jb2.addActionListener(new enrollEvent(this));J5.add(Jb1);J5.add(Jb2);}}首页界面的实现:代码为:class KCSJMain extends JFrame {JButton Jbutton[] = new JButton[6];JPanel Jpanel;JPanel Jpanel1;JPanel Jpanel2;JPanel Jpanel3;JPanel Jpanel4;JPanel Jpanel5;JTextField textField_1;JTextField textField_2;JTextField textField_3;JTextField textField_4;JTextField textField_5;public KCSJMain(){t ry{// 设置Windows观感UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.Windows LookAndFeel");}catch(Exception e){System.out.println("Look and Feel Exception");System.exit(0);}s etTitle("图书管理系统");s etBounds(150, 150, 950, 620);s etResizable(false);C ontainer con=getContentPane();S tring str[] = {" 首页 ","教师信息管理","图书信息管理"," 借书登记"," 还书登记 "," 催还 "};String Pfilename[] ={"images/c6.png","images/p1.png","images/p2.png","images/p3.png","ima ges/p4.png","images/p5.png"};for(int i = 0;i < str.length;i++){Jbutton[i] = new JButton(str[i]);Jbutton[i].setIcon(new ImageIcon(Pfilename[i]));Jbutton[i].setHorizontalTextPosition(JButton.CENTER);Jbutton[i].setVerticalTextPosition(JButton.BOTTOM);}JPanel panel = new JPanel();panel.setBorder(new LineBorder(Color.LIGHT_GRAY));for(int i = 0;i < str.length;i++){panel.add(Jbutton[i]);}//左边JPanel jpanel = new JPanel();jpanel.setBorder(new LineBorder(Color.LIGHT_GRAY));jpanel.setLayout(new BoxLayout(jpanel, BoxLayout.Y_AXIS));JPanel panel_1 = new JPanel();panel_1.setBorder(newTitledBorder(UIManager.getBorder("TitledBorder.border"), "欢迎使用图书管理系统", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 0, 0)));jpanel.add(panel_1);JTextArea textArea = new JTextArea();textArea.setColumns(30);textArea.setRows(5);textArea.setText("【功能简要介绍】:\n 该系统可以对教师读者以及图 \n 书进行管理,包括增删改查等功能\n ,方便于管理,是管理员的小小\n 助手!");textArea.setBackground(SystemColor.control);textArea.setEditable(false);panel_1.add(textArea);JPanel panel_2 = new JPanel();panel_2.setBorder(new TitledBorder(null, "您好,欢迎登录图书管理系统", TitledBorder.CENTER, TitledBorder.TOP, null, null));jpanel.add(panel_2);JPanel jp = new JPanel();jp.setLayout(new GridLayout(5, 1, 0, 0));panel_2.add(jp);String str1[] = {"管理员编号:","管理员姓名:"," 性别: "," 年龄:"," 联系电话: "};JPanel JP[] = new JPanel[str1.length];JLabel label[] = new JLabel[str1.length];for(int i = 0;i < str1.length;i++){JP[i] = new JPanel();label[i]= new JLabel(str1[i]);JP[i].add(label[i]);jp.add(JP[i]);}textField_1 = new JTextField();textField_1.setColumns(20);JP[0].add(textField_1);textField_2 = new JTextField();textField_2.setColumns(20);JP[1].add(textField_2);textField_3 = new JTextField();textField_3.setColumns(20);JP[2].add(textField_3);textField_4 = new JTextField();textField_4.setColumns(20);JP[3].add(textField_4);textField_5 = new JTextField();textField_5.setColumns(20);JP[4].add(textField_5);//面板Jpanel = new JPanel();Jpanel.setBorder(new LineBorder(Color.LIGHT_GRAY));JLabel lblNewLabel = new JLabel("");lblNewLabel.setIcon(new ImageIcon("images/picture.png"));Jpanel.add(lblNewLabel);Jpanel1 = new JPanelclass1();Jpanel2 = new JPanelclass2();Jpanel3 = new JPanelclass3();Jpanel4 = new JPanelclass4();Jpanel5 = new JPanelclass5();con.add(panel,"North");con.add(jpanel,"West");con.add(Jpanel,"Center");//注册事件侦听器Jbutton[0].addActionListener(new ButtonEvent(this,Jpanel));Jbutton[1].addActionListener(new ButtonEvent(this,Jpanel1));Jbutton[2].addActionListener(new ButtonEvent(this,Jpanel2));Jbutton[3].addActionListener(new ButtonEvent(this,Jpanel3));Jbutton[4].addActionListener(new ButtonEvent(this,Jpanel4));Jbutton[5].addActionListener(new ButtonEvent(this,Jpanel5));//确认退出系统this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) ;this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {int confirm=JOptionPane.showConfirmDialog(null,"是否要退出图书馆管理系统?","确认框",JOptionPane.YES_NO_OPTION);if (confirm==JOptionPane.YES_OPTION)System.exit(0);}});}}//当点击功能板块的图标时,图标会发生变化class ButtonEvent implements ActionListener {private KCSJMain frame;private JPanel jpanel;public ButtonEvent(KCSJMain frame,JPanel jpanel){this.frame = frame;this.jpanel = jpanel;}public void actionPerformed(ActionEvent e){String btnLabel = e.getActionCommand();if(btnLabel.equals("教师信息管理")){frame.Jbutton[0].setIcon(new ImageIcon("images/p6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/c1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/p2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/p3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/p4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/p5.png"));}else if(btnLabel.equals("图书信息管理")){frame.Jbutton[0].setIcon(new ImageIcon("images/p6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/p1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/c2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/p3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/p4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/p5.png"));}else if(btnLabel.equals(" 借书登记 ")){frame.Jbutton[0].setIcon(new ImageIcon("images/p6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/p1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/p2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/c3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/p4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/p5.png"));}else if(btnLabel.equals(" 还书登记 ")){frame.Jbutton[0].setIcon(new ImageIcon("images/p6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/p1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/p2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/p3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/c4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/p5.png"));}else if(btnLabel.equals(" 催还 ")){frame.Jbutton[0].setIcon(new ImageIcon("images/p6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/p1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/p2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/p3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/p4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/c5.png"));}else{frame.Jbutton[0].setIcon(new ImageIcon("images/c6.png"));frame.Jbutton[1].setIcon(new ImageIcon("images/p1.png"));frame.Jbutton[2].setIcon(new ImageIcon("images/p2.png"));frame.Jbutton[3].setIcon(new ImageIcon("images/p3.png"));frame.Jbutton[4].setIcon(new ImageIcon("images/p4.png"));frame.Jbutton[5].setIcon(new ImageIcon("images/p5.png")); }frame.Jpanel.setVisible(false);frame.Jpanel1.setVisible(false);frame.Jpanel2.setVisible(false);frame.Jpanel3.setVisible(false);frame.Jpanel4.setVisible(false);frame.Jpanel5.setVisible(false);frame.add(jpanel,"Center");jpanel.setVisible(true);}}教师信息管理的实现(面板中还有四个功能):代码为:class JPanelclass1 extends JPanel {//选项卡1private ButtonGroup buttonGroup1 = new ButtonGroup();JTextField ZJtextField11;JTextField ZJtextField12;JRadioButton radioButton11;JRadioButton radioButton12;JTextField ZJtextField22;JTextField ZJtextField31;JTextField ZJtextField32;//选项卡2JTextField SCtextField2_11;JPanel SCJp2_2;//选项卡3private ButtonGroup buttonGroup2 = new ButtonGroup();JTextField XGtextField3_11;JTextField XGtextField3_21;JRadioButton radioButton21;JRadioButton radioButton22;JTextField XGtextField3_221;JTextField XGtextField3_222;JTextField XGtextField3_231;//选项卡4JTextField CXtextField4_1;JPanel CXJp4_2;public JPanelclass1(){setLayout(new BorderLayout(0, 0));setBorder(new LineBorder(Color.LIGHT_GRAY));//选择面板JTabbedPane JT1 = new JTabbedPane(JTabbedPane.TOP);add(JT1);//选项卡1JPanel panel_1 = new JPanel();panel_1.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("增加教师信息", null, panel_1, null);JPanel J1 = new JPanel();J1.setBorder(new TitledBorder(null, "增加教师信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J1.setLayout(new GridLayout(4, 1, 0, 0));panel_1.add(J1);JPanel Jp_1 = new JPanel();Jp_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));J1.add(Jp_1);JLabel Jl11 = new JLabel("读者号:");ZJtextField11 = new JTextField();ZJtextField11.setColumns(20);JLabel Jl12 = new JLabel("*必填");JLabel Jl13 = new JLabel(" 姓名:");ZJtextField12 = new JTextField();ZJtextField12.setColumns(20);JLabel Jl14 = new JLabel("*必填");Jp_1.add(Jl11);Jp_1.add(ZJtextField11);Jp_1.add(Jl12);Jp_1.add(Jl13);Jp_1.add(ZJtextField12);Jp_1.add(Jl14);JPanel Jp_2 = new JPanel();J1.add(Jp_2);JLabel Jl21 = new JLabel("性别: "); radioButton11 = new JRadioButton(" 男");//" " buttonGroup1.add(radioButton11);JLabel Jl23 = new JLabel(" ");radioButton12 = new JRadioButton(" 女"); buttonGroup1.add(radioButton12);JLabel Jl22 = new JLabel(" 年龄:"); ZJtextField22 = new JTextField();ZJtextField22.setColumns(20);JLabel Jl24 = new JLabel(" ");Jp_2.add(Jl21);Jp_2.add(radioButton11);Jp_2.add(radioButton12);Jp_2.add(Jl23);Jp_2.add(Jl22);Jp_2.add(ZJtextField22);Jp_2.add(Jl24);JPanel Jp_3 = new JPanel();J1.add(Jp_3);JLabel Jl31 = new JLabel("部门:"); ZJtextField31 = new JTextField();ZJtextField31.setColumns(20);JLabel Jl32 = new JLabel(" 联系方式:"); ZJtextField32 = new JTextField();ZJtextField32.setColumns(20);JLabel Jl33 = new JLabel("*必填");Jp_3.add(Jl31);Jp_3.add(ZJtextField31);Jp_3.add(Jl32);Jp_3.add(ZJtextField32);Jp_3.add(Jl33);JPanel Jp_4 = new JPanel();J1.add(Jp_4);JButton Jb1 = new JButton(" 增加 ");Jb1.setIcon(new ImageIcon("images/ZJ.png")); Jp_4.add(Jb1);//注册侦听器Jb1.addActionListener(new JPanelclass1_1Event(this));//选项卡2JPanel panel_2 = new JPanel();panel_2.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("删除教师信息", null, panel_2, null);JPanel J2 = new JPanel();J2.setBorder(new TitledBorder(null, "删除教师信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J2.setLayout(new GridLayout(3, 1, 0, 0));panel_2.add(J2);JPanel Jp2_1 = new JPanel();Jp2_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 25));J2.add(Jp2_1);JLabel Jl2_11 = new JLabel("请输入读者号:");SCtextField2_11 = new JTextField();SCtextField2_11.setColumns(20);JButton Jb2_1 = new JButton(" 查询 ");Jb2_1.setIcon(new ImageIcon("images/b.png"));Jp2_1.add(Jl2_11);Jp2_1.add(SCtextField2_11);Jp2_1.add(Jb2_1);SCJp2_2 = new JPanel();SCJp2_2.setLayout(new BorderLayout());SCJp2_2.setBorder(new TitledBorder(null, "该教师的信息", TitledBorder.LEADING, TitledBorder.TOP, null, null));J2.add(SCJp2_2);JPanel Jp2_3 = new JPanel();Jp2_3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 25));J2.add(Jp2_3);JButton Jb2_2 = new JButton(" 删除 ");Jb2_2.setIcon(new ImageIcon("images/SC.png"));Jp2_3.add(Jb2_2);//注册侦听器Jb2_1.addActionListener(new JPanelclass1_2Event(this));Jb2_2.addActionListener(new JPanelclass1_2Event(this));//选项卡3JPanel panel_3 = new JPanel();panel_3.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("修改教师信息", null, panel_3, null);JPanel J3 = new JPanel();J3.setBorder(new TitledBorder(null, "修改教师信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J3.setLayout(new GridLayout(2, 1, 0, 0));panel_3.add(J3);JPanel Jp3_1 = new JPanel();Jp3_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));J3.add(Jp3_1);JLabel Jl3_11 = new JLabel("请输入读者号:");XGtextField3_11 = new JTextField();XGtextField3_11.setColumns(20);JButton Jb3_1 = new JButton(" 查询该教师 ");Jb3_1.setIcon(new ImageIcon("images/b.png"));Jp3_1.add(Jl3_11);Jp3_1.add(XGtextField3_11);Jp3_1.add(Jb3_1);JPanel Jp3_2 = new JPanel();Jp3_2.setBorder(new TitledBorder(null, "修改教师信息", TitledBorder.LEADING, TitledBorder.TOP, null, null));Jp3_2.setLayout(new GridLayout(4, 1, 0, 0));J3.add(Jp3_2);JPanel Jp3_21 = new JPanel();Jp3_2.add(Jp3_21);JLabel Jl3_21 = new JLabel("教师姓名:");XGtextField3_21 = new JTextField();XGtextField3_21.setColumns(20);JLabel Jl3_22 = new JLabel(" 教师性别:");radioButton21 = new JRadioButton("男");//" "buttonGroup2.add(radioButton21);JLabel Jl3_23 = new JLabel(" ");radioButton22 = new JRadioButton("女");buttonGroup2.add(radioButton22);JLabel Jl3_24 = new JLabel(" ");Jp3_21.add(Jl3_21 );Jp3_21.add(XGtextField3_21);Jp3_21.add(Jl3_22);Jp3_21.add(radioButton21);Jp3_21.add(radioButton22);Jp3_21.add(Jl3_23);Jp3_21.add(Jl3_24);JPanel Jp3_22 = new JPanel();Jp3_2.add(Jp3_22);JLabel Jl3_221 = new JLabel("年龄:");XGtextField3_221 = new JTextField();XGtextField3_221.setColumns(20);JLabel Jl3_222 = new JLabel(" 部门:");XGtextField3_222 = new JTextField();XGtextField3_222.setColumns(20);Jp3_22.add(Jl3_221);Jp3_22.add(XGtextField3_221);Jp3_22.add(Jl3_222);Jp3_22.add(XGtextField3_222);JPanel Jp3_23 = new JPanel();Jp3_2.add(Jp3_23);JLabel Jl3_231 = new JLabel("联系方式:");XGtextField3_231 = new JTextField();XGtextField3_231.setColumns(20);JLabel Jl3_232 = new JLabel(" "); Jp3_23.add(Jl3_231);Jp3_23.add(XGtextField3_231);Jp3_23.add(Jl3_232);JPanel Jp3_24 = new JPanel();Jp3_2.add(Jp3_24);JButton Jb3_24 = new JButton(" 修改 ");Jb3_24.setIcon(new ImageIcon("images/XG.png"));Jp3_24.add(Jb3_24);//注册侦听器Jb3_1.addActionListener(new JPanelclass1_3Event(this));Jb3_24.addActionListener(new JPanelclass1_3Event(this));//选项卡4JPanel panel_4 = new JPanel();panel_4.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("查询教师信息", null, panel_4, null);JPanel J4 = new JPanel();J4.setBorder(new TitledBorder(null, "查询教师信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J4.setLayout(new GridLayout(2, 1, 0, 0));panel_4.add(J4);JPanel Jp4_1 = new JPanel();Jp4_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));J4.add(Jp4_1);JLabel Jl4_1 = new JLabel("请输入读者号:");CXtextField4_1 = new JTextField();CXtextField4_1.setColumns(20);JButton Jb4_1 = new JButton(" 查询该教师 ");Jb4_1.setIcon(new ImageIcon("images/b.png"));Jp4_1.add(Jl4_1);Jp4_1.add(CXtextField4_1);Jp4_1.add(Jb4_1);CXJp4_2 = new JPanel();CXJp4_2.setLayout(new BorderLayout());CXJp4_2.setBorder(new TitledBorder(null, "查询结果", TitledBorder.LEADING, TitledBorder.TOP, null, null));J4.add(CXJp4_2);//注册侦听器Jb4_1.addActionListener(new JPanelclass1_4Event(this));}}图书信息管理的实现:class JPanelclass2 extends JPanel{//选项卡1JTextField ZJtextField1_1;JTextField ZJtextField1_12;JTextField ZJtextField1_2;JTextField ZJtextField1_22;JTextField ZJtextField1_3;JTextField ZJtextField1_32;//选项卡2JTextField SCtextField2_1;JPanel SCJp2_2;//选项卡3JTextField XGtextField3_1;JTextField XGtextField3_21;JTextField XGtextField3_22;JTextField XGtextField3_221;JTextField XGtextField3_222;JTextField XGtextField3_23;//选项卡4JTextField CXtextField14;JPanel CXJp4_2;public JPanelclass2(){setLayout(new BorderLayout(0, 0));setBorder(new LineBorder(Color.LIGHT_GRAY));//选择面板JTabbedPane JT1 = new JTabbedPane(JTabbedPane.TOP);add(JT1);//选项卡1JPanel panel_1 = new JPanel();panel_1.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("增加图书信息", null, panel_1, null);JPanel J1 = new JPanel();J1.setBorder(new TitledBorder(null, "增加图书信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J1.setLayout(new GridLayout(4, 1, 0, 0));panel_1.add(J1);JPanel Jp1_1 = new JPanel();Jp1_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));J1.add(Jp1_1);JLabel Jl1_1 = new JLabel(" ISBN:");ZJtextField1_1 = new JTextField();ZJtextField1_1.setColumns(20);JLabel Jl1_12 = new JLabel("*必填书名:");ZJtextField1_12 = new JTextField();ZJtextField1_12.setColumns(20);JLabel Jl1_13 = new JLabel("*必填");Jp1_1.add(Jl1_1);Jp1_1.add(ZJtextField1_1);Jp1_1.add(Jl1_12);Jp1_1.add(ZJtextField1_12);Jp1_1.add(Jl1_13);JPanel Jp1_2 = new JPanel();J1.add(Jp1_2);JLabel Jl1_2 = new JLabel("作者:");ZJtextField1_2 = new JTextField();ZJtextField1_2.setColumns(20);JLabel Jl1_22 = new JLabel("*必填价格:");ZJtextField1_22 = new JTextField();ZJtextField1_22.setColumns(20);JLabel Jl1_23 = new JLabel("*必填");Jp1_2.add(Jl1_2);Jp1_2.add(ZJtextField1_2);Jp1_2.add(Jl1_22);Jp1_2.add(ZJtextField1_22);Jp1_2.add(Jl1_23);JPanel Jp1_3 = new JPanel();J1.add(Jp1_3);JLabel Jl1_3 = new JLabel("出版社:");ZJtextField1_3 = new JTextField();ZJtextField1_3.setColumns(20);JLabel Jl1_32 = new JLabel("*必填类型:");ZJtextField1_32 = new JTextField();ZJtextField1_32.setColumns(20);JLabel Jl1_33 = new JLabel(" ");Jp1_3.add(Jl1_3);Jp1_3.add(ZJtextField1_3);Jp1_3.add(Jl1_32);Jp1_3.add(ZJtextField1_32);Jp1_3.add(Jl1_33);JPanel Jp1_4 = new JPanel();J1.add(Jp1_4);JButton Jb1_4 = new JButton(" 增加 ");Jb1_4.setIcon(new ImageIcon("images/ZJ.png"));Jp1_4.add(Jb1_4);//注册侦听器Jb1_4.addActionListener(new JPanelclass2_1Event(this));//选项卡2JPanel panel_2 = new JPanel();panel_2.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("删除图书信息", null, panel_2, null);JPanel J2 = new JPanel();J2.setBorder(new TitledBorder(null, "删除图书信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J2.setLayout(new GridLayout(3, 1, 0, 0));panel_2.add(J2);JPanel Jp2_1 = new JPanel();Jp2_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 25));J2.add(Jp2_1);JLabel Jl2_1 = new JLabel("请输入ISBN:");SCtextField2_1 = new JTextField();SCtextField2_1.setColumns(20);JButton Jb2_1 = new JButton("查询");Jb2_1.setIcon(new ImageIcon("images/b.png"));Jp2_1.add(Jl2_1);Jp2_1.add(SCtextField2_1);Jp2_1.add(Jb2_1);SCJp2_2 = new JPanel();SCJp2_2.setLayout(new BorderLayout());SCJp2_2.setBorder(new TitledBorder(null, "查询结果", TitledBorder.LEADING, TitledBorder.TOP, null, null));J2.add(SCJp2_2);JPanel Jp2_3 = new JPanel();Jp2_3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 25));J2.add(Jp2_3);JButton Jb2_2 = new JButton(" 删除 ");Jb2_2.setIcon(new ImageIcon("images/SC.png"));Jp2_3.add(Jb2_2);//注册侦听器Jb2_1.addActionListener(new JPanelclass2_2Event(this));Jb2_2.addActionListener(new JPanelclass2_2Event(this));//选项卡3JPanel panel_3 = new JPanel();panel_3.setLayout(new GridLayout(0, 1, 0, 0));JT1.addTab("修改图书信息", null, panel_3, null);JPanel J3 = new JPanel();J3.setBorder(new TitledBorder(null, "修改图书信息", TitledBorder.CENTER, TitledBorder.TOP, null, null));J3.setLayout(new GridLayout(2, 1, 0, 0));panel_3.add(J3);JPanel Jp3_1 = new JPanel();Jp3_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 20));J3.add(Jp3_1);。
图书信息管理系统设计源代码

头函数名:#include<stdio.h>#include<stdlib.h>#include<string.h>/*********图书信息结构体*********//***包括登录号,书名,作者名,分类号,出版单位,出版时间,价格等***/ struct bookinf{ int num; ******************************************************登录号char bname[20];***************************************书名char wname[10];***************************************作者名char clanum[14];***************************************分类号char pubcom[10];***************************************出版单位char pubtime[10];***************************************出版时间float price;*********************************************价格};一管理员登录系统模块:(1)来到图书信息管理系统页面void index(){char input; 注释:运行时printf("\n\n\t\t\t*****************************\n"); 直接进入printf("\t\t\t 图书信息管理系统\n"); 这个页面printf("\t\t\t*****************************\n\n\n");printf(" ------------------------------------------------------------------------------\n");printf("\t<按任意键进入>\n\t");input=getchar();}(2)管理员登陆进入功能菜单页面FILE *fp;struct manage pswd;if ((fp=fopen("password.txt","r"))==NULL) {printf("\n\n\n\tCannot open file!\n\t");}else{do{printf("\n\n\t请输入管理员帐号:");scanf("%s",name);printf("\n\n\t请输入管理员密码:");scanf("%s",password);fp=fopen("password.txt","r");fread(&pswd,sizeof(struct manage),1,fp);fclose(fp);w=strcmp(pswd.manage_name,name);k=strcmp(pswd.password,password);adm_servelist();}while (w!=0||k!=0);adm_servelist();}}(3)来到功能菜单页面{void book_add();void book_view();void change();void del();void book_search();void login();void pwchange();int in; 注释:菜单列出的服务种类char input; 从1,2,3,4,5,6 do 所对应的功能进行选择{printf("\n\n\n\t--欢迎使用信息管理系统--");printf("\n\n\t1.图书信息录入\n");printf("\t2.图书信息浏览\n");printf("\t3.图书信息查询\n");printf("\t4.图书信息删除\n");printf("\t5.图书信息修改\n");printf("\t6.退出管理模式\n");printf("\n\t请选择服务种类:");scanf("%d",&in);if (in!=1&&in!=2&&in!=3&&in!=4&&in!=5&&in!=6){printf("\n\t没有这项服务~\n");printf("\t按任意键重新选择");input=getchar();}}while (in!=1&&in!=2&&in!=3&&in!=4&&in!=5&&in!=6);switch (in){case 1: book_add(); break; 注释:选择自己所需要case 2: book_view(); break; 后摁下数字键则case 3: book_search(); break; 则进入此功能页面case 4: del(); break;case 5: change();break;case 6: login(); break;}}(3)图书信息录入功能模块void book_add(){void book_add();int i=0,j;FILE *fp;char input; 注释:输入的图书信息struct bookinf books; 是通过文件进行struct bookinf book_taxis[30]; 保存的printf("\n\n\n\t---请输入图书信息---\n\n");printf("\t登录号:");scanf("%d",&books.num);printf("\n\t书名:");scanf("%s",books.bname);printf("\n\t作者名:");scanf("%s",books.wname);printf("\n\t分类号:");scanf("%s",books.clanum);printf("\n\t出版单位:");scanf("%s",books.pubcom);printf("\n\t出版时间:");scanf("%s",books.pubtime);printf("\n\t价格:");scanf("%f",&books.price);if ((fp=fopen("book.txt","r"))!=NULL){do{fread(&book_taxis[i],sizeof(struct bookinf),1,fp);i=i+1;}while(!feof(fp));fclose(fp);for (j=0;j<=i;j++)if (books.num==book_taxis[j].num){printf("\n\n\n\t对不起,这个编号已经使用过了~\n");printf("\t按任意键返回管理菜单~");input=getchar();adm_servelist();break;}}if ((fp=fopen("book.txt","r"))==NULL){fp=fopen("book.txt","w");}else{fclose(fp);fp=fopen("book.txt","a");}fwrite(&books,sizeof(struct bookinf),1,fp);fclose(fp);printf("\n\n\n\t信息输入完毕~按任意键继续\n");input=getchar();adm_servelist();}(4)图书信息浏览功能模块void book_view(){void adm_servelist();void book_view();int inp,i=0,n=0;FILE *fp;char input;struct bookinf bookview[20];if ((fp=fopen("book.txt","r"))==NULL){printf("\n\n\n\t数据尚未初始化~~\n\n\t请在管理菜单中增加图书信息~~~\n"); printf("\n\t<按任意键返回管理菜单>\n\t");input=getchar();adm_servelist();}else{do{fread(&bookview[i],sizeof(struct bookinf),1,fp);i=i+1;}while (!feof(fp));fclose(fp);do{printf("\n\t--------共有%d条记录--------",i-1);printf("\n\n\t登录号: %d\n",bookview[n].num);printf("\n\t书名: %s\n",bookview[n].bname);printf("\n\t作者名: %s\n",bookview[n].wname);printf("\n\t分类号: %s\n",bookview[n].clanum);printf("\n\t出版单位: %s\n",bookview[n].pubcom);printf("\n\t出版时间: %s\n",bookview[n].pubtime);printf("\n\t价格: %f\n",bookview[n].price);printf("\n\n\t1.上一页\t2.下一页\t3.回目录\n");printf("\n\t请选择:");scanf("%d",&inp);switch (inp){case 1:{if (n==0){printf("\n\t已到达首页\n\t按任意键重新选择");input=getchar();}else n=n-1; break;}case 2:{if (n==i-2){printf("\n\t已到达最末页\n\t按任意键重新选择");input=getchar();}else n=n+1; break;}case 3:{adm_servelist();break;}default:{printf("\n\t没有这项服务\n\t按任意键重新选择");input=getchar();}}}while (inp!=3);}}(5)图书信息修改与删除功能模块修改:void change(int x){int inp,i=0,j;void book_search();FILE *fp,*fp1;char input;struct bookinf books,book_taxis[20];do{printf("\n\n\n\t注意:您确定要修改该记录吗?\n"); printf("\n\t1.是\t2.否\n");printf("\n\t请输入:");scanf("%d",&inp);if (inp!=1&&inp!=2){printf("\n\t对不起~没有这项服务~\n");printf("\t按任意键重新选择\n\t");input=getchar();}}while (inp!=1&&inp!=2);if (inp==2)book_search();if (inp==1){printf("\n\n\n\t---请输入图书信息---\n\n");printf("\t登录号:");scanf("%d",&books.num);printf("\n\t书名:");scanf("%s",books.bname);printf("\n\t作者名:");scanf("%s",books.wname);printf("\n\t分类号:");scanf("%s",books.clanum);printf("\n\t出版单位:");scanf("%s",books.pubcom);printf("\n\t出版时间:");scanf("%s",books.pubtime);printf("\n\t价格:");scanf("%f",&books.price);if ((fp1=fopen("book.txt","r"))!=NULL){do{fread(&book_taxis[i],sizeof(struct bookinf),1,fp1);i=i+1;}while(!feof(fp1));fclose(fp1);for (j=0;j<x;j++)if (books.num==book_taxis[j].num){printf("\n\n\n\t对不起,这个编号已经使用过了~\n");printf("\t按任意键返回管理菜单~");printf("0");input=getchar();book_search();break;}for (j=x+1;j<i-2;j++)if (books.num==book_taxis[j].num){printf("\n\n\n\t对不起,这个编号已经使用过了~\n");printf("1");printf("\t按任意键返回管理菜单~");input=getchar();book_search();break;}}book_taxis[x]=books;fp=fopen("book.txt","w");for (j=0;j<i-1;j++)fwrite(&book_taxis[j],sizeof(struct bookinf),1,fp);fclose(fp);printf("\n\n\t信息修改完成!按任意键返回");input=getchar();book_search();}}S删除:void del(int y){char input;FILE *fp;int inp,i=0,j;struct bookinf book_taxis[20];void book_search();void adm_servelist();do{printf("\n\n\n\t注意:您确定要删除该记录吗?\n"); printf("\n\t1.是\t2.否\n");printf("\n\t请输入:");scanf("%d",&inp);if (inp!=1&&inp!=2){printf("\n\t对不起~没有这项服务~\n");printf("\t按任意键重新选择\n\t");input=getchar();}}while (inp!=1&&inp!=2);if (inp==2)book_search();if (inp==1){if ((fp=fopen("book.txt","r"))!=NULL){do{fread(&book_taxis[i],sizeof(struct bookinf),1,fp);i=i+1;}while(!feof(fp));fclose(fp);}if (i>2){fp=fopen("book.txt","w");for (j=0;j<y;j++)fwrite(&book_taxis[j],sizeof(struct bookinf),1,fp);fclose(fp);fp=fopen("book.txt","a");for (j=y+1;j<i-1;j++)fwrite(&book_taxis[j],sizeof(struct bookinf),1,fp);fclose(fp);}else{remove("book.txt");}printf("\n\n\t记录已删除!\n\n\t按任意键返回\n\t");input=getchar();adm_servelist();}}(6)图书信息查询功能模块void book_search(){void adm_servelist();void id_search();void wr_search();void bn_search();char input;FILE *fp;int inp;if ((fp=fopen("book.txt","r"))==NULL){printf("\n\n\n\t数据尚未初始化~~\n\n\t请在管理菜单中增加图书信息~~~\n"); printf("\n\t<按任意键返回管理菜单>\n\t");input=getchar();adm_servelist();}else{do{printf("\n\n\n\t1.按图书登录号查询\n");printf("\n\t2.按图书作者查询\n");printf("\n\t3.按图书名查询\n");printf("\n\t4.回到主菜单\n");printf("\n\n\t请选择查询类别:");scanf("%d",&inp);if (inp!=1&&inp!=2&&inp!=3&&inp!=4){printf("\n\n\t没有这项服务~\n\t按任意键重新选择~");input=getchar();}}while (inp!=1&&inp!=2&&inp!=3&&inp!=4);fclose(fp);switch (inp){case 1: id_search(); break;case 2: wr_search(); break;case 3: bn_search(); break;case 4: adm_servelist(); break;}}}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
登陆界面using System;using;using ;using ;using ;using Labrary{public partial class FormLogin : Form{public FormLogin(){InitializeComponent();}}SetMenJin("PicIn");();户ì管¨1理¤¨ = true;this.系|ì统a3初始o化¥= true;this.应|用模ê式o = true;this.图a书o¨|管¨1理¤¨ = true; this.退a办¨卡§ = true;this.借¨¨阅= true;this.门禁= true; SetPurview();= false;= false;= false;|用模ê式o = false;}else{this.用户管理¨ = false;this.系统初始化¥= false;this.读书管理¨ = false;this.退办卡§ = false;this.借阅= false;this.门禁= false;for (int i = 0; i < i++){string purview = if (purview == "1"){this.图书管理¨ = true;}else if (purview == "2"){this.办退卡§ = true;}else if (purview == "3"){this.借阅= true;}else if (purview == "4"){this.门禁= true;}}}}private void用户管理¨aToolStripMenuItem_Click(object sender, EventArgs e) {ful = new ;();}private void修改密码ToolStripMenuItem_Click(object sender, EventArgs e) {fup = new , ;();}private void tsbtnBookType_Click(object sender, EventArgs e){FormBookTypeList fbtl = new FormBookTypeList();();}private void tsbtnBookAdd_Click(object sender, EventArgs e){FormBookAdd fba = new FormBookAdd();();}private void tsbtnBookManage_Click(object sender, EventArgs e){FormBookInfoList fbil = new FormBookInfoList();();}private void tsbtnBookStatistics_Click(object sender, EventArgs e){FormBookStatistics fbs = new FormBookStatistics();();}private void退a出XToolStripMenuItem_Click(object sender, EventArgs e) {();}private void tsbtnCardAdd_Click(object sender, EventArgs e){FormCardInfo fci = new FormCardInfo(1, new ObjCardInfo());();}private void tsbtnCardManage_Click(object sender, EventArgs e){FormCardList fcl = new FormCardList();();}private void tsbtnAddTime_Click(object sender, EventArgs e){string rfid = ();if (rfid == ""){("请把借阅卡放到桌面读写器上!");}else{if (rfid)){ObjCardInfo oci = new ObjCardInfo(rfid);FormCardInfo fci = new FormCardInfo(5, oci);();}else{("没有此借阅卡信息");}}}private void tsbtnCardDelete_Click(object sender, EventArgs e) {string rfid = ();if (rfid == ""){("请把借阅卡到读写器上");}else{if (rfid)){ObjCardInfo oci = new ObjCardInfo(rfid);int count = ();if (count == 0){if ("是否决定退卡!ê", "", =={();("退卡成功|!ê");}}else{+ "还有一本" + () + " 本书未归还不能退卡");}}else{("没有此借阅信息");}}}private void tsbtnJie_Click(object sender, EventArgs e){FormBookJie fbj = new FormBookJie(1);();}private void tsbtnHuan_Click(object sender, EventArgs e){FormBookHuan fbh = new FormBookHuan();();}private void图a书o¨|管¨1理¤¨aToolStripMenuItem_Click(object sender, EventArgs e) {= true;= false;= false;= + "\\pic\\");}private void退a办¨卡§ToolStripMenuItem_Click(object sender, EventArgs e) {= false;= true;= false;= + "\\pic\\");}private void借¨¨阅ToolStripMenuItem_Click(object sender, EventArgs e){= false;= false;= true;= + "\\pic\\");}private void门禁ToolStripMenuItem_Click(object sender, EventArgs e){plit(',')[0];int headerWidth = (headerText[i].Split(',')[1]);= headerName;= headerWidth;}DataTable dtb = for (int i = 0; i < i++){ObjBookInfo bookInfo = new ObjBookInfo[i]["RFID"].ToString());ListViewItem item = new ListViewItem(new string[] { , , , , });}ListViewItem itemCount = new ListViewItem(new string[] { "统a3计", "", "", "", "", + "本à" });}private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e){if== "全部书架¨1"){= 0;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo"));}if== "第一书架¨1"){= 1;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='1'"));}if== "第二书架¨1"){= 2;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='2'"));}if== "第三书架¨1"){= 3;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='3'"));}if== "第四书架¨1"){= 4;BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='4'"));}}private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e){if== 0){if== 0){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo"));}if== 1){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='1'"));}if== 2){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='0'"));}}if> 0){if== 0){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}'", }if== 1){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}' and LendStatus='1'", }if== 2){BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='{0}' and LendStatus='0'", }}}}}借阅卡管理using System;using;using ;using ;using ;using Labrary{public partial class FormCardList : Form{public FormCardList(){InitializeComponent();SetListView();}private void SetListView(){List<ObjCardInfo> listCard = ();for (int i = 0; i < ; i++){ObjCardInfo oci = listCard[i];ListViewItem item = new ListViewItem;= oci;subitem1 = new ();= ;subitem2 = new ();= ;subitem3 = new ();= "yyyy年¨oMM月dd日¨");subitem4 = new ();= ;subitem5 = new ();= subitem6 = new ();= subitem7 = new ();= }}private void SetListView(List<ObjCardInfo> listCard){for (int i = 0; i < ; i++){ObjCardInfo oci = listCard[i];ListViewItem item = new ListViewItem;= oci;subitem1 = new ();= ;subitem2 = new ();= ;subitem3 = new ();= "yyyy年¨oMM月dd日¨");subitem4 = new ();= ;subitem5 = new ();= subitem6 = new ();= subitem7 = new ();= }}private void tsbtnExit_Click(object sender, EventArgs e){();}private void tsbtnInsert_Click(object sender, EventArgs e){FormCardInfo fci = new FormCardInfo(1, new ObjCardInfo());if () =={SetListView();IsEnabled(false);}}private void IsEnabled(bool Enabled){oString());= ;subitem1 = new ();= row["lendtime"].ToString();subitem2 = new ();= row["returntime"].ToString();}}private void tsbtnExit_Click(object sender, EventArgs e){();}}}图书管理using System;using;using ;using ;using ;using Labrary{public partial class FormBookInfoList : Form{public FormBookInfoList(){InitializeComponent();}private void SetCboBookType(){string sql = "select * from booktype";DataTable dt = = dt;= "Name";= "ID";}private void SetListView(){IsEnabled(false);List<ObjBookInfo> listBookInfo = for (int i = 0; i < ; i++){ObjBookInfo obi = listBookInfo[i];ListViewItem item = new ListViewItem();= ;= obi;subLendStatus = new ();= ;subBookName = new ();= ;subPress = new ();= ;subPrice = new ();= ;subAddPerson = new ();= subAddTime = new ();= }}private void tsbtnExit_Click(object sender, EventArgs e){();}private void tscboBookType_DropDown(object sender, EventArgs e){SetCboBookType();}private void tscboBookType_DropDownClosed(object sender, EventArgs e) {SetListView();}private void tsbtnInsert_Click(object sender, EventArgs e){FormBookAdd fba = new FormBookAdd();if () =={}}private void listView1_SelectedIndexChanged(object sender, EventArgs e) {if> 0){IsEnabled(true);}else{IsEnabled(false);}}private void IsEnabled(bool enabled){= enabled;= enabled;}private void tsbtnUpdate_Click(object sender, EventArgs e){if> 0){FormBookInfo fbi = new FormBookInfo(3, as ObjBookInfo);if () =={SetListView();}}}private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) {if> 0){FormBookInfo fbi = new FormBookInfo(4, as ObjBookInfo);();}}private void tsbtnBookRecord_Click(object sender, EventArgs e){if> 0){FormBookRecord fbr = new FormBookRecord as ObjBookInfo);();}}}}图书上架using System;using;using ;using ;using ;using Labrary{public partial class FormBookAdd : Form{List<string> listAllRfid = new List<string>();List<ObjBookInfo> listBookInfo = new List<ObjBookInfo>();public FormBookAdd(){InitializeComponent();= 0;}private bool ValidControl(){{("请读取图书RFID!ê");return false; }if== ""){("请选择图书分类");return false; }if== ""){("请填写书名");return false; }if== ""){("请填写作者");return false; }if== ""){("请填写定价");return false; }{("请填写出版社");return false;}if== 0){("请选择书架");return false;}return true;}private void gbtnCancel_Click(object sender, EventArgs e) {();}private void btnReadRFID_Click(object sender, EventArgs e) {List<string> listRfid = ();for (int i = 0; i < ; i++){oString();}oString());= ;subitem1 = new ();= row["lendtime"].ToString();subitem2 = new ();= row["returntime"].ToString();}}private void tsbtnExit_Click(object sender, EventArgs e){();}}}。