├── .gitattributes ├── .gitignore ├── Library.opensdf └── Library ├── Book.cpp ├── Book.h ├── BorrowRecord.cpp ├── BorrowRecord.h ├── DBUtil.cpp ├── DBUtil.h ├── Manager.cpp ├── Manager.h ├── Release Note.txt ├── Student.cpp ├── Student.h ├── TimeUtil.cpp ├── TimeUtil.h ├── User.cpp ├── User.h ├── library.sql ├── main.cpp └── readme.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /Library.opensdf: -------------------------------------------------------------------------------- 1 | CrandoLENOVO -------------------------------------------------------------------------------- /Library/Book.cpp: -------------------------------------------------------------------------------- 1 | #include "Book.h" 2 | 3 | Book::Book() 4 | { 5 | 6 | } 7 | 8 | Book::Book(int nBookID, string strBookName, string strAuthor, string strISBN, string strPub, time_t inDate, int nTotalNum, int nLeftNum) 9 | { 10 | m_nBookID = nBookID; 11 | m_strBookName = strBookName; 12 | m_strAuthor = strAuthor; 13 | m_strISBN = strISBN; 14 | m_strPub = strPub; 15 | m_inDate = inDate; 16 | m_nTotalNum = nTotalNum; 17 | m_nLeftNum = nLeftNum; 18 | } 19 | 20 | 21 | Book::~Book() 22 | { 23 | } 24 | 25 | int Book::GetBookID() 26 | { 27 | return m_nBookID; 28 | } 29 | 30 | void Book::SetBookID(int nID) 31 | { 32 | m_nBookID = nID; 33 | } 34 | 35 | string Book::GetBookName() 36 | { 37 | return m_strBookName; 38 | } 39 | 40 | void Book::SetBookName(string strName) 41 | { 42 | m_strBookName = strName; 43 | } 44 | 45 | string Book::GetAuthor() 46 | { 47 | return m_strAuthor; 48 | } 49 | 50 | void Book::SetAuthor(string strAuthor) 51 | { 52 | m_strAuthor = strAuthor; 53 | } 54 | 55 | string Book::GetISBN() 56 | { 57 | return m_strISBN; 58 | } 59 | 60 | void Book::SetISBN(string strISBN) 61 | { 62 | m_strISBN = strISBN; 63 | } 64 | 65 | string Book::GetPub() 66 | { 67 | return m_strPub; 68 | } 69 | 70 | void Book::SetPub(string strPub) 71 | { 72 | m_strPub = strPub; 73 | } 74 | 75 | string Book::GetInDate() 76 | { 77 | return m_inDate; 78 | } 79 | 80 | void Book::SetInDate(string inDate) 81 | { 82 | m_inDate = inDate; 83 | } 84 | 85 | int Book::GetTotalNum() 86 | { 87 | return m_nTotalNum; 88 | } 89 | 90 | void Book::SetTotalNum(int nTotalNum) 91 | { 92 | m_nTotalNum = nTotalNum; 93 | } 94 | 95 | int Book::GetLeftNum() 96 | { 97 | return m_nLeftNum; 98 | } 99 | 100 | void Book::SetLeftNum(int nLeftNum) 101 | { 102 | m_nLeftNum = nLeftNum; 103 | } 104 | -------------------------------------------------------------------------------- /Library/Book.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/Book.h -------------------------------------------------------------------------------- /Library/BorrowRecord.cpp: -------------------------------------------------------------------------------- 1 | #include "BorrowRecord.h" 2 | 3 | 4 | BorrowRecord::BorrowRecord() 5 | { 6 | } 7 | 8 | 9 | BorrowRecord::~BorrowRecord() 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /Library/BorrowRecord.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/BorrowRecord.h -------------------------------------------------------------------------------- /Library/DBUtil.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/DBUtil.cpp -------------------------------------------------------------------------------- /Library/DBUtil.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/DBUtil.h -------------------------------------------------------------------------------- /Library/Manager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/Manager.cpp -------------------------------------------------------------------------------- /Library/Manager.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "User.h" 9 | #include "Book.h" 10 | #include "TimeUtil.h" 11 | #include "DBUtil.h" 12 | using namespace std; 13 | #pragma once 14 | class Manager:public User 15 | { 16 | public: 17 | Manager(); 18 | ~Manager(); 19 | void ShowMenu(); 20 | bool AddBook(); 21 | bool DisplayAllBook(); 22 | bool QueryBook(string strBookName); 23 | bool DeleteBook(int nBookId); 24 | bool DiaplayAllBorrowRecord(); 25 | bool AddUser(); 26 | bool DisplayAllUser(); 27 | TimeUtil m_timeUtil; 28 | DBUtil m_dbUtil; 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /Library/Release Note.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/Release Note.txt -------------------------------------------------------------------------------- /Library/Student.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/Student.cpp -------------------------------------------------------------------------------- /Library/Student.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "User.h" 8 | #include "Book.h" 9 | #include "TimeUtil.h" 10 | #include "DBUtil.h" 11 | #include "User.h" 12 | #include "BorrowRecord.h" 13 | using namespace std; 14 | class Student:public User 15 | { 16 | public: 17 | Student(); 18 | ~Student(); 19 | void ShowMenu(); 20 | bool QueryBook(string strBookName); 21 | bool BorrowBook(int nBookId); 22 | bool ReturnBook(); 23 | bool ShowMyBorrowRecord(); 24 | bool RenewBook(); 25 | public: 26 | TimeUtil m_timeUtil; 27 | DBUtil m_dbUtil; 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /Library/TimeUtil.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/TimeUtil.cpp -------------------------------------------------------------------------------- /Library/TimeUtil.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #pragma once 7 | using namespace std; 8 | class TimeUtil 9 | { 10 | public: 11 | TimeUtil(); 12 | ~TimeUtil(); 13 | void TimeToString(time_t time1, char *szTime); 14 | time_t StringToTime(char * szTime); 15 | string AddMonth(time_t &tTime); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /Library/User.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "User.h" 3 | using std::cout; 4 | User::User() 5 | { 6 | } 7 | 8 | 9 | User::~User() 10 | { 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Library/User.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // 文件名:User.h 3 | // 作者:Crando 4 | // 功能:用户类 5 | // 时间:2015-4-20 6 | //======================================================================= 7 | 8 | #pragma once 9 | #include 10 | using namespace std; 11 | class User 12 | { 13 | public: 14 | User(); 15 | ~User(); 16 | public: 17 | int m_nID; //用户ID 18 | string m_strName; //用户名 19 | string m_strPassword; //用户密码 20 | int m_nRole; //用户角色,1表示管理员,2表示普通用户 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /Library/library.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : MySQL 5 | Source Server Version : 50531 6 | Source Host : localhost:3306 7 | Source Database : library 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50531 11 | File Encoding : 65001 12 | 13 | Date: 2015-07-13 23:29:00 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for book 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `book`; 22 | CREATE TABLE `book` ( 23 | `id` int(11) NOT NULL AUTO_INCREMENT, 24 | `bookname` varchar(30) DEFAULT NULL, 25 | `author` varchar(30) DEFAULT NULL, 26 | `isbn` varchar(30) DEFAULT NULL, 27 | `pub` varchar(30) DEFAULT NULL, 28 | `inDate` date DEFAULT NULL, 29 | `total` int(11) DEFAULT NULL, 30 | `left` int(11) DEFAULT NULL, 31 | PRIMARY KEY (`id`) 32 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; 33 | 34 | -- ---------------------------- 35 | -- Table structure for borrowrecord 36 | -- ---------------------------- 37 | DROP TABLE IF EXISTS `borrowrecord`; 38 | CREATE TABLE `borrowrecord` ( 39 | `id` int(11) NOT NULL AUTO_INCREMENT, 40 | `bookid` int(11) DEFAULT NULL, 41 | `userid` int(11) DEFAULT NULL, 42 | `borrowdate` date DEFAULT NULL, 43 | `shouldreturndate` date DEFAULT NULL, 44 | `returndate` date DEFAULT NULL, 45 | `continue` int(11) DEFAULT NULL, 46 | PRIMARY KEY (`id`) 47 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; 48 | 49 | -- ---------------------------- 50 | -- Table structure for user 51 | -- ---------------------------- 52 | DROP TABLE IF EXISTS `user`; 53 | CREATE TABLE `user` ( 54 | `id` int(11) NOT NULL AUTO_INCREMENT, 55 | `name` varchar(20) DEFAULT NULL, 56 | `password` varchar(20) DEFAULT NULL, 57 | `usertype` int(11) DEFAULT NULL, 58 | PRIMARY KEY (`id`) 59 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 60 | -------------------------------------------------------------------------------- /Library/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/main.cpp -------------------------------------------------------------------------------- /Library/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrandoLee/Library/68722af1caeb6f77b88b2bcf3174ceab73704eef/Library/readme.txt --------------------------------------------------------------------------------