├── DataBase Project
├── .vs
│ └── DataBase Project
│ │ └── v14
│ │ └── .suo
└── 22920152203860_洪义耕_大实验_图书管理系统
│ ├── C#程序
│ ├── DataBase Project.sln
│ └── DataBase Project
│ │ ├── App.config
│ │ ├── BookEdit.Designer.cs
│ │ ├── BookEdit.cs
│ │ ├── BookEdit.resx
│ │ ├── ClassDiagram1.cd
│ │ ├── ClassDiagram2.cd
│ │ ├── DataBase Project.csproj
│ │ ├── DbHelperSQL.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ │ ├── PubConstant.cs
│ │ ├── ReaderEdit.Designer.cs
│ │ ├── ReaderEdit.cs
│ │ ├── ReaderEdit.resx
│ │ ├── login.Designer.cs
│ │ ├── login.cs
│ │ ├── login.resx
│ │ ├── main.Designer.cs
│ │ ├── main.cs
│ │ ├── main.resx
│ │ ├── register.Designer.cs
│ │ ├── register.cs
│ │ └── register.resx
│ ├── ER图.vsdx
│ ├── 报告和文档
│ ├── 个人报告.doc
│ ├── 个人报告_洪义耕.doc
│ ├── 个人报告_陈亮.doc
│ ├── 小组成员信息.docx
│ ├── 小组评分表.doc
│ ├── 数据库设计报告.doc
│ ├── 系统设计文档.doc
│ └── 系统详细设计文档V1.0.doc
│ ├── 数据库文件
│ ├── Library.mdf
│ ├── Library_log.ldf
│ └── SQL脚本.sql
│ └── 物理数据模型.pdm
└── README.md
/DataBase Project/.vs/DataBase Project/v14/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/.vs/DataBase Project/v14/.suo
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBase Project", "DataBase Project\DataBase Project.csproj", "{FA3E5528-D949-4E87-932D-C6187B083CB3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {FA3E5528-D949-4E87-932D-C6187B083CB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {FA3E5528-D949-4E87-932D-C6187B083CB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {FA3E5528-D949-4E87-932D-C6187B083CB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {FA3E5528-D949-4E87-932D-C6187B083CB3}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/BookEdit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DataBase_Project
2 | {
3 | partial class BookEdit
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.label3 = new System.Windows.Forms.Label();
34 | this.label4 = new System.Windows.Forms.Label();
35 | this.label5 = new System.Windows.Forms.Label();
36 | this.label6 = new System.Windows.Forms.Label();
37 | this.label7 = new System.Windows.Forms.Label();
38 | this.bname = new System.Windows.Forms.TextBox();
39 | this.isbn = new System.Windows.Forms.TextBox();
40 | this.author = new System.Windows.Forms.TextBox();
41 | this.pub = new System.Windows.Forms.TextBox();
42 | this.bCurNum = new System.Windows.Forms.TextBox();
43 | this.storeNum = new System.Windows.Forms.TextBox();
44 | this.available = new System.Windows.Forms.ComboBox();
45 | this.booksubmit = new System.Windows.Forms.Button();
46 | this.SuspendLayout();
47 | //
48 | // label1
49 | //
50 | this.label1.AutoSize = true;
51 | this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
52 | this.label1.Location = new System.Drawing.Point(43, 59);
53 | this.label1.Name = "label1";
54 | this.label1.Size = new System.Drawing.Size(29, 12);
55 | this.label1.TabIndex = 0;
56 | this.label1.Text = "ISBN";
57 | //
58 | // label2
59 | //
60 | this.label2.AutoSize = true;
61 | this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
62 | this.label2.Location = new System.Drawing.Point(272, 59);
63 | this.label2.Name = "label2";
64 | this.label2.Size = new System.Drawing.Size(29, 12);
65 | this.label2.TabIndex = 1;
66 | this.label2.Text = "书名";
67 | //
68 | // label3
69 | //
70 | this.label3.AutoSize = true;
71 | this.label3.Font = new System.Drawing.Font("宋体", 9F);
72 | this.label3.Location = new System.Drawing.Point(43, 98);
73 | this.label3.Name = "label3";
74 | this.label3.Size = new System.Drawing.Size(41, 12);
75 | this.label3.TabIndex = 2;
76 | this.label3.Text = "出版社";
77 | //
78 | // label4
79 | //
80 | this.label4.AutoSize = true;
81 | this.label4.Font = new System.Drawing.Font("宋体", 9F);
82 | this.label4.Location = new System.Drawing.Point(272, 98);
83 | this.label4.Name = "label4";
84 | this.label4.Size = new System.Drawing.Size(29, 12);
85 | this.label4.TabIndex = 3;
86 | this.label4.Text = "作者";
87 | //
88 | // label5
89 | //
90 | this.label5.AutoSize = true;
91 | this.label5.Font = new System.Drawing.Font("宋体", 9F);
92 | this.label5.Location = new System.Drawing.Point(43, 139);
93 | this.label5.Name = "label5";
94 | this.label5.Size = new System.Drawing.Size(53, 12);
95 | this.label5.TabIndex = 4;
96 | this.label5.Text = "馆藏数量";
97 | //
98 | // label6
99 | //
100 | this.label6.AutoSize = true;
101 | this.label6.Font = new System.Drawing.Font("宋体", 9F);
102 | this.label6.Location = new System.Drawing.Point(272, 139);
103 | this.label6.Name = "label6";
104 | this.label6.Size = new System.Drawing.Size(53, 12);
105 | this.label6.TabIndex = 5;
106 | this.label6.Text = "可借数量";
107 | //
108 | // label7
109 | //
110 | this.label7.AutoSize = true;
111 | this.label7.Font = new System.Drawing.Font("宋体", 9F);
112 | this.label7.Location = new System.Drawing.Point(43, 187);
113 | this.label7.Name = "label7";
114 | this.label7.Size = new System.Drawing.Size(53, 12);
115 | this.label7.TabIndex = 6;
116 | this.label7.Text = "是否可借";
117 | //
118 | // bname
119 | //
120 | this.bname.Location = new System.Drawing.Point(339, 56);
121 | this.bname.Name = "bname";
122 | this.bname.Size = new System.Drawing.Size(121, 21);
123 | this.bname.TabIndex = 1;
124 | //
125 | // isbn
126 | //
127 | this.isbn.Location = new System.Drawing.Point(106, 56);
128 | this.isbn.Name = "isbn";
129 | this.isbn.Size = new System.Drawing.Size(121, 21);
130 | this.isbn.TabIndex = 0;
131 | //
132 | // author
133 | //
134 | this.author.Location = new System.Drawing.Point(339, 93);
135 | this.author.Name = "author";
136 | this.author.Size = new System.Drawing.Size(121, 21);
137 | this.author.TabIndex = 3;
138 | //
139 | // pub
140 | //
141 | this.pub.Location = new System.Drawing.Point(106, 93);
142 | this.pub.Name = "pub";
143 | this.pub.Size = new System.Drawing.Size(121, 21);
144 | this.pub.TabIndex = 2;
145 | //
146 | // bCurNum
147 | //
148 | this.bCurNum.Location = new System.Drawing.Point(339, 134);
149 | this.bCurNum.Name = "bCurNum";
150 | this.bCurNum.Size = new System.Drawing.Size(121, 21);
151 | this.bCurNum.TabIndex = 5;
152 | this.bCurNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
153 | //
154 | // storeNum
155 | //
156 | this.storeNum.Location = new System.Drawing.Point(106, 138);
157 | this.storeNum.Name = "storeNum";
158 | this.storeNum.Size = new System.Drawing.Size(121, 21);
159 | this.storeNum.TabIndex = 4;
160 | this.storeNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
161 | //
162 | // available
163 | //
164 | this.available.BackColor = System.Drawing.SystemColors.Window;
165 | this.available.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
166 | this.available.FormattingEnabled = true;
167 | this.available.Items.AddRange(new object[] {
168 | "是",
169 | "否"});
170 | this.available.Location = new System.Drawing.Point(106, 183);
171 | this.available.Name = "available";
172 | this.available.Size = new System.Drawing.Size(121, 20);
173 | this.available.TabIndex = 13;
174 | //
175 | // booksubmit
176 | //
177 | this.booksubmit.Location = new System.Drawing.Point(205, 236);
178 | this.booksubmit.Name = "booksubmit";
179 | this.booksubmit.Size = new System.Drawing.Size(75, 23);
180 | this.booksubmit.TabIndex = 14;
181 | this.booksubmit.Text = "确定";
182 | this.booksubmit.UseVisualStyleBackColor = true;
183 | this.booksubmit.Click += new System.EventHandler(this.booksubmit_Click);
184 | //
185 | // BookEdit
186 | //
187 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
188 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
189 | this.ClientSize = new System.Drawing.Size(489, 315);
190 | this.Controls.Add(this.booksubmit);
191 | this.Controls.Add(this.available);
192 | this.Controls.Add(this.storeNum);
193 | this.Controls.Add(this.bCurNum);
194 | this.Controls.Add(this.pub);
195 | this.Controls.Add(this.author);
196 | this.Controls.Add(this.isbn);
197 | this.Controls.Add(this.bname);
198 | this.Controls.Add(this.label7);
199 | this.Controls.Add(this.label6);
200 | this.Controls.Add(this.label5);
201 | this.Controls.Add(this.label4);
202 | this.Controls.Add(this.label3);
203 | this.Controls.Add(this.label2);
204 | this.Controls.Add(this.label1);
205 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
206 | this.MaximizeBox = false;
207 | this.MinimizeBox = false;
208 | this.Name = "BookEdit";
209 | this.Text = "图书信息";
210 | this.Load += new System.EventHandler(this.BookEdit_Load);
211 | this.Shown += new System.EventHandler(this.BookEdit_Shown);
212 | this.ResumeLayout(false);
213 | this.PerformLayout();
214 |
215 | }
216 |
217 | #endregion
218 |
219 | private System.Windows.Forms.Label label1;
220 | private System.Windows.Forms.Label label2;
221 | private System.Windows.Forms.Label label3;
222 | private System.Windows.Forms.Label label4;
223 | private System.Windows.Forms.Label label5;
224 | private System.Windows.Forms.Label label6;
225 | private System.Windows.Forms.Label label7;
226 | private System.Windows.Forms.TextBox bname;
227 | private System.Windows.Forms.TextBox isbn;
228 | private System.Windows.Forms.TextBox author;
229 | private System.Windows.Forms.TextBox pub;
230 | private System.Windows.Forms.TextBox bCurNum;
231 | private System.Windows.Forms.TextBox storeNum;
232 | private System.Windows.Forms.ComboBox available;
233 | private System.Windows.Forms.Button booksubmit;
234 | }
235 | }
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/BookEdit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace DataBase_Project
12 | {
13 | public partial class BookEdit : Form
14 | {
15 | public BookEdit()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | public main main
21 | {
22 | get
23 | {
24 | throw new System.NotImplementedException();
25 | }
26 |
27 | set
28 | {
29 | }
30 | }
31 |
32 | public DbHelperSQL DbHelperSQL
33 | {
34 | get
35 | {
36 | throw new System.NotImplementedException();
37 | }
38 |
39 | set
40 | {
41 | }
42 | }
43 |
44 | public string bookid;
45 | public string Optype;
46 |
47 | private void BookEdit_Load(object sender, EventArgs e)
48 | {
49 | this.available.SelectedItem = "是";//默认当前下拉框选项
50 | if (Optype.Equals("EDIT"))
51 | {
52 | getbookinfo(bookid);
53 | }
54 | }
55 | private void getbookinfo(string bookid)
56 | {
57 | string sql = "SELECT isbn,bname,pub,author,storeNum,bCurNum,available FROM books "
58 | + " WHERE isbn='" + bookid + "'";
59 | DataSet dataSet = DbHelperSQL.Query(sql);
60 | if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
61 | {
62 | this.isbn.Text = dataSet.Tables[0].Rows[0]["isbn"].ToString();
63 | this.bname.Text = dataSet.Tables[0].Rows[0]["bname"].ToString();
64 | this.pub.Text = dataSet.Tables[0].Rows[0]["pub"].ToString();
65 | this.author.Text = dataSet.Tables[0].Rows[0]["author"].ToString();
66 | this.storeNum.Text = dataSet.Tables[0].Rows[0]["storeNum"].ToString();
67 | this.bCurNum.Text = dataSet.Tables[0].Rows[0]["bCurNum"].ToString();
68 | this.available.SelectedItem = dataSet.Tables[0].Rows[0]["available"];
69 | }
70 | }
71 |
72 | private void booksubmit_Click(object sender, EventArgs e)
73 | {
74 | string sql = string.Empty;
75 | //this.available.SelectedIndex = 0;
76 | try
77 | {
78 | //新增调用
79 | if (Optype.Equals("ADD"))
80 | {
81 | sql = "INSERT INTO [books]([isbn],[bname],[pub],[author],[storeNum],[bCurNum],[available]) VALUES(";
82 | if (string.IsNullOrEmpty(this.isbn.Text.ToString()))
83 | {
84 | MessageBox.Show("书号不能为空");
85 | return;
86 | }
87 | else
88 | {
89 | sql += "'" + this.isbn.Text.ToString() + "',";
90 | }
91 | if (string.IsNullOrEmpty(this.bname.Text.ToString()))
92 | {
93 | MessageBox.Show("书名不能为空");
94 | return;
95 | }
96 | else
97 | {
98 | sql += "'" + this.bname.Text.ToString() + "',";
99 | }
100 | sql += "'" + this.pub.Text.ToString() + "',";
101 | sql += "'" + this.author.Text.ToString() + "',";
102 | //转换数值不加引号,待定
103 | sql += this.storeNum.Text.ToString() + ",";
104 | sql += this.bCurNum.Text.ToString() + ",";
105 | sql += "'" + this.available.SelectedItem.ToString() + "'";
106 | sql += ")";
107 | DbHelperSQL.ExecuteSql(sql);
108 | }
109 | else
110 | //编辑调用
111 | {
112 | sql = "UPDATE [books] SET ";
113 | sql += "[isbn]='" + this.isbn.Text.ToString() + "',";
114 | sql += "[bname]='" + this.bname.Text.ToString() + "',";
115 | sql += "[pub]='" + this.pub.Text.ToString() + "',";
116 | sql += "[author]='" + this.author.Text.ToString() + "',";
117 | sql += "[storeNum]=" + this.storeNum.Text.ToString() + ",";
118 | sql += "[bCurNum]=" + this.bCurNum.Text.ToString() + ",";
119 | sql += "[available]='" + this.available.SelectedItem.ToString() + "'";
120 | sql += " WHERE [isbn]='" + bookid + "'";
121 | DbHelperSQL.ExecuteSql(sql);
122 | }
123 | }
124 | catch (Exception ex)
125 | {
126 | MessageBox.Show(ex.Message);
127 | return;
128 | }
129 | this.Close();
130 | }
131 |
132 | private void numberInputOnly(object sender, KeyPressEventArgs e)
133 | {
134 | if (Char.IsNumber(e.KeyChar) || e.KeyChar == 8)
135 | {
136 | e.Handled = false;
137 | }
138 | else
139 | {
140 | e.Handled = true;
141 | }
142 | }
143 |
144 | private void BookEdit_Shown(object sender, EventArgs e)
145 | {
146 | if(Optype=="EDIT")
147 | {
148 | isbn.ReadOnly = true;
149 | }
150 | }
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/BookEdit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/ClassDiagram1.cd:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/ClassDiagram2.cd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | AAAACCQABCAAUBIEAUCBAIACAQAAAAACAAAAAgAEAAQ=
7 | BookEdit.cs
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | AAACAAAAAAAAAAAAAAAAAAAAAAAAAAgAQAAAAAAAAAA=
18 | DbHelperSQL.cs
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | AAAAAAAACCIAABAAEACAAAACAAAAAAAAQQAAQgAAAIA=
28 | login.cs
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 9xIAQAQAEGpgKFgGghaLBIIDACBBGAQiCCAAAlgENBA=
39 | main.cs
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | PubConstant.cs
55 |
56 |
57 |
58 |
59 | AAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAABQAAA=
60 | PubConstant.cs
61 |
62 |
63 |
64 |
65 |
66 | AAAAAAABCCAAABAAEhSBAAICAAABCAAggAAAQgAEAAQ=
67 | ReaderEdit.cs
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | AAAAAAAACCAAABAAEACAAIACAAAAAAAAAAAAQgBAAAA=
78 | register.cs
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/DataBase Project.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FA3E5528-D949-4E87-932D-C6187B083CB3}
8 | WinExe
9 | Properties
10 | DataBase_Project
11 | DataBase Project
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Form
53 |
54 |
55 | BookEdit.cs
56 |
57 |
58 |
59 | Form
60 |
61 |
62 | login.cs
63 |
64 |
65 |
66 |
67 | Form
68 |
69 |
70 | main.cs
71 |
72 |
73 |
74 | Form
75 |
76 |
77 | ReaderEdit.cs
78 |
79 |
80 | Form
81 |
82 |
83 | register.cs
84 |
85 |
86 | BookEdit.cs
87 |
88 |
89 | login.cs
90 |
91 |
92 | ResXFileCodeGenerator
93 | Resources.Designer.cs
94 | Designer
95 |
96 |
97 | True
98 | Resources.resx
99 |
100 |
101 | main.cs
102 |
103 |
104 | ReaderEdit.cs
105 |
106 |
107 | register.cs
108 |
109 |
110 |
111 |
112 | SettingsSingleFileGenerator
113 | Settings.Designer.cs
114 |
115 |
116 | True
117 | Settings.settings
118 | True
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/DbHelperSQL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Specialized;
4 | using System.Data;
5 | using System.Data.SqlClient;
6 | using System.Configuration;
7 | using System.Data.Common;
8 | using System.Collections.Generic;
9 | using System.Windows.Forms;
10 |
11 | namespace DataBase_Project
12 | {
13 | ///
14 | /// 数据访问抽象基础类
15 | ///
16 | public abstract class DbHelperSQL
17 | {
18 | public DbHelperSQL()
19 | {
20 |
21 | }
22 |
23 | public PubConstant PubConstant
24 | {
25 | get
26 | {
27 | throw new System.NotImplementedException();
28 | }
29 |
30 | set
31 | {
32 | }
33 | }
34 |
35 | #region 执行简单SQL语句
36 |
37 | ///
38 | /// 执行SQL语句,返回影响的记录数
39 | ///
40 | /// SQL语句
41 | /// 影响的记录数
42 | public static int ExecuteSql(string SQLString)
43 | {
44 | using (SqlCommand cmd = new SqlCommand(SQLString, PubConstant.currentConnection))
45 | {
46 | try
47 | {
48 | int rows = cmd.ExecuteNonQuery();
49 | return rows;
50 | }
51 | catch (SqlException e)
52 | {
53 | if (e.Message == "该读者当前还有未还书籍,不能借书!")
54 | {
55 | throw new Exception("该读者当前还有未还书籍,不能借书!");
56 | }
57 | else if (MessageBox.Show(e.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
58 | return 0;
59 | return 0;
60 | }
61 | }
62 | }
63 |
64 | ///
65 | /// 执行查询语句,返回DataSet
66 | ///
67 | /// 查询语句
68 | /// DataSet
69 | public static DataSet Query(string SQLString)
70 | {
71 | DataSet ds = new DataSet();
72 | try
73 | {
74 | SqlDataAdapter command = new SqlDataAdapter(SQLString, PubConstant.currentConnection);
75 | command.Fill(ds, "ds");
76 | }
77 | catch (SqlException ex)
78 | {
79 | if (MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
80 | return ds;
81 | }
82 | return ds;
83 | }
84 |
85 | #endregion
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace DataBase_Project
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new login());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("DataBase Project")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DataBase Project")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("fa3e5528-d949-4e87-932d-c6187b083cb3")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DataBase_Project.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataBase_Project.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DataBase_Project.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/PubConstant.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Data.SqlClient;
4 | using System.Windows.Forms;
5 |
6 | namespace DataBase_Project
7 | {
8 | ///
9 | /// 公共常量
10 | ///
11 | public class PubConstant
12 | {
13 | public enum loginStatus { Reader, Admin, Unlogin };
14 | public static loginStatus identity = loginStatus.Unlogin;
15 | public static string currentAccount = "";
16 | public static string currentPasswd = "";
17 | public static SqlConnection currentConnection = new SqlConnection();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/ReaderEdit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DataBase_Project
2 | {
3 | partial class ReaderEdit
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.label3 = new System.Windows.Forms.Label();
34 | this.label4 = new System.Windows.Forms.Label();
35 | this.label5 = new System.Windows.Forms.Label();
36 | this.label6 = new System.Windows.Forms.Label();
37 | this.label7 = new System.Windows.Forms.Label();
38 | this.label8 = new System.Windows.Forms.Label();
39 | this.label9 = new System.Windows.Forms.Label();
40 | this.account = new System.Windows.Forms.TextBox();
41 | this.dept = new System.Windows.Forms.TextBox();
42 | this.phone = new System.Windows.Forms.TextBox();
43 | this.job = new System.Windows.Forms.TextBox();
44 | this.rBorrowedNum = new System.Windows.Forms.TextBox();
45 | this.rname = new System.Windows.Forms.TextBox();
46 | this.rCurNum = new System.Windows.Forms.TextBox();
47 | this.borrowid = new System.Windows.Forms.TextBox();
48 | this.sex = new System.Windows.Forms.ComboBox();
49 | this.confirm = new System.Windows.Forms.Button();
50 | this.SuspendLayout();
51 | //
52 | // label1
53 | //
54 | this.label1.AutoSize = true;
55 | this.label1.Location = new System.Drawing.Point(36, 74);
56 | this.label1.Name = "label1";
57 | this.label1.Size = new System.Drawing.Size(53, 12);
58 | this.label1.TabIndex = 0;
59 | this.label1.Text = "借书证号";
60 | //
61 | // label2
62 | //
63 | this.label2.AutoSize = true;
64 | this.label2.Location = new System.Drawing.Point(36, 108);
65 | this.label2.Name = "label2";
66 | this.label2.Size = new System.Drawing.Size(29, 12);
67 | this.label2.TabIndex = 1;
68 | this.label2.Text = "姓名";
69 | //
70 | // label3
71 | //
72 | this.label3.AutoSize = true;
73 | this.label3.Location = new System.Drawing.Point(36, 145);
74 | this.label3.Name = "label3";
75 | this.label3.Size = new System.Drawing.Size(29, 12);
76 | this.label3.TabIndex = 2;
77 | this.label3.Text = "职称";
78 | //
79 | // label4
80 | //
81 | this.label4.AutoSize = true;
82 | this.label4.Location = new System.Drawing.Point(36, 179);
83 | this.label4.Name = "label4";
84 | this.label4.Size = new System.Drawing.Size(29, 12);
85 | this.label4.TabIndex = 3;
86 | this.label4.Text = "部门";
87 | //
88 | // label5
89 | //
90 | this.label5.AutoSize = true;
91 | this.label5.Location = new System.Drawing.Point(36, 219);
92 | this.label5.Name = "label5";
93 | this.label5.Size = new System.Drawing.Size(29, 12);
94 | this.label5.TabIndex = 4;
95 | this.label5.Text = "性别";
96 | //
97 | // label6
98 | //
99 | this.label6.AutoSize = true;
100 | this.label6.Location = new System.Drawing.Point(235, 77);
101 | this.label6.Name = "label6";
102 | this.label6.Size = new System.Drawing.Size(53, 12);
103 | this.label6.TabIndex = 5;
104 | this.label6.Text = "可借数量";
105 | //
106 | // label7
107 | //
108 | this.label7.AutoSize = true;
109 | this.label7.Location = new System.Drawing.Point(235, 111);
110 | this.label7.Name = "label7";
111 | this.label7.Size = new System.Drawing.Size(53, 12);
112 | this.label7.TabIndex = 6;
113 | this.label7.Text = "已借数量";
114 | //
115 | // label8
116 | //
117 | this.label8.AutoSize = true;
118 | this.label8.Location = new System.Drawing.Point(235, 148);
119 | this.label8.Name = "label8";
120 | this.label8.Size = new System.Drawing.Size(29, 12);
121 | this.label8.TabIndex = 7;
122 | this.label8.Text = "电话";
123 | //
124 | // label9
125 | //
126 | this.label9.AutoSize = true;
127 | this.label9.Location = new System.Drawing.Point(235, 182);
128 | this.label9.Name = "label9";
129 | this.label9.Size = new System.Drawing.Size(29, 12);
130 | this.label9.TabIndex = 8;
131 | this.label9.Text = "账号";
132 | //
133 | // account
134 | //
135 | this.account.Location = new System.Drawing.Point(313, 182);
136 | this.account.Name = "account";
137 | this.account.Size = new System.Drawing.Size(107, 21);
138 | this.account.TabIndex = 8;
139 | //
140 | // dept
141 | //
142 | this.dept.Location = new System.Drawing.Point(108, 176);
143 | this.dept.Name = "dept";
144 | this.dept.Size = new System.Drawing.Size(107, 21);
145 | this.dept.TabIndex = 3;
146 | //
147 | // phone
148 | //
149 | this.phone.Location = new System.Drawing.Point(313, 148);
150 | this.phone.Name = "phone";
151 | this.phone.Size = new System.Drawing.Size(107, 21);
152 | this.phone.TabIndex = 7;
153 | this.phone.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
154 | //
155 | // job
156 | //
157 | this.job.Location = new System.Drawing.Point(108, 142);
158 | this.job.Name = "job";
159 | this.job.Size = new System.Drawing.Size(107, 21);
160 | this.job.TabIndex = 2;
161 | //
162 | // rBorrowedNum
163 | //
164 | this.rBorrowedNum.Location = new System.Drawing.Point(313, 111);
165 | this.rBorrowedNum.Name = "rBorrowedNum";
166 | this.rBorrowedNum.Size = new System.Drawing.Size(107, 21);
167 | this.rBorrowedNum.TabIndex = 6;
168 | this.rBorrowedNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
169 | //
170 | // rname
171 | //
172 | this.rname.Location = new System.Drawing.Point(108, 105);
173 | this.rname.Name = "rname";
174 | this.rname.Size = new System.Drawing.Size(107, 21);
175 | this.rname.TabIndex = 1;
176 | //
177 | // rCurNum
178 | //
179 | this.rCurNum.Location = new System.Drawing.Point(313, 74);
180 | this.rCurNum.Name = "rCurNum";
181 | this.rCurNum.Size = new System.Drawing.Size(107, 21);
182 | this.rCurNum.TabIndex = 5;
183 | this.rCurNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
184 | //
185 | // borrowid
186 | //
187 | this.borrowid.Location = new System.Drawing.Point(108, 71);
188 | this.borrowid.Name = "borrowid";
189 | this.borrowid.Size = new System.Drawing.Size(107, 21);
190 | this.borrowid.TabIndex = 0;
191 | //
192 | // sex
193 | //
194 | this.sex.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
195 | this.sex.FormattingEnabled = true;
196 | this.sex.Items.AddRange(new object[] {
197 | "男",
198 | "女"});
199 | this.sex.Location = new System.Drawing.Point(108, 216);
200 | this.sex.Name = "sex";
201 | this.sex.Size = new System.Drawing.Size(107, 20);
202 | this.sex.TabIndex = 4;
203 | //
204 | // confirm
205 | //
206 | this.confirm.Location = new System.Drawing.Point(189, 276);
207 | this.confirm.Name = "confirm";
208 | this.confirm.Size = new System.Drawing.Size(75, 23);
209 | this.confirm.TabIndex = 18;
210 | this.confirm.Text = "确认";
211 | this.confirm.UseVisualStyleBackColor = true;
212 | this.confirm.Click += new System.EventHandler(this.confirm_Click);
213 | //
214 | // ReaderEdit
215 | //
216 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
217 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
218 | this.ClientSize = new System.Drawing.Size(461, 355);
219 | this.Controls.Add(this.confirm);
220 | this.Controls.Add(this.sex);
221 | this.Controls.Add(this.borrowid);
222 | this.Controls.Add(this.rCurNum);
223 | this.Controls.Add(this.rname);
224 | this.Controls.Add(this.rBorrowedNum);
225 | this.Controls.Add(this.job);
226 | this.Controls.Add(this.phone);
227 | this.Controls.Add(this.dept);
228 | this.Controls.Add(this.account);
229 | this.Controls.Add(this.label9);
230 | this.Controls.Add(this.label8);
231 | this.Controls.Add(this.label7);
232 | this.Controls.Add(this.label6);
233 | this.Controls.Add(this.label5);
234 | this.Controls.Add(this.label4);
235 | this.Controls.Add(this.label3);
236 | this.Controls.Add(this.label2);
237 | this.Controls.Add(this.label1);
238 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
239 | this.MaximizeBox = false;
240 | this.MinimizeBox = false;
241 | this.Name = "ReaderEdit";
242 | this.Text = "读者编辑";
243 | this.Load += new System.EventHandler(this.ReaderEdit_Load);
244 | this.Shown += new System.EventHandler(this.ReaderEdit_Shown);
245 | this.ResumeLayout(false);
246 | this.PerformLayout();
247 |
248 | }
249 |
250 | #endregion
251 |
252 | private System.Windows.Forms.Label label1;
253 | private System.Windows.Forms.Label label2;
254 | private System.Windows.Forms.Label label3;
255 | private System.Windows.Forms.Label label4;
256 | private System.Windows.Forms.Label label5;
257 | private System.Windows.Forms.Label label6;
258 | private System.Windows.Forms.Label label7;
259 | private System.Windows.Forms.Label label8;
260 | private System.Windows.Forms.Label label9;
261 | private System.Windows.Forms.TextBox account;
262 | private System.Windows.Forms.TextBox dept;
263 | private System.Windows.Forms.TextBox phone;
264 | private System.Windows.Forms.TextBox job;
265 | private System.Windows.Forms.TextBox rBorrowedNum;
266 | private System.Windows.Forms.TextBox rname;
267 | private System.Windows.Forms.TextBox rCurNum;
268 | private System.Windows.Forms.TextBox borrowid;
269 | private System.Windows.Forms.ComboBox sex;
270 | private System.Windows.Forms.Button confirm;
271 | }
272 | }
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/ReaderEdit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace DataBase_Project
12 | {
13 | public partial class ReaderEdit : Form
14 | {
15 | public string opType;
16 | public ReaderEdit()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | public ReaderEdit(string inputborrowid,string inputrname,string inputrCurNum, string inputrBorrowedNum, string inputjob, string inputphone, string inputdept,
22 | string inputaccount, string inputsex)
23 | {
24 | InitializeComponent();
25 |
26 | //获取在main中选中的各字段信息显示在文本框中
27 | borrowid.Text = inputborrowid;
28 | rname.Text = inputrname;
29 | rCurNum.Text = inputrCurNum;
30 | rBorrowedNum.Text = inputrBorrowedNum;
31 | job.Text = inputjob;
32 | phone.Text = inputphone;
33 | dept.Text = inputdept;
34 | account.Text = inputaccount;
35 | sex.Text = inputsex;
36 | }
37 |
38 | public main main
39 | {
40 | get
41 | {
42 | throw new System.NotImplementedException();
43 | }
44 |
45 | set
46 | {
47 | }
48 | }
49 |
50 | public DbHelperSQL DbHelperSQL
51 | {
52 | get
53 | {
54 | throw new System.NotImplementedException();
55 | }
56 |
57 | set
58 | {
59 | }
60 | }
61 |
62 | private void ReaderEdit_Load(object sender, EventArgs e)
63 | {
64 | sex.SelectedIndex = 0;
65 | }
66 |
67 | private void confirm_Click(object sender, EventArgs e)
68 | {
69 | string sql = "";
70 | try
71 | {
72 | if(opType=="EDIT")
73 | {
74 | sql = String.Format(@"update readers
75 | set rname='{0}',rCurNum={1},rBorrowedNum={2},job='{3}',phone='{4}',dept='{5}',account='{6}',sex='{7}'
76 | where borrowid='{8}'",
77 | rname.Text.Trim(), rCurNum.Text, rBorrowedNum.Text, job.Text, phone.Text, dept.Text.Trim(), account.Text.Trim(),
78 | sex.Text, borrowid.Text);
79 | DbHelperSQL.ExecuteSql(sql);
80 | }
81 | else
82 | {
83 | sql = String.Format(@"insert into readers
84 | values('{0}','{1}','{2}','{3}',{4},{5},'{6}','{7}','{8}')",
85 | borrowid.Text.Trim(), rname.Text.Trim(), sex.Text, job.Text.Trim(), rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text.Trim(),
86 | account.Text.Trim());
87 | DbHelperSQL.ExecuteSql(sql);
88 | }
89 | }
90 | catch(Exception exception)
91 | {
92 | MessageBox.Show(exception.Message);
93 | return;
94 | }
95 | this.Close();
96 | }
97 |
98 | private void ReaderEdit_Shown(object sender, EventArgs e)
99 | {
100 | if(opType=="EDIT")
101 | {
102 | borrowid.ReadOnly = true;
103 | }
104 | }
105 |
106 | private void numberInputOnly(object sender, KeyPressEventArgs e)
107 | {
108 | if (Char.IsNumber(e.KeyChar) || e.KeyChar == 8)
109 | {
110 | e.Handled = false;
111 | }
112 | else
113 | {
114 | e.Handled = true;
115 | }
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/ReaderEdit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/login.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DataBase_Project
2 | {
3 | partial class login
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows 窗体设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.account = new System.Windows.Forms.TextBox();
34 | this.password = new System.Windows.Forms.TextBox();
35 | this.confirm = new System.Windows.Forms.Button();
36 | this.register = new System.Windows.Forms.Button();
37 | this.SuspendLayout();
38 | //
39 | // label1
40 | //
41 | this.label1.AutoSize = true;
42 | this.label1.Location = new System.Drawing.Point(121, 51);
43 | this.label1.Name = "label1";
44 | this.label1.Size = new System.Drawing.Size(29, 12);
45 | this.label1.TabIndex = 0;
46 | this.label1.Text = "账号";
47 | //
48 | // label2
49 | //
50 | this.label2.AutoSize = true;
51 | this.label2.Location = new System.Drawing.Point(121, 97);
52 | this.label2.Name = "label2";
53 | this.label2.Size = new System.Drawing.Size(29, 12);
54 | this.label2.TabIndex = 1;
55 | this.label2.Text = "密码";
56 | //
57 | // account
58 | //
59 | this.account.Location = new System.Drawing.Point(250, 48);
60 | this.account.Name = "account";
61 | this.account.Size = new System.Drawing.Size(100, 21);
62 | this.account.TabIndex = 2;
63 | //
64 | // password
65 | //
66 | this.password.Location = new System.Drawing.Point(250, 94);
67 | this.password.Name = "password";
68 | this.password.Size = new System.Drawing.Size(100, 21);
69 | this.password.TabIndex = 3;
70 | this.password.UseSystemPasswordChar = true;
71 | //
72 | // confirm
73 | //
74 | this.confirm.Location = new System.Drawing.Point(141, 147);
75 | this.confirm.Name = "confirm";
76 | this.confirm.Size = new System.Drawing.Size(75, 23);
77 | this.confirm.TabIndex = 6;
78 | this.confirm.Text = "登录";
79 | this.confirm.UseVisualStyleBackColor = true;
80 | this.confirm.Click += new System.EventHandler(this.confirm_Click);
81 | //
82 | // register
83 | //
84 | this.register.Location = new System.Drawing.Point(242, 147);
85 | this.register.Name = "register";
86 | this.register.Size = new System.Drawing.Size(75, 23);
87 | this.register.TabIndex = 7;
88 | this.register.Text = "注册";
89 | this.register.UseVisualStyleBackColor = true;
90 | this.register.Click += new System.EventHandler(this.register_Click);
91 | //
92 | // login
93 | //
94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
96 | this.ClientSize = new System.Drawing.Size(454, 211);
97 | this.Controls.Add(this.register);
98 | this.Controls.Add(this.confirm);
99 | this.Controls.Add(this.password);
100 | this.Controls.Add(this.account);
101 | this.Controls.Add(this.label1);
102 | this.Controls.Add(this.label2);
103 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
104 | this.MaximizeBox = false;
105 | this.MinimizeBox = false;
106 | this.Name = "login";
107 | this.Text = "登录";
108 | this.Load += new System.EventHandler(this.login_Load);
109 | this.ResumeLayout(false);
110 | this.PerformLayout();
111 |
112 | }
113 |
114 | #endregion
115 |
116 | private System.Windows.Forms.Label label1;
117 | private System.Windows.Forms.Label label2;
118 | private System.Windows.Forms.TextBox account;
119 | private System.Windows.Forms.TextBox password;
120 | private System.Windows.Forms.Button confirm;
121 | private System.Windows.Forms.Button register;
122 | }
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/login.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Data.SqlClient;
11 | using static DataBase_Project.PubConstant;
12 |
13 | namespace DataBase_Project
14 | {
15 | public partial class login : Form
16 | {
17 | public login()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | public PubConstant PubConstant
23 | {
24 | get
25 | {
26 | throw new System.NotImplementedException();
27 | }
28 |
29 | set
30 | {
31 | }
32 | }
33 |
34 | public DbHelperSQL DbHelperSQL
35 | {
36 | get
37 | {
38 | throw new System.NotImplementedException();
39 | }
40 |
41 | set
42 | {
43 | }
44 | }
45 |
46 | private void login_Load(object sender, EventArgs e)
47 | {
48 |
49 | }
50 |
51 | private void confirm_Click(object sender, EventArgs e)
52 | {
53 | PubConstant.currentConnection.ConnectionString = String.Format("server=localhost;database=Library;uid={0};pwd={1}", account.Text.Trim(), password.Text);
54 | try
55 | {
56 | PubConstant.currentConnection.Open();
57 | }
58 | catch(InvalidOperationException exception)
59 | {
60 | if (MessageBox.Show(exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
61 | return;
62 | }
63 | catch(SqlException exception)
64 | {
65 | if (MessageBox.Show(exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
66 | return;
67 | }
68 | string sql = String.Format("select id from users where account='{0}'", account.Text.Trim());
69 | DataSet result = DbHelperSQL.Query(sql);
70 | string loginId = result.Tables["ds"].Rows[0]["id"].ToString();
71 | if (MessageBox.Show("登录成功!", "提示") == DialogResult.OK)
72 | {
73 | PubConstant.currentAccount = account.Text.Trim();
74 | PubConstant.currentPasswd = password.Text;
75 |
76 | switch (loginId)
77 | {
78 | case "管理员":
79 | PubConstant.identity = loginStatus.Admin;
80 | break;
81 | case "读者":
82 | PubConstant.identity = loginStatus.Reader;
83 | break;
84 | }
85 |
86 | main mainForm = new main();
87 | mainForm.Show(this);
88 | this.Hide();
89 | }
90 | }
91 |
92 | private void register_Click(object sender, EventArgs e)
93 | {
94 | register registerForm = new register();
95 | registerForm.Show();
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/login.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/main.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DataBase_Project
2 | {
3 | partial class main
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.bookSearchResult = new System.Windows.Forms.DataGridView();
32 | this.tabControl1 = new System.Windows.Forms.TabControl();
33 | this.readerInfo = new System.Windows.Forms.TabPage();
34 | this.editReader = new System.Windows.Forms.Button();
35 | this.deleteReader = new System.Windows.Forms.Button();
36 | this.addReader = new System.Windows.Forms.Button();
37 | this.groupBox2 = new System.Windows.Forms.GroupBox();
38 | this.readerSearchResult = new System.Windows.Forms.DataGridView();
39 | this.readerCondition = new System.Windows.Forms.GroupBox();
40 | this.label10 = new System.Windows.Forms.Label();
41 | this.dept = new System.Windows.Forms.TextBox();
42 | this.rBorrowedNum = new System.Windows.Forms.TextBox();
43 | this.label11 = new System.Windows.Forms.Label();
44 | this.rCurNum = new System.Windows.Forms.TextBox();
45 | this.label12 = new System.Windows.Forms.Label();
46 | this.sex = new System.Windows.Forms.ComboBox();
47 | this.readerSearch = new System.Windows.Forms.Button();
48 | this.phone = new System.Windows.Forms.TextBox();
49 | this.label5 = new System.Windows.Forms.Label();
50 | this.job = new System.Windows.Forms.TextBox();
51 | this.label4 = new System.Windows.Forms.Label();
52 | this.label3 = new System.Windows.Forms.Label();
53 | this.rname = new System.Windows.Forms.TextBox();
54 | this.label2 = new System.Windows.Forms.Label();
55 | this.borrowid = new System.Windows.Forms.TextBox();
56 | this.label1 = new System.Windows.Forms.Label();
57 | this.allBooksInfo = new System.Windows.Forms.TabPage();
58 | this.editBook = new System.Windows.Forms.Button();
59 | this.deleteBook = new System.Windows.Forms.Button();
60 | this.addBook = new System.Windows.Forms.Button();
61 | this.returnBook = new System.Windows.Forms.Button();
62 | this.borrowBook = new System.Windows.Forms.Button();
63 | this.groupBox3 = new System.Windows.Forms.GroupBox();
64 | this.bookCondition = new System.Windows.Forms.GroupBox();
65 | this.borrowable = new System.Windows.Forms.ComboBox();
66 | this.bookSearch = new System.Windows.Forms.Button();
67 | this.author = new System.Windows.Forms.TextBox();
68 | this.label6 = new System.Windows.Forms.Label();
69 | this.label13 = new System.Windows.Forms.Label();
70 | this.label14 = new System.Windows.Forms.Label();
71 | this.bookTotalCount = new System.Windows.Forms.TextBox();
72 | this.press = new System.Windows.Forms.TextBox();
73 | this.label7 = new System.Windows.Forms.Label();
74 | this.label8 = new System.Windows.Forms.Label();
75 | this.bookName = new System.Windows.Forms.TextBox();
76 | this.bookBorrowCount = new System.Windows.Forms.TextBox();
77 | this.label15 = new System.Windows.Forms.Label();
78 | this.bookID = new System.Windows.Forms.TextBox();
79 | this.label16 = new System.Windows.Forms.Label();
80 | this.delayedBooksInfo = new System.Windows.Forms.TabPage();
81 | this.delayedBookSearch = new System.Windows.Forms.Button();
82 | this.groupBox5 = new System.Windows.Forms.GroupBox();
83 | this.delayedbookSearchResult = new System.Windows.Forms.DataGridView();
84 | ((System.ComponentModel.ISupportInitialize)(this.bookSearchResult)).BeginInit();
85 | this.tabControl1.SuspendLayout();
86 | this.readerInfo.SuspendLayout();
87 | this.groupBox2.SuspendLayout();
88 | ((System.ComponentModel.ISupportInitialize)(this.readerSearchResult)).BeginInit();
89 | this.readerCondition.SuspendLayout();
90 | this.allBooksInfo.SuspendLayout();
91 | this.groupBox3.SuspendLayout();
92 | this.bookCondition.SuspendLayout();
93 | this.delayedBooksInfo.SuspendLayout();
94 | this.groupBox5.SuspendLayout();
95 | ((System.ComponentModel.ISupportInitialize)(this.delayedbookSearchResult)).BeginInit();
96 | this.SuspendLayout();
97 | //
98 | // bookSearchResult
99 | //
100 | this.bookSearchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
101 | this.bookSearchResult.Location = new System.Drawing.Point(3, 14);
102 | this.bookSearchResult.Name = "bookSearchResult";
103 | this.bookSearchResult.RowTemplate.Height = 23;
104 | this.bookSearchResult.Size = new System.Drawing.Size(714, 291);
105 | this.bookSearchResult.TabIndex = 0;
106 | //
107 | // tabControl1
108 | //
109 | this.tabControl1.Controls.Add(this.readerInfo);
110 | this.tabControl1.Controls.Add(this.allBooksInfo);
111 | this.tabControl1.Controls.Add(this.delayedBooksInfo);
112 | this.tabControl1.Location = new System.Drawing.Point(0, 0);
113 | this.tabControl1.Name = "tabControl1";
114 | this.tabControl1.SelectedIndex = 0;
115 | this.tabControl1.Size = new System.Drawing.Size(799, 582);
116 | this.tabControl1.TabIndex = 0;
117 | //
118 | // readerInfo
119 | //
120 | this.readerInfo.BackColor = System.Drawing.SystemColors.Control;
121 | this.readerInfo.Controls.Add(this.editReader);
122 | this.readerInfo.Controls.Add(this.deleteReader);
123 | this.readerInfo.Controls.Add(this.addReader);
124 | this.readerInfo.Controls.Add(this.groupBox2);
125 | this.readerInfo.Controls.Add(this.readerCondition);
126 | this.readerInfo.Location = new System.Drawing.Point(4, 22);
127 | this.readerInfo.Name = "readerInfo";
128 | this.readerInfo.Padding = new System.Windows.Forms.Padding(3);
129 | this.readerInfo.Size = new System.Drawing.Size(791, 556);
130 | this.readerInfo.TabIndex = 0;
131 | this.readerInfo.Text = "读者信息";
132 | //
133 | // editReader
134 | //
135 | this.editReader.Location = new System.Drawing.Point(677, 484);
136 | this.editReader.Name = "editReader";
137 | this.editReader.Size = new System.Drawing.Size(75, 23);
138 | this.editReader.TabIndex = 4;
139 | this.editReader.Text = "编辑";
140 | this.editReader.UseVisualStyleBackColor = true;
141 | this.editReader.Click += new System.EventHandler(this.editReader_Click);
142 | //
143 | // deleteReader
144 | //
145 | this.deleteReader.Location = new System.Drawing.Point(336, 484);
146 | this.deleteReader.Name = "deleteReader";
147 | this.deleteReader.Size = new System.Drawing.Size(75, 23);
148 | this.deleteReader.TabIndex = 3;
149 | this.deleteReader.Text = "删除";
150 | this.deleteReader.UseVisualStyleBackColor = true;
151 | this.deleteReader.Click += new System.EventHandler(this.deleteReader_Click);
152 | //
153 | // addReader
154 | //
155 | this.addReader.Location = new System.Drawing.Point(28, 484);
156 | this.addReader.Name = "addReader";
157 | this.addReader.Size = new System.Drawing.Size(75, 23);
158 | this.addReader.TabIndex = 2;
159 | this.addReader.Text = "新增";
160 | this.addReader.UseVisualStyleBackColor = true;
161 | this.addReader.Click += new System.EventHandler(this.addReader_Click);
162 | //
163 | // groupBox2
164 | //
165 | this.groupBox2.Controls.Add(this.readerSearchResult);
166 | this.groupBox2.Location = new System.Drawing.Point(26, 177);
167 | this.groupBox2.Name = "groupBox2";
168 | this.groupBox2.Size = new System.Drawing.Size(726, 307);
169 | this.groupBox2.TabIndex = 1;
170 | this.groupBox2.TabStop = false;
171 | this.groupBox2.Text = "查询结果";
172 | //
173 | // readerSearchResult
174 | //
175 | this.readerSearchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
176 | this.readerSearchResult.Location = new System.Drawing.Point(2, 14);
177 | this.readerSearchResult.Name = "readerSearchResult";
178 | this.readerSearchResult.RowTemplate.Height = 23;
179 | this.readerSearchResult.Size = new System.Drawing.Size(718, 287);
180 | this.readerSearchResult.TabIndex = 0;
181 | //
182 | // readerCondition
183 | //
184 | this.readerCondition.Controls.Add(this.label10);
185 | this.readerCondition.Controls.Add(this.dept);
186 | this.readerCondition.Controls.Add(this.rBorrowedNum);
187 | this.readerCondition.Controls.Add(this.label11);
188 | this.readerCondition.Controls.Add(this.rCurNum);
189 | this.readerCondition.Controls.Add(this.label12);
190 | this.readerCondition.Controls.Add(this.sex);
191 | this.readerCondition.Controls.Add(this.readerSearch);
192 | this.readerCondition.Controls.Add(this.phone);
193 | this.readerCondition.Controls.Add(this.label5);
194 | this.readerCondition.Controls.Add(this.job);
195 | this.readerCondition.Controls.Add(this.label4);
196 | this.readerCondition.Controls.Add(this.label3);
197 | this.readerCondition.Controls.Add(this.rname);
198 | this.readerCondition.Controls.Add(this.label2);
199 | this.readerCondition.Controls.Add(this.borrowid);
200 | this.readerCondition.Controls.Add(this.label1);
201 | this.readerCondition.Location = new System.Drawing.Point(26, 23);
202 | this.readerCondition.Name = "readerCondition";
203 | this.readerCondition.Size = new System.Drawing.Size(726, 148);
204 | this.readerCondition.TabIndex = 0;
205 | this.readerCondition.TabStop = false;
206 | this.readerCondition.Text = "查询条件";
207 | //
208 | // label10
209 | //
210 | this.label10.AutoSize = true;
211 | this.label10.Location = new System.Drawing.Point(373, 74);
212 | this.label10.Name = "label10";
213 | this.label10.Size = new System.Drawing.Size(53, 12);
214 | this.label10.TabIndex = 24;
215 | this.label10.Text = "工作部门";
216 | //
217 | // dept
218 | //
219 | this.dept.Location = new System.Drawing.Point(432, 71);
220 | this.dept.Name = "dept";
221 | this.dept.Size = new System.Drawing.Size(100, 21);
222 | this.dept.TabIndex = 23;
223 | //
224 | // rBorrowedNum
225 | //
226 | this.rBorrowedNum.Location = new System.Drawing.Point(267, 71);
227 | this.rBorrowedNum.Name = "rBorrowedNum";
228 | this.rBorrowedNum.Size = new System.Drawing.Size(100, 21);
229 | this.rBorrowedNum.TabIndex = 22;
230 | this.rBorrowedNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
231 | //
232 | // label11
233 | //
234 | this.label11.AutoSize = true;
235 | this.label11.Location = new System.Drawing.Point(191, 74);
236 | this.label11.Name = "label11";
237 | this.label11.Size = new System.Drawing.Size(77, 12);
238 | this.label11.TabIndex = 21;
239 | this.label11.Text = "最少已借数量";
240 | //
241 | // rCurNum
242 | //
243 | this.rCurNum.Location = new System.Drawing.Point(85, 71);
244 | this.rCurNum.Name = "rCurNum";
245 | this.rCurNum.Size = new System.Drawing.Size(100, 21);
246 | this.rCurNum.TabIndex = 20;
247 | this.rCurNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
248 | //
249 | // label12
250 | //
251 | this.label12.AutoSize = true;
252 | this.label12.Location = new System.Drawing.Point(6, 74);
253 | this.label12.Name = "label12";
254 | this.label12.Size = new System.Drawing.Size(77, 12);
255 | this.label12.TabIndex = 19;
256 | this.label12.Text = "最少可借数量";
257 | //
258 | // sex
259 | //
260 | this.sex.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
261 | this.sex.FormattingEnabled = true;
262 | this.sex.Items.AddRange(new object[] {
263 | "男",
264 | "女"});
265 | this.sex.Location = new System.Drawing.Point(432, 32);
266 | this.sex.Name = "sex";
267 | this.sex.Size = new System.Drawing.Size(100, 20);
268 | this.sex.TabIndex = 18;
269 | //
270 | // readerSearch
271 | //
272 | this.readerSearch.Location = new System.Drawing.Point(310, 109);
273 | this.readerSearch.Name = "readerSearch";
274 | this.readerSearch.Size = new System.Drawing.Size(75, 23);
275 | this.readerSearch.TabIndex = 16;
276 | this.readerSearch.Text = "查询";
277 | this.readerSearch.UseVisualStyleBackColor = true;
278 | this.readerSearch.Click += new System.EventHandler(this.readerSearch_Click);
279 | //
280 | // phone
281 | //
282 | this.phone.Location = new System.Drawing.Point(597, 71);
283 | this.phone.Name = "phone";
284 | this.phone.Size = new System.Drawing.Size(100, 21);
285 | this.phone.TabIndex = 15;
286 | this.phone.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
287 | //
288 | // label5
289 | //
290 | this.label5.AutoSize = true;
291 | this.label5.Location = new System.Drawing.Point(538, 74);
292 | this.label5.Name = "label5";
293 | this.label5.Size = new System.Drawing.Size(53, 12);
294 | this.label5.TabIndex = 14;
295 | this.label5.Text = "联系电话";
296 | //
297 | // job
298 | //
299 | this.job.Location = new System.Drawing.Point(597, 32);
300 | this.job.Name = "job";
301 | this.job.Size = new System.Drawing.Size(100, 21);
302 | this.job.TabIndex = 7;
303 | //
304 | // label4
305 | //
306 | this.label4.AutoSize = true;
307 | this.label4.Location = new System.Drawing.Point(547, 35);
308 | this.label4.Name = "label4";
309 | this.label4.Size = new System.Drawing.Size(29, 12);
310 | this.label4.TabIndex = 6;
311 | this.label4.Text = "职称";
312 | //
313 | // label3
314 | //
315 | this.label3.AutoSize = true;
316 | this.label3.Location = new System.Drawing.Point(382, 35);
317 | this.label3.Name = "label3";
318 | this.label3.Size = new System.Drawing.Size(29, 12);
319 | this.label3.TabIndex = 5;
320 | this.label3.Text = "性别";
321 | //
322 | // rname
323 | //
324 | this.rname.Location = new System.Drawing.Point(267, 32);
325 | this.rname.Name = "rname";
326 | this.rname.Size = new System.Drawing.Size(100, 21);
327 | this.rname.TabIndex = 3;
328 | //
329 | // label2
330 | //
331 | this.label2.AutoSize = true;
332 | this.label2.Location = new System.Drawing.Point(211, 35);
333 | this.label2.Name = "label2";
334 | this.label2.Size = new System.Drawing.Size(29, 12);
335 | this.label2.TabIndex = 2;
336 | this.label2.Text = "姓名";
337 | //
338 | // borrowid
339 | //
340 | this.borrowid.Location = new System.Drawing.Point(85, 32);
341 | this.borrowid.Name = "borrowid";
342 | this.borrowid.Size = new System.Drawing.Size(100, 21);
343 | this.borrowid.TabIndex = 1;
344 | //
345 | // label1
346 | //
347 | this.label1.AutoSize = true;
348 | this.label1.Location = new System.Drawing.Point(26, 35);
349 | this.label1.Name = "label1";
350 | this.label1.Size = new System.Drawing.Size(53, 12);
351 | this.label1.TabIndex = 0;
352 | this.label1.Text = "借书证号";
353 | //
354 | // allBooksInfo
355 | //
356 | this.allBooksInfo.BackColor = System.Drawing.SystemColors.Control;
357 | this.allBooksInfo.Controls.Add(this.editBook);
358 | this.allBooksInfo.Controls.Add(this.deleteBook);
359 | this.allBooksInfo.Controls.Add(this.addBook);
360 | this.allBooksInfo.Controls.Add(this.returnBook);
361 | this.allBooksInfo.Controls.Add(this.borrowBook);
362 | this.allBooksInfo.Controls.Add(this.groupBox3);
363 | this.allBooksInfo.Controls.Add(this.bookCondition);
364 | this.allBooksInfo.Location = new System.Drawing.Point(4, 22);
365 | this.allBooksInfo.Name = "allBooksInfo";
366 | this.allBooksInfo.Padding = new System.Windows.Forms.Padding(3);
367 | this.allBooksInfo.Size = new System.Drawing.Size(791, 556);
368 | this.allBooksInfo.TabIndex = 1;
369 | this.allBooksInfo.Text = "图书信息";
370 | //
371 | // editBook
372 | //
373 | this.editBook.Location = new System.Drawing.Point(671, 485);
374 | this.editBook.Name = "editBook";
375 | this.editBook.Size = new System.Drawing.Size(75, 23);
376 | this.editBook.TabIndex = 8;
377 | this.editBook.Text = "编辑";
378 | this.editBook.UseVisualStyleBackColor = true;
379 | this.editBook.Click += new System.EventHandler(this.editBook_Click);
380 | //
381 | // deleteBook
382 | //
383 | this.deleteBook.Location = new System.Drawing.Point(348, 485);
384 | this.deleteBook.Name = "deleteBook";
385 | this.deleteBook.Size = new System.Drawing.Size(75, 23);
386 | this.deleteBook.TabIndex = 7;
387 | this.deleteBook.Text = "删除";
388 | this.deleteBook.UseVisualStyleBackColor = true;
389 | this.deleteBook.Click += new System.EventHandler(this.deleteBook_Click);
390 | //
391 | // addBook
392 | //
393 | this.addBook.Location = new System.Drawing.Point(26, 485);
394 | this.addBook.Name = "addBook";
395 | this.addBook.Size = new System.Drawing.Size(75, 23);
396 | this.addBook.TabIndex = 6;
397 | this.addBook.Text = "新增";
398 | this.addBook.UseVisualStyleBackColor = true;
399 | this.addBook.Click += new System.EventHandler(this.addBook_Click);
400 | //
401 | // returnBook
402 | //
403 | this.returnBook.Location = new System.Drawing.Point(512, 485);
404 | this.returnBook.Name = "returnBook";
405 | this.returnBook.Size = new System.Drawing.Size(75, 23);
406 | this.returnBook.TabIndex = 5;
407 | this.returnBook.Text = "还书";
408 | this.returnBook.UseVisualStyleBackColor = true;
409 | this.returnBook.Click += new System.EventHandler(this.returnBook_Click);
410 | //
411 | // borrowBook
412 | //
413 | this.borrowBook.Location = new System.Drawing.Point(185, 485);
414 | this.borrowBook.Name = "borrowBook";
415 | this.borrowBook.Size = new System.Drawing.Size(75, 23);
416 | this.borrowBook.TabIndex = 4;
417 | this.borrowBook.Text = "借书";
418 | this.borrowBook.UseVisualStyleBackColor = true;
419 | this.borrowBook.Click += new System.EventHandler(this.borrowBook_Click);
420 | //
421 | // groupBox3
422 | //
423 | this.groupBox3.Controls.Add(this.bookSearchResult);
424 | this.groupBox3.Location = new System.Drawing.Point(23, 174);
425 | this.groupBox3.Name = "groupBox3";
426 | this.groupBox3.Size = new System.Drawing.Size(723, 310);
427 | this.groupBox3.TabIndex = 3;
428 | this.groupBox3.TabStop = false;
429 | this.groupBox3.Text = "查询结果";
430 | //
431 | // bookCondition
432 | //
433 | this.bookCondition.Controls.Add(this.borrowable);
434 | this.bookCondition.Controls.Add(this.bookSearch);
435 | this.bookCondition.Controls.Add(this.author);
436 | this.bookCondition.Controls.Add(this.label6);
437 | this.bookCondition.Controls.Add(this.label13);
438 | this.bookCondition.Controls.Add(this.label14);
439 | this.bookCondition.Controls.Add(this.bookTotalCount);
440 | this.bookCondition.Controls.Add(this.press);
441 | this.bookCondition.Controls.Add(this.label7);
442 | this.bookCondition.Controls.Add(this.label8);
443 | this.bookCondition.Controls.Add(this.bookName);
444 | this.bookCondition.Controls.Add(this.bookBorrowCount);
445 | this.bookCondition.Controls.Add(this.label15);
446 | this.bookCondition.Controls.Add(this.bookID);
447 | this.bookCondition.Controls.Add(this.label16);
448 | this.bookCondition.Location = new System.Drawing.Point(23, 20);
449 | this.bookCondition.Name = "bookCondition";
450 | this.bookCondition.Size = new System.Drawing.Size(723, 148);
451 | this.bookCondition.TabIndex = 2;
452 | this.bookCondition.TabStop = false;
453 | this.bookCondition.Text = "查询条件";
454 | //
455 | // borrowable
456 | //
457 | this.borrowable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
458 | this.borrowable.FormattingEnabled = true;
459 | this.borrowable.Items.AddRange(new object[] {
460 | "是",
461 | "否"});
462 | this.borrowable.Location = new System.Drawing.Point(556, 71);
463 | this.borrowable.Name = "borrowable";
464 | this.borrowable.Size = new System.Drawing.Size(100, 20);
465 | this.borrowable.TabIndex = 23;
466 | //
467 | // bookSearch
468 | //
469 | this.bookSearch.Location = new System.Drawing.Point(325, 110);
470 | this.bookSearch.Name = "bookSearch";
471 | this.bookSearch.Size = new System.Drawing.Size(75, 23);
472 | this.bookSearch.TabIndex = 16;
473 | this.bookSearch.Text = "查询";
474 | this.bookSearch.UseVisualStyleBackColor = true;
475 | this.bookSearch.Click += new System.EventHandler(this.bookSearch_Click);
476 | //
477 | // author
478 | //
479 | this.author.Location = new System.Drawing.Point(568, 29);
480 | this.author.Name = "author";
481 | this.author.Size = new System.Drawing.Size(100, 21);
482 | this.author.TabIndex = 7;
483 | //
484 | // label6
485 | //
486 | this.label6.AutoSize = true;
487 | this.label6.Location = new System.Drawing.Point(487, 74);
488 | this.label6.Name = "label6";
489 | this.label6.Size = new System.Drawing.Size(53, 12);
490 | this.label6.TabIndex = 22;
491 | this.label6.Text = "是否可借";
492 | //
493 | // label13
494 | //
495 | this.label13.AutoSize = true;
496 | this.label13.Location = new System.Drawing.Point(521, 32);
497 | this.label13.Name = "label13";
498 | this.label13.Size = new System.Drawing.Size(29, 12);
499 | this.label13.TabIndex = 6;
500 | this.label13.Text = "作者";
501 | //
502 | // label14
503 | //
504 | this.label14.AutoSize = true;
505 | this.label14.Location = new System.Drawing.Point(368, 32);
506 | this.label14.Name = "label14";
507 | this.label14.Size = new System.Drawing.Size(41, 12);
508 | this.label14.TabIndex = 5;
509 | this.label14.Text = "出版社";
510 | //
511 | // bookTotalCount
512 | //
513 | this.bookTotalCount.Location = new System.Drawing.Point(371, 71);
514 | this.bookTotalCount.Name = "bookTotalCount";
515 | this.bookTotalCount.Size = new System.Drawing.Size(100, 21);
516 | this.bookTotalCount.TabIndex = 21;
517 | this.bookTotalCount.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
518 | //
519 | // press
520 | //
521 | this.press.Location = new System.Drawing.Point(415, 29);
522 | this.press.Name = "press";
523 | this.press.Size = new System.Drawing.Size(100, 21);
524 | this.press.TabIndex = 4;
525 | //
526 | // label7
527 | //
528 | this.label7.AutoSize = true;
529 | this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
530 | this.label7.Location = new System.Drawing.Point(278, 74);
531 | this.label7.Name = "label7";
532 | this.label7.Size = new System.Drawing.Size(77, 12);
533 | this.label7.TabIndex = 20;
534 | this.label7.Text = "最少馆藏数量";
535 | //
536 | // label8
537 | //
538 | this.label8.AutoSize = true;
539 | this.label8.Location = new System.Drawing.Point(69, 74);
540 | this.label8.Name = "label8";
541 | this.label8.Size = new System.Drawing.Size(77, 12);
542 | this.label8.TabIndex = 18;
543 | this.label8.Text = "最少可借数量";
544 | //
545 | // bookName
546 | //
547 | this.bookName.Location = new System.Drawing.Point(262, 29);
548 | this.bookName.Name = "bookName";
549 | this.bookName.Size = new System.Drawing.Size(100, 21);
550 | this.bookName.TabIndex = 3;
551 | //
552 | // bookBorrowCount
553 | //
554 | this.bookBorrowCount.Location = new System.Drawing.Point(162, 71);
555 | this.bookBorrowCount.Name = "bookBorrowCount";
556 | this.bookBorrowCount.Size = new System.Drawing.Size(100, 21);
557 | this.bookBorrowCount.TabIndex = 19;
558 | this.bookBorrowCount.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numberInputOnly);
559 | //
560 | // label15
561 | //
562 | this.label15.AutoSize = true;
563 | this.label15.Location = new System.Drawing.Point(215, 32);
564 | this.label15.Name = "label15";
565 | this.label15.Size = new System.Drawing.Size(29, 12);
566 | this.label15.TabIndex = 2;
567 | this.label15.Text = "书名";
568 | //
569 | // bookID
570 | //
571 | this.bookID.Location = new System.Drawing.Point(109, 29);
572 | this.bookID.Name = "bookID";
573 | this.bookID.Size = new System.Drawing.Size(100, 21);
574 | this.bookID.TabIndex = 1;
575 | //
576 | // label16
577 | //
578 | this.label16.AutoSize = true;
579 | this.label16.Location = new System.Drawing.Point(50, 32);
580 | this.label16.Name = "label16";
581 | this.label16.Size = new System.Drawing.Size(53, 12);
582 | this.label16.TabIndex = 0;
583 | this.label16.Text = "ISBN书号";
584 | //
585 | // delayedBooksInfo
586 | //
587 | this.delayedBooksInfo.BackColor = System.Drawing.SystemColors.Control;
588 | this.delayedBooksInfo.Controls.Add(this.delayedBookSearch);
589 | this.delayedBooksInfo.Controls.Add(this.groupBox5);
590 | this.delayedBooksInfo.Location = new System.Drawing.Point(4, 22);
591 | this.delayedBooksInfo.Name = "delayedBooksInfo";
592 | this.delayedBooksInfo.Size = new System.Drawing.Size(791, 556);
593 | this.delayedBooksInfo.TabIndex = 2;
594 | this.delayedBooksInfo.Text = "逾期图书信息";
595 | //
596 | // delayedBookSearch
597 | //
598 | this.delayedBookSearch.Location = new System.Drawing.Point(338, 465);
599 | this.delayedBookSearch.Name = "delayedBookSearch";
600 | this.delayedBookSearch.Size = new System.Drawing.Size(75, 23);
601 | this.delayedBookSearch.TabIndex = 5;
602 | this.delayedBookSearch.Text = "查询";
603 | this.delayedBookSearch.UseVisualStyleBackColor = true;
604 | this.delayedBookSearch.Click += new System.EventHandler(this.delayedBookSearch_Click);
605 | //
606 | // groupBox5
607 | //
608 | this.groupBox5.Controls.Add(this.delayedbookSearchResult);
609 | this.groupBox5.Location = new System.Drawing.Point(30, 21);
610 | this.groupBox5.Name = "groupBox5";
611 | this.groupBox5.Size = new System.Drawing.Size(701, 428);
612 | this.groupBox5.TabIndex = 4;
613 | this.groupBox5.TabStop = false;
614 | this.groupBox5.Text = "查询结果";
615 | //
616 | // delayedbookSearchResult
617 | //
618 | this.delayedbookSearchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
619 | this.delayedbookSearchResult.Location = new System.Drawing.Point(3, 14);
620 | this.delayedbookSearchResult.Name = "delayedbookSearchResult";
621 | this.delayedbookSearchResult.RowTemplate.Height = 23;
622 | this.delayedbookSearchResult.Size = new System.Drawing.Size(692, 408);
623 | this.delayedbookSearchResult.TabIndex = 0;
624 | //
625 | // main
626 | //
627 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
628 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
629 | this.ClientSize = new System.Drawing.Size(779, 550);
630 | this.Controls.Add(this.tabControl1);
631 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
632 | this.MaximizeBox = false;
633 | this.MinimizeBox = false;
634 | this.Name = "main";
635 | this.Text = "查询&管理";
636 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.main_FormClosed);
637 | this.Load += new System.EventHandler(this.main_Load);
638 | ((System.ComponentModel.ISupportInitialize)(this.bookSearchResult)).EndInit();
639 | this.tabControl1.ResumeLayout(false);
640 | this.readerInfo.ResumeLayout(false);
641 | this.groupBox2.ResumeLayout(false);
642 | ((System.ComponentModel.ISupportInitialize)(this.readerSearchResult)).EndInit();
643 | this.readerCondition.ResumeLayout(false);
644 | this.readerCondition.PerformLayout();
645 | this.allBooksInfo.ResumeLayout(false);
646 | this.groupBox3.ResumeLayout(false);
647 | this.bookCondition.ResumeLayout(false);
648 | this.bookCondition.PerformLayout();
649 | this.delayedBooksInfo.ResumeLayout(false);
650 | this.groupBox5.ResumeLayout(false);
651 | ((System.ComponentModel.ISupportInitialize)(this.delayedbookSearchResult)).EndInit();
652 | this.ResumeLayout(false);
653 |
654 | }
655 |
656 | #endregion
657 |
658 | private System.Windows.Forms.TabControl tabControl1;
659 | private System.Windows.Forms.TabPage readerInfo;
660 | private System.Windows.Forms.GroupBox readerCondition;
661 | private System.Windows.Forms.TabPage allBooksInfo;
662 | private System.Windows.Forms.TabPage delayedBooksInfo;
663 | private System.Windows.Forms.GroupBox groupBox2;
664 | private System.Windows.Forms.DataGridView readerSearchResult;
665 | private System.Windows.Forms.Button readerSearch;
666 | private System.Windows.Forms.TextBox phone;
667 | private System.Windows.Forms.Label label5;
668 | private System.Windows.Forms.TextBox job;
669 | private System.Windows.Forms.Label label4;
670 | private System.Windows.Forms.Label label3;
671 | private System.Windows.Forms.TextBox rname;
672 | private System.Windows.Forms.Label label2;
673 | private System.Windows.Forms.TextBox borrowid;
674 | private System.Windows.Forms.Label label1;
675 | private System.Windows.Forms.GroupBox groupBox3;
676 | private System.Windows.Forms.GroupBox bookCondition;
677 | private System.Windows.Forms.Button bookSearch;
678 | private System.Windows.Forms.TextBox author;
679 | private System.Windows.Forms.Label label13;
680 | private System.Windows.Forms.Label label14;
681 | private System.Windows.Forms.TextBox press;
682 | private System.Windows.Forms.TextBox bookName;
683 | private System.Windows.Forms.Label label15;
684 | private System.Windows.Forms.TextBox bookID;
685 | private System.Windows.Forms.Label label16;
686 | private System.Windows.Forms.Button delayedBookSearch;
687 | private System.Windows.Forms.GroupBox groupBox5;
688 | private System.Windows.Forms.DataGridView delayedbookSearchResult;
689 | private System.Windows.Forms.Label label10;
690 | private System.Windows.Forms.TextBox dept;
691 | private System.Windows.Forms.TextBox rBorrowedNum;
692 | private System.Windows.Forms.Label label11;
693 | private System.Windows.Forms.TextBox rCurNum;
694 | private System.Windows.Forms.Label label12;
695 | private System.Windows.Forms.ComboBox sex;
696 | private System.Windows.Forms.ComboBox borrowable;
697 | private System.Windows.Forms.Label label6;
698 | private System.Windows.Forms.TextBox bookTotalCount;
699 | private System.Windows.Forms.Label label7;
700 | private System.Windows.Forms.Label label8;
701 | private System.Windows.Forms.TextBox bookBorrowCount;
702 | private System.Windows.Forms.Button editReader;
703 | private System.Windows.Forms.Button deleteReader;
704 | private System.Windows.Forms.Button addReader;
705 | private System.Windows.Forms.Button editBook;
706 | private System.Windows.Forms.Button deleteBook;
707 | private System.Windows.Forms.Button addBook;
708 | private System.Windows.Forms.Button returnBook;
709 | private System.Windows.Forms.Button borrowBook;
710 | private System.Windows.Forms.DataGridView bookSearchResult;
711 | }
712 | }
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Data.SqlClient;
11 | using static DataBase_Project.PubConstant;
12 |
13 | namespace DataBase_Project
14 | {
15 | public partial class main : Form
16 | {
17 | public main()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | public login login
23 | {
24 | get
25 | {
26 | throw new System.NotImplementedException();
27 | }
28 |
29 | set
30 | {
31 | }
32 | }
33 |
34 | public DbHelperSQL DbHelperSQL
35 | {
36 | get
37 | {
38 | throw new System.NotImplementedException();
39 | }
40 |
41 | set
42 | {
43 | }
44 | }
45 |
46 | private void main_Load(object sender, EventArgs e)
47 | {
48 | //初始化默认值
49 | sex.SelectedIndex = 0;
50 | borrowable.SelectedIndex = 0;
51 | rCurNum.Text = "0";
52 | rBorrowedNum.Text = "0";
53 | bookBorrowCount.Text = "0";
54 | bookTotalCount.Text = "0";
55 | //根据登录的身份隐藏/显示按钮
56 | switch (PubConstant.identity)
57 | {
58 | case loginStatus.Admin:
59 | borrowBook.Visible = false;
60 | returnBook.Visible = false;
61 | break;
62 | case loginStatus.Reader:
63 | addReader.Visible = false;
64 | deleteReader.Visible = false;
65 | editReader.Visible = false;
66 | addBook.Visible = false;
67 | deleteBook.Visible = false;
68 | editBook.Visible = false;
69 | break;
70 | }
71 | }
72 |
73 | private void main_FormClosed(object sender, FormClosedEventArgs e)
74 | {
75 | PubConstant.identity = loginStatus.Unlogin;
76 | PubConstant.currentAccount = "";
77 | PubConstant.currentPasswd = "";
78 | PubConstant.currentConnection.Close();
79 | this.Owner.Show();
80 | }
81 |
82 | private void readerSearch_Click(object sender, EventArgs e)
83 | {
84 | string readerSearchSql =
85 | String.Format("select * from readers where borrowid like '%{0}%' and rname like '%{1}%' and sex='{2}' and job like '%{3}%' and rCurNum>={4} and rBorrowedNum>={5} and dept like '%{6}%' and phone like '%{7}%'",
86 | borrowid.Text, rname.Text, sex.Text, job.Text, rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text);
87 | DataSet result = DbHelperSQL.Query(readerSearchSql);
88 |
89 | this.readerSearchResult.DataSource = result.Tables["ds"];
90 | }
91 |
92 | private void bookSearch_Click(object sender, EventArgs e)
93 | {
94 | string bookSearchSql =
95 | String.Format("select * from books where isbn like '%{0}%' and bname like '%{1}%' and pub like '%{2}%' and author like '%{3}%' and bCurNum>={4} and storeNum>={5} and available='{6}'",
96 | bookID.Text, bookName.Text, press.Text, author.Text, bookBorrowCount.Text, bookTotalCount.Text, borrowable.Text);
97 | DataSet result = DbHelperSQL.Query(bookSearchSql);
98 |
99 | this.bookSearchResult.DataSource = result.Tables["ds"];
100 | }
101 |
102 | private void deleteBook_Click(object sender, EventArgs e)
103 | {
104 | try
105 | {
106 | int index = bookSearchResult.CurrentRow.Index;//获取当前选中行
107 | //MessageBox.Show(a.ToString());
108 | string isbn = bookSearchResult.Rows[index].Cells[0].Value.ToString().Trim();
109 | //获取该行第0列数据
110 | string sql = "delete from books where isbn='" + isbn + "'";
111 | //确认是否删除
112 | if (DialogResult.Yes == MessageBox.Show("确定要删除该记录", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
113 | {
114 | //SQL删除语句字符串
115 | if (DbHelperSQL.ExecuteSql(sql) > 0) //向源数据库传递SQL命令字符串,得到删除结果
116 | {
117 | MessageBox.Show("删除成功");
118 | bookSearchResult.Rows.RemoveAt(index);
119 | }
120 | else
121 | {
122 | MessageBox.Show("删除失败");
123 | }
124 | }
125 | }
126 | catch (NullReferenceException exception)
127 | {
128 | MessageBox.Show("请先选中一行!");
129 | return;
130 | }
131 | }
132 |
133 | private void deleteReader_Click(object sender, EventArgs e)
134 | {
135 | try
136 | {
137 | int index = readerSearchResult.CurrentRow.Index;//获取当前选中行
138 | string account = readerSearchResult.Rows[index].Cells[8].Value.ToString().Trim();
139 | string deleteReaderSql = String.Format(@"exec sp_droplogin '{0}'
140 | exec sp_dropuser '{1}'
141 | delete from users where account='{2}'", account, account, account);
142 | if (DialogResult.Yes == MessageBox.Show("确定要删除该记录", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
143 | {
144 | //SQL删除语句字符串
145 | if (DbHelperSQL.ExecuteSql(deleteReaderSql) > 0) //向源数据库传递SQL命令字符串,得到删除结果
146 | {
147 | MessageBox.Show("删除成功");
148 | readerSearchResult.Rows.RemoveAt(index);
149 | }
150 | else
151 | {
152 | MessageBox.Show("删除失败");
153 | }
154 | }
155 | }
156 | catch (NullReferenceException exception)
157 | {
158 | MessageBox.Show("请先选中一行!");
159 | return;
160 | }
161 | }
162 |
163 | private void addReader_Click(object sender, EventArgs e)
164 | {
165 | ReaderEdit readerEditForm = new ReaderEdit();
166 | readerEditForm.Text = "读者信息添加";
167 | readerEditForm.opType = "ADD";
168 | readerEditForm.ShowDialog();
169 | readerEditForm.Dispose();
170 |
171 | //刷新读者查询的结果
172 | string readerSearchSql =
173 | String.Format("select * from readers where borrowid like '%{0}%' and rname like '%{1}%' and sex='{2}' and job like '%{3}%' and rCurNum>={4} and rBorrowedNum>={5} and dept like '%{6}%' and phone like '%{7}%'",
174 | borrowid.Text, rname.Text, sex.Text, job.Text, rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text);
175 | DataSet result = DbHelperSQL.Query(readerSearchSql);
176 |
177 | this.readerSearchResult.DataSource = result.Tables["ds"];
178 | }
179 |
180 | private void addBook_Click(object sender, EventArgs e)
181 | {
182 | BookEdit formEdit = new BookEdit();
183 | formEdit.Text = "图书信息添加";
184 | formEdit.Optype = "ADD";
185 | formEdit.ShowDialog();
186 | formEdit.Dispose();
187 | //查询语句
188 | string bookSearchSql =
189 | String.Format("select * from books where isbn like '%{0}%' and bname like '%{1}%' and pub like '%{2}%' and author like '%{3}%' and bCurNum>={4} and storeNum>={5} and available='{6}'",
190 | bookID.Text, bookName.Text, press.Text, author.Text, bookBorrowCount.Text, bookTotalCount.Text, borrowable.Text);
191 | DataSet result = DbHelperSQL.Query(bookSearchSql);
192 |
193 | this.bookSearchResult.DataSource = result.Tables["ds"];
194 | }
195 |
196 | private void editBook_Click(object sender, EventArgs e)
197 | {
198 | int index = -1;
199 | index = bookSearchResult.CurrentRow.Index;//获取当前选中行
200 | if (index == -1)
201 | {
202 | MessageBox.Show("请选择要编辑的行");
203 | return;
204 | }
205 | BookEdit formEdit = new BookEdit();
206 | formEdit.Text = "图书信息修改";
207 | formEdit.Optype = "EDIT";
208 | formEdit.bookid = bookSearchResult.Rows[index].Cells[0].Value.ToString().Trim();//获取第0列(isbn)数据
209 | formEdit.ShowDialog();
210 | formEdit.Dispose();
211 | //查询语句
212 | string bookSearchSql =
213 | String.Format("select * from books where isbn like '%{0}%' and bname like '%{1}%' and pub like '%{2}%' and author like '%{3}%' and bCurNum>={4} and storeNum>={5} and available='{6}'",
214 | bookID.Text, bookName.Text, press.Text, author.Text, bookBorrowCount.Text, bookTotalCount.Text, borrowable.Text);
215 | DataSet result = DbHelperSQL.Query(bookSearchSql);
216 |
217 | this.bookSearchResult.DataSource = result.Tables["ds"];
218 | }
219 |
220 | private void editReader_Click(object sender, EventArgs e)
221 | {
222 | try
223 | {
224 | int index = readerSearchResult.CurrentRow.Index;
225 | string inputborrowid = readerSearchResult.Rows[index].Cells[0].Value.ToString().Trim();
226 | string inputrname = readerSearchResult.Rows[index].Cells[1].Value.ToString().Trim();
227 | string inputsex = readerSearchResult.Rows[index].Cells[2].Value.ToString().Trim();
228 | string inputjob = readerSearchResult.Rows[index].Cells[3].Value.ToString().Trim();
229 | string inputrCurNum = readerSearchResult.Rows[index].Cells[4].Value.ToString().Trim();
230 | string inputrBorrowedNum = readerSearchResult.Rows[index].Cells[5].Value.ToString().Trim();
231 | string inputdept = readerSearchResult.Rows[index].Cells[6].Value.ToString().Trim();
232 | string inputphone = readerSearchResult.Rows[index].Cells[7].Value.ToString().Trim();
233 | string inputaccount = readerSearchResult.Rows[index].Cells[8].Value.ToString().Trim();
234 |
235 | ReaderEdit readerEditForm = new ReaderEdit(inputborrowid,inputrname,inputrCurNum,inputrBorrowedNum,inputjob,inputphone,inputdept,inputaccount,inputsex);
236 | readerEditForm.Text = "读者信息编辑";
237 | readerEditForm.opType = "EDIT";
238 | readerEditForm.ShowDialog();
239 | readerEditForm.Dispose();
240 |
241 | //刷新读者查询的结果
242 | string readerSearchSql =
243 | String.Format("select * from readers where borrowid like '%{0}%' and rname like '%{1}%' and sex='{2}' and job like '%{3}%' and rCurNum>={4} and rBorrowedNum>={5} and dept like '%{6}%' and phone like '%{7}%'",
244 | borrowid.Text, rname.Text, sex.Text, job.Text, rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text);
245 | DataSet result = DbHelperSQL.Query(readerSearchSql);
246 |
247 | this.readerSearchResult.DataSource = result.Tables["ds"];
248 | }
249 | catch (NullReferenceException exception)
250 | {
251 | MessageBox.Show("请先选中一行!");
252 | return;
253 | }
254 | }
255 |
256 | private void numberInputOnly(object sender, KeyPressEventArgs e)
257 | {
258 | if (Char.IsNumber(e.KeyChar) || e.KeyChar == 8)
259 | {
260 | e.Handled = false;
261 | }
262 | else
263 | {
264 | e.Handled = true;
265 | }
266 | }
267 |
268 | private void borrowBook_Click(object sender, EventArgs e)
269 | {
270 | string sql, readerID = "";
271 | DataSet result = null;
272 | try
273 | {
274 | sql = String.Format("select borrowid from readers where account='{0}'", PubConstant.currentAccount);
275 | result = DbHelperSQL.Query(sql);
276 | readerID = result.Tables["ds"].Rows[0]["borrowid"].ToString();
277 |
278 | int index = bookSearchResult.CurrentRow.Index;
279 | string inputIsbn = bookSearchResult.Rows[index].Cells[0].Value.ToString().Trim();
280 |
281 | sql = String.Format("insert into rb values('{0}','{1}','{2}',{3},'{4}',{5})",
282 | readerID, inputIsbn, DateTime.Now.ToString("yyyy-MM-dd"), 30, DateTime.Now.AddDays(30).ToString("yyyy-MM-dd"), 30);
283 |
284 | if (DialogResult.Yes == MessageBox.Show("确定借书?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
285 | {
286 | //SQL借书语句字符串
287 | if (DbHelperSQL.ExecuteSql(sql) > 0) //向源数据库传递SQL命令字符串,得到借书结果
288 | {
289 | MessageBox.Show("借书成功");
290 |
291 | //查询语句
292 | string bookSearchSql =
293 | String.Format("select * from books where isbn like '%{0}%' and bname like '%{1}%' and pub like '%{2}%' and author like '%{3}%' and bCurNum>={4} and storeNum>={5} and available='{6}'",
294 | bookID.Text, bookName.Text, press.Text, author.Text, bookBorrowCount.Text, bookTotalCount.Text, borrowable.Text);
295 | result = DbHelperSQL.Query(bookSearchSql);
296 |
297 | this.bookSearchResult.DataSource = result.Tables["ds"];
298 | }
299 | else
300 | {
301 | MessageBox.Show("借书失败");
302 | }
303 | }
304 | }
305 | catch (NullReferenceException exception)
306 | {
307 | MessageBox.Show("请先选中一行!");
308 | return;
309 | }
310 | catch(Exception exception)
311 | {
312 | if (exception.Message =="在位置 0 处没有任何行。")
313 | {
314 | MessageBox.Show("管理员没有添加该读者!");
315 | }
316 | else MessageBox.Show(exception.Message);
317 | if(exception.Message== "该读者当前还有未还书籍,不能借书!")
318 | {
319 | sql = String.Format(@"select bname,sum(fine) fineSum
320 | from books,rb
321 | where returnDate<'{0}' and borrowid='{1}'
322 | group by borrowid,bname",
323 | DateTime.Now.ToString("yyyy-MM-dd"), readerID);
324 | result = DbHelperSQL.Query(sql);
325 | string message = "您当前未还的书籍有:\r\n";
326 | int fineSum = 0;
327 | foreach(DataRow row in result.Tables["ds"].Rows)
328 | {
329 | message += row["bname"].ToString() + "\r\n";
330 | fineSum += int.Parse(row["fineSum"].ToString());
331 | }
332 | if (DialogResult.Yes == MessageBox.Show(message + "为这些书籍交纳罚款?\r\n罚款总和为:" + fineSum.ToString(), "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
333 | {
334 | sql = String.Format(@"delete from rb
335 | where returnDate<'{0}' and borrowid='{1}'",
336 | DateTime.Now.ToString("yyyy-MM-dd"), readerID);
337 | if (DbHelperSQL.ExecuteSql(sql) > 0)
338 | {
339 | MessageBox.Show("交纳罚款成功!");
340 | }
341 | else
342 | {
343 | MessageBox.Show("交纳罚款失败!");
344 | }
345 | }
346 | }
347 | return;
348 | }
349 | }
350 |
351 | private void returnBook_Click(object sender, EventArgs e)
352 | {
353 | try
354 | {
355 | string sql = String.Format("select borrowid from readers where account='{0}'", PubConstant.currentAccount);
356 | DataSet result = DbHelperSQL.Query(sql);
357 | string readerID = result.Tables["ds"].Rows[0]["borrowid"].ToString();
358 |
359 | int index = bookSearchResult.CurrentRow.Index;
360 | string inputIsbn = bookSearchResult.Rows[index].Cells[0].Value.ToString().Trim();
361 |
362 | sql = String.Format("delete from rb where borrowid='{0}' and isbn='{1}'", readerID, inputIsbn);
363 |
364 | if (DialogResult.Yes == MessageBox.Show("确定还书?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
365 | {
366 | //SQL还书语句字符串
367 | if (DbHelperSQL.ExecuteSql(sql) > 0) //向源数据库传递SQL命令字符串,得到还书结果
368 | {
369 | MessageBox.Show("还书成功");
370 |
371 | //查询语句
372 | string bookSearchSql =
373 | String.Format("select * from books where isbn like '%{0}%' and bname like '%{1}%' and pub like '%{2}%' and author like '%{3}%' and bCurNum>={4} and storeNum>={5} and available='{6}'",
374 | bookID.Text, bookName.Text, press.Text, author.Text, bookBorrowCount.Text, bookTotalCount.Text, borrowable.Text);
375 | result = DbHelperSQL.Query(bookSearchSql);
376 |
377 | this.bookSearchResult.DataSource = result.Tables["ds"];
378 | }
379 | else
380 | {
381 | MessageBox.Show("你没有借过这本书!");
382 | }
383 | }
384 | }
385 | catch (NullReferenceException exception)
386 | {
387 | MessageBox.Show("请先选中一行!");
388 | return;
389 | }
390 | catch (SqlException exception)
391 | {
392 | MessageBox.Show(exception.Message);
393 | return;
394 | }
395 | }
396 |
397 | private void delayedBookSearch_Click(object sender, EventArgs e)
398 | {
399 | try
400 | {
401 | string sql = string.Format("select * from rb where returnDate<'{0}'", DateTime.Now.ToString("yyyy-MM-dd"));
402 | DataSet result = DbHelperSQL.Query(sql);
403 | this.delayedbookSearchResult.DataSource = result.Tables["ds"];
404 | }
405 | catch(Exception ex)
406 | {
407 | MessageBox.Show(ex.Message);
408 | return;
409 | }
410 | }
411 | }
412 | }
413 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/main.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/register.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DataBase_Project
4 | {
5 | partial class register
6 | {
7 | ///
8 | /// Required designer variable.
9 | ///
10 | private System.ComponentModel.IContainer components = null;
11 |
12 | ///
13 | /// Clean up any resources being used.
14 | ///
15 | /// true if managed resources should be disposed; otherwise, false.
16 | protected override void Dispose(bool disposing)
17 | {
18 | if (disposing && (components != null))
19 | {
20 | components.Dispose();
21 | }
22 | base.Dispose(disposing);
23 | }
24 |
25 | #region Windows Form Designer generated code
26 |
27 | ///
28 | /// Required method for Designer support - do not modify
29 | /// the contents of this method with the code editor.
30 | ///
31 | private void InitializeComponent()
32 | {
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.label3 = new System.Windows.Forms.Label();
36 | this.account = new System.Windows.Forms.TextBox();
37 | this.password = new System.Windows.Forms.TextBox();
38 | this.identity = new System.Windows.Forms.ComboBox();
39 | this.confirm = new System.Windows.Forms.Button();
40 | this.SuspendLayout();
41 | //
42 | // label1
43 | //
44 | this.label1.AutoSize = true;
45 | this.label1.Location = new System.Drawing.Point(121, 56);
46 | this.label1.Name = "label1";
47 | this.label1.Size = new System.Drawing.Size(29, 12);
48 | this.label1.TabIndex = 0;
49 | this.label1.Text = "账号";
50 | //
51 | // label2
52 | //
53 | this.label2.AutoSize = true;
54 | this.label2.Location = new System.Drawing.Point(121, 96);
55 | this.label2.Name = "label2";
56 | this.label2.Size = new System.Drawing.Size(29, 12);
57 | this.label2.TabIndex = 1;
58 | this.label2.Text = "密码";
59 | //
60 | // label3
61 | //
62 | this.label3.AutoSize = true;
63 | this.label3.Location = new System.Drawing.Point(121, 141);
64 | this.label3.Name = "label3";
65 | this.label3.Size = new System.Drawing.Size(29, 12);
66 | this.label3.TabIndex = 2;
67 | this.label3.Text = "身份";
68 | //
69 | // account
70 | //
71 | this.account.Location = new System.Drawing.Point(243, 47);
72 | this.account.Name = "account";
73 | this.account.Size = new System.Drawing.Size(100, 21);
74 | this.account.TabIndex = 3;
75 | //
76 | // password
77 | //
78 | this.password.Location = new System.Drawing.Point(243, 96);
79 | this.password.Name = "password";
80 | this.password.Size = new System.Drawing.Size(100, 21);
81 | this.password.TabIndex = 4;
82 | this.password.UseSystemPasswordChar = true;
83 | //
84 | // identity
85 | //
86 | this.identity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
87 | this.identity.FormattingEnabled = true;
88 | this.identity.Items.AddRange(new object[] {
89 | "管理员",
90 | "读者"});
91 | this.identity.Location = new System.Drawing.Point(243, 141);
92 | this.identity.Name = "identity";
93 | this.identity.Size = new System.Drawing.Size(121, 20);
94 | this.identity.TabIndex = 5;
95 | //
96 | // confirm
97 | //
98 | this.confirm.Location = new System.Drawing.Point(176, 196);
99 | this.confirm.Name = "confirm";
100 | this.confirm.Size = new System.Drawing.Size(75, 23);
101 | this.confirm.TabIndex = 6;
102 | this.confirm.Text = "注册";
103 | this.confirm.UseVisualStyleBackColor = true;
104 | this.confirm.Click += new System.EventHandler(this.confirm_Click);
105 | //
106 | // register
107 | //
108 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
109 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
110 | this.ClientSize = new System.Drawing.Size(456, 272);
111 | this.Controls.Add(this.confirm);
112 | this.Controls.Add(this.identity);
113 | this.Controls.Add(this.password);
114 | this.Controls.Add(this.account);
115 | this.Controls.Add(this.label3);
116 | this.Controls.Add(this.label2);
117 | this.Controls.Add(this.label1);
118 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
119 | this.MaximizeBox = false;
120 | this.MinimizeBox = false;
121 | this.Name = "register";
122 | this.Text = "注册";
123 | this.Load += new System.EventHandler(this.register_Load);
124 | this.ResumeLayout(false);
125 | this.PerformLayout();
126 |
127 | }
128 |
129 | #endregion
130 |
131 | private System.Windows.Forms.Label label1;
132 | private System.Windows.Forms.Label label2;
133 | private System.Windows.Forms.Label label3;
134 | private System.Windows.Forms.TextBox account;
135 | private System.Windows.Forms.TextBox password;
136 | private System.Windows.Forms.ComboBox identity;
137 | private System.Windows.Forms.Button confirm;
138 | }
139 | }
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/register.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Configuration;
11 | using System.Data.SqlClient;
12 |
13 | namespace DataBase_Project
14 | {
15 | public partial class register : Form
16 | {
17 | public register()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | public DbHelperSQL DbHelperSQL
23 | {
24 | get
25 | {
26 | throw new System.NotImplementedException();
27 | }
28 |
29 | set
30 | {
31 | }
32 | }
33 |
34 | private void register_Load(object sender, EventArgs e)
35 | {
36 | identity.SelectedIndex = 0;//初始一个默认项
37 | }
38 |
39 | private void confirm_Click(object sender, EventArgs e)
40 | {
41 | string inputAccount = account.Text.Trim();
42 | string inputPassword = password.Text;
43 | int inputIdentity = (identity.Text == "管理员") ? 0 : 1;
44 |
45 | if(String.IsNullOrEmpty(inputAccount)||String.IsNullOrEmpty(inputPassword))
46 | {
47 | if (MessageBox.Show("请先把信息填写完整!", "提示") == DialogResult.OK)
48 | return;
49 | }
50 |
51 | string connectionString = "server=localhost;database=Library;uid=sa;pwd=123456";
52 | SqlConnection con = new SqlConnection(connectionString);
53 |
54 | string role;
55 | if (inputIdentity == 0) role = "admin";
56 | else role = "reader";
57 | string registerTran = String.Format(@"begin tran
58 | SET XACT_ABORT ON
59 | create login {0} with password='{1}', default_database=Library
60 | create user {2} for login {3}
61 | exec sp_addrolemember '{4}', '{5}'
62 | insert into users values('{6}', '{7}', '{8}')
63 | commit tran",
64 | inputAccount, inputPassword, inputAccount, inputAccount, role, inputAccount, inputAccount, inputPassword, identity.Text);
65 | //string addLoginSql = "create login " + inputAccount + " with password='" + inputPassword + "', default_database=Library";
66 | //string addLoginSql = String.Format("create login {0} with password='{1}',default_database=Library",inputAccount,inputPassword);
67 | //string addUserSql = "EXEC sp_grantdbaccess '" + inputAccount + "','" + inputAccount + "'";
68 | //string addUserSql = String.Format("EXEC sp_grantdbaccess '{0}','{1}'", inputAccount, inputAccount);
69 | //string addRoleSql = "EXEC sp_addrolemember ";
70 | //if (inputIdentity == 0) addRoleSql += "'admin'";
71 | //else addRoleSql += "'reader'";
72 | //addRoleSql = addRoleSql + ",'" + inputAccount + "'";
73 |
74 |
75 | SqlCommand registerCmd = new SqlCommand(registerTran, con);
76 | //SqlCommand addLoginCmd = new SqlCommand(addLoginSql, con);
77 | //SqlCommand addUserCmd = new SqlCommand(addUserSql, con);
78 | //SqlCommand addRoleCmd = new SqlCommand(addRoleSql, con);
79 |
80 | //string result = "注册成功!";
81 |
82 | try
83 | {
84 | con.Open();
85 | registerCmd.ExecuteNonQuery();
86 | //addLoginCmd.ExecuteNonQuery();
87 | //addUserCmd.ExecuteNonQuery();
88 | //addRoleCmd.ExecuteNonQuery();
89 | //insertUserCmd.ExecuteNonQuery();
90 | }
91 | catch (SqlException exception)
92 | {
93 | //throw new Exception(exception.Message);
94 | if (MessageBox.Show(exception.Message, "错误") == DialogResult.OK)
95 | {
96 | con.Close();
97 | registerCmd.Dispose();
98 | return;
99 | }
100 | }
101 | finally
102 | {
103 | registerCmd.Dispose(); //对SqlCommand进行处理,回收
104 | //addLoginCmd.Dispose();
105 | //addUserCmd.Dispose();
106 | //addRoleCmd.Dispose();
107 | //insertUserCmd.Dispose();
108 | //con.Close();//连接关闭
109 | //if (MessageBox.Show(result, "提示") == DialogResult.OK) this.Close();
110 | }
111 |
112 | string addRole = String.Format("exec sp_addsrvrolemember '{0}', 'securityadmin' ", inputAccount);
113 | if (inputIdentity == 0) addRole += String.Format("exec sp_addrolemember 'db_accessadmin','{0}'", inputAccount);
114 | SqlCommand addSrvRoleCmd = new SqlCommand(addRole, con);
115 | try
116 | {
117 | addSrvRoleCmd.ExecuteNonQuery();
118 | }
119 | catch(SqlException exception)
120 | {
121 | if (MessageBox.Show(exception.Message, "错误") == DialogResult.OK)
122 | {
123 | con.Close();
124 | addSrvRoleCmd.Dispose();
125 | return;
126 | }
127 | }
128 |
129 | if (MessageBox.Show("注册成功!", "提示") == DialogResult.OK)
130 | {
131 | con.Close();
132 | addSrvRoleCmd.Dispose();
133 | }
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/C#程序/DataBase Project/register.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/ER图.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/ER图.vsdx
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告_洪义耕.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告_洪义耕.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告_陈亮.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/个人报告_陈亮.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/小组成员信息.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/小组成员信息.docx
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/小组评分表.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/小组评分表.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/数据库设计报告.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/数据库设计报告.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/系统设计文档.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/系统设计文档.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/系统详细设计文档V1.0.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/报告和文档/系统详细设计文档V1.0.doc
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/Library.mdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/Library.mdf
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/Library_log.ldf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/Library_log.ldf
--------------------------------------------------------------------------------
/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/SQL脚本.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RookieHong/DataBase-Project/1298e2ca0809b8a607e57618e31b895d09c6f978/DataBase Project/22920152203860_洪义耕_大实验_图书管理系统/数据库文件/SQL脚本.sql
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 数据库大作业
2 | 简易图书管理系统
3 |
4 | 需求分析:
5 | 图书管理系统其实是一个很复杂的信息管理系统,它包括很多分类、检索等方面的内容。因为其复杂性,本实验只要实现一个简化的图书管理系统的功能。
6 | 1. 基本功能需求:
7 | (1)管理员模块
8 | 主要功能是对图书信息的添加,修改,删除;读者的添加,删除,修改;以及对读者权限登录的控制
9 | (2)信息录入功能
10 | 1)添加新图书信息。只有管理员有权限操作
11 | 2)添加读者信息。用于登记新读者信息。只有管理员有权限操作。
12 | 3)借阅信息。用于登记读者的借阅情况信息。
13 | (3)逻辑功能要求
14 | 1)修改和删除图书信息。图书被借出时,系统需要更新图书信息的可借数量,当可借数量为0时,表示该图书都已被借出。当输入的图书信息有错误或需要进行必要更新时,可以修改图书信息;当一种图书所有馆藏图书都已损毁或遗失并且不能重新买到时,该图书信息需要删除。
15 | 2)修改和删除读者信息。如某读者毕业了可删除该读者的信息
16 | 3)还书处理。读者归还图书时,更新图书借阅信息表中的归还日期,读者信息表中的已借数量及ISBN类别信息表中该图书的可借数量。当图书期限过期,自动计算罚款。
17 | 4)借书限制。当读者有罚款时,不能借书。可提示是否要交罚款,交完之后即可借书。
18 | (4)查询功能
19 | 1)图书查询功能。根据图书的各种已知条件来查询图书的详细信息,如书名、作者、ISBN书号等支持模糊查询。
20 | 2)读者信息查询。输入读者的借书证号、姓名等信息,查询读者的基本信息。对查询到的每一个读者,能够显示其未归还的图书编号和书名。
21 | 3)查询所有到期未归还的图书信息。要求结果显示图书编号、书名、读者姓名、借书证号码、借出日期等信息。
22 | 2.数据表的创建
23 | 根据功能要求的说明创建下列数据表:
24 | (1)登陆表
25 | 登陆表包括以下字段:
26 | 账号,密码,权限(判断管理员还是读者)
27 | (2)图书信息表
28 | 图书信息表包括以下字段:
29 | ISBN书号、书名、出版社、作者、馆藏数量、可借数量、是否可借。
30 | (3)读者信息表
31 | 读者信息表包括以下字段:
32 | 借书证号、姓名、性别、职称、可借数量、已借数量、工作部门、联系电话。
33 | (4)借阅信息表(图书-读者关系)
34 | 借阅信息表包括以下字段:
35 | 借书证号、借阅书号、借出日期、借阅期限、归还日期、罚款。
36 | 3.数据库完整性设计
37 | 设计者应认真分析和思考各个表之间的关系,合理设计和实施数据完整性原则。
38 | 1)给每个表实施主键及外键约束。
39 | 2)设定缺省约束。如性别。
40 | 3)设置非空约束如图书信息表中的书名。
41 | 4)实施CHECK约束。
42 | 4.SQL Server数据库对象设计(此建议可选)
43 | 1)设计一个存储过程,以图书编号为输入参数,返回借阅该图书但未归还的读者姓名和借书证号。
44 | 2)读者资料查询:设计一个有多个输入参数的存储过程,返回读者的详细信息。设计另一存储过程并以读者借书证号为输入参数,返回该读者未归还的图书名称和图书编号。
45 | 3)到期图书查询:设计一个视图,返回所有逾期未归还的图书的编号、书名、读者姓名等信息。
46 | 5)加快数据检索速度,用图书编号为图书信息表建立索引。
47 | 6)为读者信息表创建一个删除触发器,当一个读者毕业或者请他情况时,将此读者的资料从读者信息表中删除。注意实施业务规则:有借阅书的读者不得从读者信息表中删除。
48 | 7)借阅处理:为借阅信息表设计INSERT触发器,在读者借阅时更改ISBN类别信息表,且可借数量减1,图书信息表是否可借列的值变为“不可借”,读者信息表中该类读者已借阅数加1。
49 | 8)还书处理:为借阅信息表设计UPDATE触发器,在该表的归还日期列被更改后,将图书信息表的是否可借列的值变为“可借”,读者信息表中已借数量减1及ISBN类别信息表中可借数量加1。
50 | 备注:该题目不能随意删除表的字段,可相应增加相关字段,除了上述的基本功能之外,可另外添加其他功能。
51 |
--------------------------------------------------------------------------------