diff --git a/Book_manger/.vs/Book_manger/v16/.suo b/Book_manger/.vs/Book_manger/v16/.suo new file mode 100644 index 0000000..2680e6f Binary files /dev/null and b/Book_manger/.vs/Book_manger/v16/.suo differ diff --git a/Book_manger/.vs/ProjectSettings.json b/Book_manger/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/Book_manger/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/Book_manger/.vs/Sql/FileContentIndex/7c55f465-b61e-4ef2-9b8a-1810d93cedcf.vsidx b/Book_manger/.vs/Sql/FileContentIndex/7c55f465-b61e-4ef2-9b8a-1810d93cedcf.vsidx new file mode 100644 index 0000000..4c0c32e Binary files /dev/null and b/Book_manger/.vs/Sql/FileContentIndex/7c55f465-b61e-4ef2-9b8a-1810d93cedcf.vsidx differ diff --git a/Book_manger/.vs/Sql/FileContentIndex/81214fc9-5b86-4bdb-98c3-2cbd067b71dc.vsidx b/Book_manger/.vs/Sql/FileContentIndex/81214fc9-5b86-4bdb-98c3-2cbd067b71dc.vsidx new file mode 100644 index 0000000..afdc2b3 Binary files /dev/null and b/Book_manger/.vs/Sql/FileContentIndex/81214fc9-5b86-4bdb-98c3-2cbd067b71dc.vsidx differ diff --git a/Book_manger/.vs/Sql/FileContentIndex/8204b05d-14c2-469f-b739-5db2feabb781.vsidx b/Book_manger/.vs/Sql/FileContentIndex/8204b05d-14c2-469f-b739-5db2feabb781.vsidx new file mode 100644 index 0000000..45fd0d2 Binary files /dev/null and b/Book_manger/.vs/Sql/FileContentIndex/8204b05d-14c2-469f-b739-5db2feabb781.vsidx differ diff --git a/Book_manger/.vs/Sql/FileContentIndex/fb362f3f-cfc5-4b30-9536-9e7c8af73620.vsidx b/Book_manger/.vs/Sql/FileContentIndex/fb362f3f-cfc5-4b30-9536-9e7c8af73620.vsidx new file mode 100644 index 0000000..72dbf60 Binary files /dev/null and b/Book_manger/.vs/Sql/FileContentIndex/fb362f3f-cfc5-4b30-9536-9e7c8af73620.vsidx differ diff --git a/Book_manger/.vs/Sql/FileContentIndex/read.lock b/Book_manger/.vs/Sql/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/Book_manger/.vs/Sql/v16/.suo b/Book_manger/.vs/Sql/v16/.suo new file mode 100644 index 0000000..6444cfd Binary files /dev/null and b/Book_manger/.vs/Sql/v16/.suo differ diff --git a/Book_manger/.vs/Sql/v17/.suo b/Book_manger/.vs/Sql/v17/.suo new file mode 100644 index 0000000..d78e47a Binary files /dev/null and b/Book_manger/.vs/Sql/v17/.suo differ diff --git a/Book_manger/.vs/VSWorkspaceState.json b/Book_manger/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..977d1db --- /dev/null +++ b/Book_manger/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\Sql.sln", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/Book_manger/.vs/slnx.sqlite b/Book_manger/.vs/slnx.sqlite new file mode 100644 index 0000000..6002bff Binary files /dev/null and b/Book_manger/.vs/slnx.sqlite differ diff --git a/Book_manger/Sql.sln b/Book_manger/Sql.sln new file mode 100644 index 0000000..12e061d --- /dev/null +++ b/Book_manger/Sql.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sql", "Sql\Sql.csproj", "{DB8AE64E-8D73-41AC-AEE9-6E00747FE730}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DB8AE64E-8D73-41AC-AEE9-6E00747FE730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB8AE64E-8D73-41AC-AEE9-6E00747FE730}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB8AE64E-8D73-41AC-AEE9-6E00747FE730}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB8AE64E-8D73-41AC-AEE9-6E00747FE730}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A2338796-1F42-414A-B692-071F351126A3} + EndGlobalSection +EndGlobal diff --git a/Book_manger/Sql/App.config b/Book_manger/Sql/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Book_manger/Sql/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Book_manger/Sql/Dao.cs b/Book_manger/Sql/Dao.cs new file mode 100644 index 0000000..12114fb --- /dev/null +++ b/Book_manger/Sql/Dao.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data.SqlClient; +using System.Data; +namespace Sql +{ + class Dao + { + public SqlConnection connect() + { + string str = @"Data Source=DESKTOP-4PSN6SL;Data Source=DESKTOP-4PSN6SL;Initial Catalog=Demo;Integrated Security=True"; + SqlConnection sc = new SqlConnection(str); + sc.Open(); + return sc; + } + public SqlCommand command(string sql)//所有数据库的操作都要经过这里去获得一个数据库的连接,上面的connect是连接数据库的函数 + { + SqlCommand cmd = new SqlCommand(sql, connect()); + return cmd; + } + public int Execute(string sql) + { + + return command(sql).ExecuteNonQuery();//通常用它来执行insert、update、delete语句 + } + public SqlDataReader read(string sql) + { + return command(sql).ExecuteReader();//ExecuteReader用于实现只进只读的高效数据查询 + } + } +} diff --git a/Book_manger/Sql/Form1.Designer.cs b/Book_manger/Sql/Form1.Designer.cs new file mode 100644 index 0000000..be6002c --- /dev/null +++ b/Book_manger/Sql/Form1.Designer.cs @@ -0,0 +1,232 @@ +namespace Sql +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("楷体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(391, 68); + this.textBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(281, 42); + this.textBox1.TabIndex = 2; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("楷体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(262, 72); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(117, 33); + this.label1.TabIndex = 1; + this.label1.Text = "账号:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("楷体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(262, 163); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(117, 33); + this.label2.TabIndex = 2; + this.label2.Text = "密码:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("楷体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(391, 159); + this.textBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.textBox2.Multiline = true; + this.textBox2.Name = "textBox2"; + this.textBox2.PasswordChar = '*'; + this.textBox2.Size = new System.Drawing.Size(281, 42); + this.textBox2.TabIndex = 3; + // + // button1 + // + this.button1.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button1.Font = new System.Drawing.Font("楷体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(268, 338); + this.button1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(180, 54); + this.button1.TabIndex = 5; + this.button1.Text = "登录"; + this.button1.UseVisualStyleBackColor = false; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // comboBox1 + // + this.comboBox1.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.comboBox1.DropDownHeight = 150; + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.IntegralHeight = false; + this.comboBox1.ItemHeight = 36; + this.comboBox1.Items.AddRange(new object[] { + "学生", + "管理员"}); + this.comboBox1.Location = new System.Drawing.Point(390, 245); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(281, 44); + this.comboBox1.TabIndex = 4; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("楷体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(267, 245); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(117, 33); + this.label3.TabIndex = 10; + this.label3.Text = "权限:"; + // + // timer1 + // + this.timer1.Interval = 10; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // button3 + // + this.button3.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button3.Font = new System.Drawing.Font("楷体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.Location = new System.Drawing.Point(492, 338); + this.button3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(180, 54); + this.button3.TabIndex = 11; + this.button3.Text = "退出"; + this.button3.UseVisualStyleBackColor = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button4.Font = new System.Drawing.Font("楷体", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button4.Location = new System.Drawing.Point(676, 68); + this.button4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(42, 42); + this.button4.TabIndex = 12; + this.button4.Text = "X"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button6 + // + this.button6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button6.Font = new System.Drawing.Font("楷体", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(676, 159); + this.button6.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(42, 42); + this.button6.TabIndex = 14; + this.button6.Text = "X"; + this.button6.UseVisualStyleBackColor = false; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // pictureBox1 + // + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.pictureBox1.ErrorImage = null; + this.pictureBox1.Image = global::Sql.Properties.Resources._281ff8591fc479d8efc38bc5bc03acdd; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(38, 68); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(225, 227); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(738, 444); + this.Controls.Add(this.button6); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.label3); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MaximumSize = new System.Drawing.Size(760, 500); + this.MinimumSize = new System.Drawing.Size(760, 500); + this.Name = "Form1"; + this.Text = "桂林电子科技大学图书馆管理系统 By:G13小组"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button6; + } +} + diff --git a/Book_manger/Sql/Form1.cs b/Book_manger/Sql/Form1.cs new file mode 100644 index 0000000..7d36464 --- /dev/null +++ b/Book_manger/Sql/Form1.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Data.SqlClient; +using System.Security.Cryptography; + +namespace Sql +{ + public partial class Form1 : Form//进行接口拆分,Form1被拆分了,还有一部分在放在Form1.Designer.cs里 :Form就是继承自Form + { // + public Form1() + { + InitializeComponent();//该方法实际上是由系统生成的对于窗体界面的定义方法,会跳转到Form1.Designer.cs,这个是对界面进行初始化 + //在每一个Form文件建立后,都会同时产生程序代码文件.CS文件,以及与之相匹配的.Designer.CS文件, + //业务逻辑以及事件方法等被编写在.CS文件之中,而界面设计规则被封装在.Designer.CS文件里 + + + }//做完这个初始化操作以后就弹出登录框了,等待下一步的命令执行 + public string MD5Hash(string input)//对数据进行md5加密 + { + MD5 md5 = MD5.Create(); + byte[] inputBytes = Encoding.ASCII.GetBytes(input); + byte[] hashBytes = md5.ComputeHash(inputBytes); + + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < hashBytes.Length; i++) + { + sb.Append(hashBytes[i].ToString("X2")); + } + return sb.ToString(); + } + private void timer1_Tick(object sender, EventArgs e) + { + if(pictureBox1.Location.X<175)//图片校准功能,就是不确定我们的图片大小是怎么样的,但是为了实现滑动功能,将图片从左到右滑动,于是来一个图片校准 + { + pictureBox1.Location = new Point(pictureBox1.Location.X + 4, pictureBox1.Location.Y); + } + else + { + if(comboBox1.Text=="学生") + { + string A = MD5Hash(textBox2.Text); + string sql = "select * from Student where Id='" + textBox1.Text + "'and Password='" + A + "'"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + dr.Read(); + string sID = dr["Id"].ToString(); + Form3 form3 = new Form3(sID); + form3.Show(); + this.Hide(); + // this.Close(); + } + else + { + if (comboBox1.Text == "老师") + { + Form2 form2 = new Form2(); + form2.Show(); + this.Hide(); + // this.Close(); + } + else + { + if (comboBox1.Text == "管理员")//滑动完了以后就进行判断,管理员的话就走这一条 + { + Form5 form5 = new Form5();//创建一个form5窗体 + form5.Show();//form5窗体展示,跳转到form5.Designer.cs文件进行窗体初始化 + this.Hide();//form1窗体隐藏 + // this.Close(); + } + } + } + timer1.Stop();//timer1定时器停止,然后打开了form5等待使用者进行操作 + } + } + + private void button1_Click(object sender, EventArgs e)//点击登录以后触发了这个事件 + { + if(login())//这个是一个登录判断,然后进入到login()里面去进行判断,在下面89行 + { + timer1.Start();//启动定时器,待会准备运行timer1_Tick() + textBox1.Visible = false; + textBox2.Visible = false; + label1.Visible = false; + label2.Visible = false; + label3.Visible = false; + comboBox1.Visible = false; + button1.Visible = false; + button3.Visible = false; + button4.Visible = false; + button6.Visible = false; + } + else if(textBox1.Text != "" && textBox2.Text != "" && comboBox1.Text != "") + { + MessageBox.Show("账号或密码有误", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + private bool login() + { + if (textBox1.Text == "" || textBox2.Text == ""||comboBox1.Text=="")//逻辑与,两个都为真才行,也就是判断这三个框都不能为空 + { + MessageBox.Show("输入不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);//提示是行头,里面的文字是输入不完整 + return false; + } + if (comboBox1.Text == "学生")//如果框框是学生那么走下面的判断,下面的管理员也一样 + { + string A = MD5Hash(textBox2.Text); + string sql = "select * from Student where Id='" + textBox1.Text + "'and Password='"+A+"'"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + if(dr.Read()) + { + return true; + } + else + { + return false; + } + } + if (comboBox1.Text == "老师") + { + string A = MD5Hash(textBox2.Text); + string sql = "select * from seat where Name='" + textBox1.Text + "'and Password='" + A + "'"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + if (dr.Read()) + { + return true; + } + else + { + return false; + } + } + if (comboBox1.Text == "管理员") + { + string A = MD5Hash(textBox2.Text); + string sql = "select * from Admin where Id='" + textBox1.Text + "'and Password='" + A + "'";//sql语句进行拼接 + Dao dao = new Dao();//创建一个Dao对象,准备通过Dao对数据库进行操作 + IDataReader dr = dao.read(sql);//dao层的read函数载入sql语句开始查询,然后将结果给到dr + if (dr.Read())//如果数据库的读取成功,那么返回成功,离开到139行 + { + return true; + } + else + { + return false; + } + } + return false; + } + private void button3_Click(object sender, EventArgs e) + { + if (textBox1.Text != "" || textBox2.Text != "" || comboBox1.Text != "") + { + DialogResult r = MessageBox.Show("退出后当前输入内容不会保存", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Close(); + } + } + else + { + Close(); + } + } + + private void button4_Click(object sender, EventArgs e) + { + textBox1.Text = null; + + } + private void button6_Click(object sender, EventArgs e) + { + textBox2.Text = null; + } + + private void pictureBox1_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form1.resx b/Book_manger/Sql/Form1.resx new file mode 100644 index 0000000..1f666f2 --- /dev/null +++ b/Book_manger/Sql/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form2.Designer.cs b/Book_manger/Sql/Form2.Designer.cs new file mode 100644 index 0000000..0dd103f --- /dev/null +++ b/Book_manger/Sql/Form2.Designer.cs @@ -0,0 +1,332 @@ + +namespace Sql +{ + partial class Form2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.系统ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.信息管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.添加学生信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.修改学生信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.删除学生信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.menuStrip1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.系统ToolStripMenuItem, + this.信息管理ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(852, 32); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // 系统ToolStripMenuItem + // + this.系统ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.退出ToolStripMenuItem}); + this.系统ToolStripMenuItem.Name = "系统ToolStripMenuItem"; + this.系统ToolStripMenuItem.Size = new System.Drawing.Size(62, 28); + this.系统ToolStripMenuItem.Text = "系统"; + // + // 退出ToolStripMenuItem + // + this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.退出ToolStripMenuItem.Text = "更换账户登录"; + this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); + // + // 信息管理ToolStripMenuItem + // + this.信息管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.添加学生信息ToolStripMenuItem, + this.修改学生信息ToolStripMenuItem, + this.删除学生信息ToolStripMenuItem}); + this.信息管理ToolStripMenuItem.Name = "信息管理ToolStripMenuItem"; + this.信息管理ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.信息管理ToolStripMenuItem.Text = "信息管理"; + // + // 添加学生信息ToolStripMenuItem + // + this.添加学生信息ToolStripMenuItem.Name = "添加学生信息ToolStripMenuItem"; + this.添加学生信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.添加学生信息ToolStripMenuItem.Text = "添加学生信息"; + this.添加学生信息ToolStripMenuItem.Click += new System.EventHandler(this.添加学生信息ToolStripMenuItem_Click); + // + // 修改学生信息ToolStripMenuItem + // + this.修改学生信息ToolStripMenuItem.Name = "修改学生信息ToolStripMenuItem"; + this.修改学生信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.修改学生信息ToolStripMenuItem.Text = "修改学生信息"; + this.修改学生信息ToolStripMenuItem.Click += new System.EventHandler(this.修改学生信息ToolStripMenuItem_Click); + // + // 删除学生信息ToolStripMenuItem + // + this.删除学生信息ToolStripMenuItem.Name = "删除学生信息ToolStripMenuItem"; + this.删除学生信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.删除学生信息ToolStripMenuItem.Text = "删除学生信息"; + this.删除学生信息ToolStripMenuItem.Click += new System.EventHandler(this.删除学生信息ToolStripMenuItem_Click); + // + // toolStrip1 + // + this.toolStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3, + this.toolStripButton4}); + this.toolStrip1.Location = new System.Drawing.Point(0, 32); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(852, 33); + this.toolStrip1.TabIndex = 1; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::Sql.Properties.Resources.OIP__1_; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(34, 28); + this.toolStripButton1.Text = "添加学生信息"; + this.toolStripButton1.Click += new System.EventHandler(this.添加学生信息ToolStripMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::Sql.Properties.Resources._8ae4ff6e_E773664_ab5bd2c5; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(34, 28); + this.toolStripButton2.Text = "删除学生信息"; + this.toolStripButton2.Click += new System.EventHandler(this.删除学生信息ToolStripMenuItem_Click); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::Sql.Properties.Resources._9b554143b1bcd74106747ab848ca280f; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(34, 28); + this.toolStripButton3.Text = "修改学生信息"; + this.toolStripButton3.Click += new System.EventHandler(this.修改学生信息ToolStripMenuItem_Click); + // + // toolStripButton4 + // + this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton4.Image = global::Sql.Properties.Resources.t01b34dced1b5dbeaac; + this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton4.Name = "toolStripButton4"; + this.toolStripButton4.Size = new System.Drawing.Size(34, 28); + this.toolStripButton4.Text = "刷新"; + this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.toolStripStatusLabel2, + this.toolStripStatusLabel3}); + this.statusStrip1.Location = new System.Drawing.Point(0, 502); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(852, 31); + this.statusStrip1.TabIndex = 2; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(190, 24); + this.toolStripStatusLabel1.Text = "欢迎登陆图书管理系统"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(0, 24); + // + // toolStripStatusLabel3 + // + this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; + this.toolStripStatusLabel3.Size = new System.Drawing.Size(52, 24); + this.toolStripStatusLabel3.Text = "Time"; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.AllowUserToOrderColumns = true; + this.dataGridView1.AllowUserToResizeColumns = false; + this.dataGridView1.AllowUserToResizeRows = false; + this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column3, + this.Column4, + this.Column5, + this.Column6}); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 65); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView1.Size = new System.Drawing.Size(852, 437); + this.dataGridView1.TabIndex = 3; + // + // Column1 + // + this.Column1.HeaderText = "学号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "姓名"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "班级"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "登录密码"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Column5 + // + this.Column5.HeaderText = "电话号码"; + this.Column5.MinimumWidth = 8; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + // + // Column6 + // + this.Column6.HeaderText = "电子邮件"; + this.Column6.MinimumWidth = 8; + this.Column6.Name = "Column6"; + this.Column6.ReadOnly = true; + // + // Form2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(852, 533); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form2"; + this.Text = "学生信息管理"; + this.Load += new System.EventHandler(this.Form2_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripMenuItem 系统ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 信息管理ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 添加学生信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 修改学生信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 删除学生信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.ToolStripButton toolStripButton4; + private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; + private System.Windows.Forms.DataGridViewTextBoxColumn Column6; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form2.cs b/Book_manger/Sql/Form2.cs new file mode 100644 index 0000000..83e8f3d --- /dev/null +++ b/Book_manger/Sql/Form2.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form2 : Form + { + public Form2()//form2的初始化 + { + InitializeComponent(); + toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + timer1.Start(); + Table(); + } + + private void timer1_Tick(object sender, EventArgs e)//从form5进入到form2.show里面一开始就是这个,进入了时间循环 + { + toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//时间函数一直循环这个先注释掉,方便调试,待会加回来 + } + + private void Form2_Load(object sender, EventArgs e) + { + + } + public void Table() + { + dataGridView1.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + string sql = "select * from Student"; + Dao dao = new Dao(); + IDataReader dr=dao.read(sql); + while (dr.Read()) + { + string a, b, c, d, e, f; + a = dr["Id"].ToString(); //将获取到的信息赋值给abcd,然后添加数据 + b = dr["Name"].ToString(); + c = dr["Class"].ToString(); + d = dr["Password"].ToString(); + e = dr["Phone"].ToString(); + f = dr["Emali"].ToString(); + string[] str = { a, b, c, d, e, f}; + dataGridView1.Rows.Add(str); //添加数据,这个dataGridView1是创建窗体的时候弄的了 + } + dr.Close();//关闭连接 + } + + private void 添加学生信息ToolStripMenuItem_Click(object sender, EventArgs e)//控件点击触发事件 + { + // MessageBox.Show(DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss")); + Form21 f = new Form21(this);// + f.ShowDialog(); + } + + private void 修改学生信息ToolStripMenuItem_Click(object sender, EventArgs e)//控件点击触发事件 + { + string[] str = { dataGridView1.SelectedCells[0].Value.ToString(), dataGridView1.SelectedCells[1].Value.ToString(), dataGridView1.SelectedCells[2].Value.ToString(), dataGridView1.SelectedCells[3].Value.ToString()}; + // MessageBox.Show(str[0]+str[4]); + Form21 f = new Form21(str,this); + f.ShowDialog(); + } + + private void 删除学生信息ToolStripMenuItem_Click(object sender, EventArgs e)//控件点击触发事件 + { + DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + string id,name; + id = dataGridView1.SelectedCells[0].Value.ToString(); + name = dataGridView1.SelectedCells[1].Value.ToString(); + string sql = "delete from Student where Id='"+id+"'and Name='"+name+"'"; + MessageBox.Show("已删除学生——"+name+""); + Dao dao = new Dao(); + dao.Execute(sql); + Table(); //调用36行的私有类函数实现刷新表的功能 + } + } + + private void toolStripButton4_Click(object sender, EventArgs e) + { + Table(); //更新这个工作表 + } + + private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) + { + DialogResult hh = MessageBox.Show(" 是否确定退出当前账号", "提示", MessageBoxButtons.OKCancel); + if (hh == DialogResult.OK) + { + Form1 form1 = new Form1(); + form1.Show(); + this.Hide(); + } + else + { + //无需任何操作 + } + } + + } +} diff --git a/Book_manger/Sql/Form2.resx b/Book_manger/Sql/Form2.resx new file mode 100644 index 0000000..611951a --- /dev/null +++ b/Book_manger/Sql/Form2.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 182, 17 + + + 331, 17 + + + 497, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Book_manger/Sql/Form21.Designer.cs b/Book_manger/Sql/Form21.Designer.cs new file mode 100644 index 0000000..5e8d951 --- /dev/null +++ b/Book_manger/Sql/Form21.Designer.cs @@ -0,0 +1,332 @@ + +namespace Sql +{ + partial class Form21 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(68, 47); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(96, 28); + this.label1.TabIndex = 0; + this.label1.Text = "学号:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(68, 105); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(96, 28); + this.label2.TabIndex = 1; + this.label2.Text = "姓名:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(68, 156); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(96, 28); + this.label3.TabIndex = 2; + this.label3.Text = "班级:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(12, 206); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(152, 28); + this.label4.TabIndex = 3; + this.label4.Text = "登录密码:"; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(155, 44); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(219, 39); + this.textBox1.TabIndex = 5; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(151, 105); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(219, 39); + this.textBox2.TabIndex = 6; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(155, 156); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(219, 39); + this.textBox3.TabIndex = 7; + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(151, 201); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(219, 39); + this.textBox4.TabIndex = 8; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(17, 413); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(165, 44); + this.button1.TabIndex = 10; + this.button1.Text = "添加"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(247, 413); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(165, 44); + this.button2.TabIndex = 11; + this.button2.Text = "退出"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.Location = new System.Drawing.Point(17, 413); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(165, 44); + this.button3.TabIndex = 12; + this.button3.Text = "修改"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click_1); + // + // button4 + // + this.button4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button4.Location = new System.Drawing.Point(376, 43); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(36, 40); + this.button4.TabIndex = 13; + this.button4.Text = "X"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 + // + this.button5.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button5.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button5.Location = new System.Drawing.Point(376, 105); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(36, 40); + this.button5.TabIndex = 14; + this.button5.Text = "X"; + this.button5.UseVisualStyleBackColor = false; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 + // + this.button6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(376, 154); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(36, 40); + this.button6.TabIndex = 15; + this.button6.Text = "X"; + this.button6.UseVisualStyleBackColor = false; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 + // + this.button7.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button7.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button7.Location = new System.Drawing.Point(376, 201); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(36, 40); + this.button7.TabIndex = 16; + this.button7.Text = "X"; + this.button7.UseVisualStyleBackColor = false; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(12, 256); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(152, 28); + this.label5.TabIndex = 17; + this.label5.Text = "电话号码:"; + this.label5.Click += new System.EventHandler(this.label5_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(12, 303); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(152, 28); + this.label6.TabIndex = 18; + this.label6.Text = "电子邮箱:"; + // + // textBox5 + // + this.textBox5.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox5.Location = new System.Drawing.Point(151, 253); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(219, 39); + this.textBox5.TabIndex = 19; + // + // textBox6 + // + this.textBox6.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox6.Location = new System.Drawing.Point(155, 303); + this.textBox6.Name = "textBox6"; + this.textBox6.Size = new System.Drawing.Size(219, 39); + this.textBox6.TabIndex = 20; + // + // button8 + // + this.button8.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button8.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button8.Location = new System.Drawing.Point(380, 256); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(36, 40); + this.button8.TabIndex = 21; + this.button8.Text = "X"; + this.button8.UseVisualStyleBackColor = false; + // + // button9 + // + this.button9.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button9.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button9.Location = new System.Drawing.Point(376, 301); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(36, 40); + this.button9.TabIndex = 22; + this.button9.Text = "X"; + this.button9.UseVisualStyleBackColor = false; + // + // Form21 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(428, 494); + this.Controls.Add(this.button9); + this.Controls.Add(this.button8); + this.Controls.Add(this.textBox6); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximumSize = new System.Drawing.Size(450, 550); + this.MinimumSize = new System.Drawing.Size(450, 550); + this.Name = "Form21"; + this.Text = "学生信息管理"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form21.cs b/Book_manger/Sql/Form21.cs new file mode 100644 index 0000000..428c74f --- /dev/null +++ b/Book_manger/Sql/Form21.cs @@ -0,0 +1,222 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form21 : Form + { + Form2 form2; + string[] str = new string[4]; //定义范围,只许多不能少 + public Form21(Form2 f)//这个是带了一个参数过来的,这个是添加学生信息使用的函数 + { + InitializeComponent(); + button3.Visible = false; //隐藏修改按钮 + form2 = f; + } + public Form21(string[] a,Form2 f) //这个是带两个参数过来的,这个是修改学生信息使用的函数 + { + InitializeComponent(); + for(int i=0;i<6;i++) + { + str[i] = a[i]; + + } + textBox1.Text = str[0]; + textBox2.Text = str[1]; + textBox3.Text = str[2]; + textBox4.Text = str[3];//将要修改的四个值拿到这里来 + textBox5.Text = str[4]; + textBox6.Text = str[5]; + button1.Visible = false; //隐藏保存按钮 + form2 = f; + + } + //添加学生信息 + private void button1_Click(object sender, EventArgs e)//添加按钮的函数 + { + if(textBox1.Text==""|| textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "") + { + MessageBox.Show("输入不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + else + { + string sql = "Insert into Student values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')"; + //判断是否有学号重复的,重复则禁止添加 + string ID = "select * from Student"; + int b=1; + Dao doo = new Dao(); + IDataReader drr = doo.read(ID); + while (drr.Read()) + { + string a; + a = drr["Id"].ToString(); + if (a== textBox1.Text) + { + MessageBox.Show("学号为"+textBox1.Text+"的学生已经存在\n 请重新添加"); + b = 0; + break; + } + } + drr.Close();//关闭连接 + if (b != 0) + { + DialogResult r = MessageBox.Show(" 是否确认添加", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Dao dao = new Dao(); + int i = dao.Execute(sql); + if (i > 0) + { + MessageBox.Show("添加成功"); + textBox1.Text = null; //添加后归空,方便再次添加 + textBox2.Text = null; + textBox3.Text = null; + textBox4.Text = null; + textBox5.Text = null; + textBox6.Text = null; + } + form2.Table(); //实现实时刷新表 + } + } + + //判断是否有学号重复的,重复则禁止添加 + } + } + + private void button2_Click(object sender, EventArgs e)//取消按钮的函数 + { + if (button1.Visible == false) + { + Close(); + } + else if (textBox1.Text != "" || textBox2.Text != "" || textBox3.Text != "" || textBox4.Text != "" || textBox5.Text != "" || textBox6.Text != "") + { + DialogResult r = MessageBox.Show("退出后当前输入内容不会保存", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Close(); + } + } + else + { + Close(); + } + } + + //修改 + private void button3_Click_1(object sender, EventArgs e)//修改按钮的函数 + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" ) + { + MessageBox.Show("修改中有空项", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + //判断是否有学号重复的,重复则禁止添加 + string ID = "select * from Student"; + int b = 1; + Dao doo = new Dao(); + IDataReader drr = doo.read(ID); + while (drr.Read()) + { + string a; + a = drr["Id"].ToString(); + if (a == textBox1.Text) + { + MessageBox.Show("学号为" + textBox1.Text + "的学生已经存在请重新修改"); + b = 0; + break; + } + } + drr.Close();//关闭连接 + if (b != 0) + { + if (textBox1.Text != str[0]) + { + string sql = "update Student set Id='" + textBox1.Text + "'where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[0] = textBox1.Text; + } + if (textBox2.Text != str[1]) + { + string sql = "update Student set Name='" + textBox2.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[1] = textBox2.Text; + } + if (textBox3.Text != str[2]) + { + string sql = "update Student set Class='" + textBox3.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[2] = textBox3.Text; + } + if (textBox4.Text != str[3]) + { + string sql = "update Student set Password='" + textBox4.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[3] = textBox4.Text; + } + if (textBox5.Text != str[4]) + { + string sql = "update Student set Phone='" + textBox5.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[4] = textBox5.Text; + } + if (textBox6.Text != str[5]) + { + string sql = "update Student set Emali='" + textBox6.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[5] = textBox6.Text; + } + DialogResult r = MessageBox.Show("是否确认修改", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + form2.Table(); //实现实时刷新表 + Close(); + } + } + + //判断是否有学号重复的,重复则禁止添加 + + } + } + + private void button4_Click(object sender, EventArgs e)//后面的是几个x的图标,用处是将文本框里的东西置空 + { + textBox1.Text = null; + } + + private void button5_Click(object sender, EventArgs e) + { + textBox2.Text = null; + } + + private void button6_Click(object sender, EventArgs e) + { + textBox3.Text = null; + } + + private void button7_Click(object sender, EventArgs e) + { + textBox4.Text = null; + } + + private void label5_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form21.resx b/Book_manger/Sql/Form21.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Book_manger/Sql/Form21.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form3.Designer.cs b/Book_manger/Sql/Form3.Designer.cs new file mode 100644 index 0000000..e86bcb8 --- /dev/null +++ b/Book_manger/Sql/Form3.Designer.cs @@ -0,0 +1,292 @@ + +namespace Sql +{ + partial class Form3 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.借阅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.我的借阅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出当前账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.搜索图书ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.menuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.借阅ToolStripMenuItem, + this.我的借阅ToolStripMenuItem, + this.退出当前账号ToolStripMenuItem, + this.搜索图书ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(815, 36); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // 借阅ToolStripMenuItem + // + this.借阅ToolStripMenuItem.Name = "借阅ToolStripMenuItem"; + this.借阅ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.借阅ToolStripMenuItem.Text = "借阅此书"; + this.借阅ToolStripMenuItem.Click += new System.EventHandler(this.借阅ToolStripMenuItem_Click); + // + // 我的借阅ToolStripMenuItem + // + this.我的借阅ToolStripMenuItem.Name = "我的借阅ToolStripMenuItem"; + this.我的借阅ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.我的借阅ToolStripMenuItem.Text = "我的借阅"; + this.我的借阅ToolStripMenuItem.Click += new System.EventHandler(this.我的借阅ToolStripMenuItem_Click); + // + // 退出当前账号ToolStripMenuItem + // + this.退出当前账号ToolStripMenuItem.Name = "退出当前账号ToolStripMenuItem"; + this.退出当前账号ToolStripMenuItem.Size = new System.Drawing.Size(134, 28); + this.退出当前账号ToolStripMenuItem.Text = "退出当前账号"; + this.退出当前账号ToolStripMenuItem.Click += new System.EventHandler(this.退出当前账号ToolStripMenuItem_Click); + // + // 搜索图书ToolStripMenuItem + // + this.搜索图书ToolStripMenuItem.Name = "搜索图书ToolStripMenuItem"; + this.搜索图书ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.搜索图书ToolStripMenuItem.Text = "搜索图书"; + this.搜索图书ToolStripMenuItem.Click += new System.EventHandler(this.搜索图书ToolStripMenuItem_Click); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.toolStripStatusLabel3, + this.toolStripStatusLabel2}); + this.statusStrip1.Location = new System.Drawing.Point(0, 422); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(815, 31); + this.statusStrip1.TabIndex = 1; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(208, 24); + this.toolStripStatusLabel1.Text = "欢迎使用图书馆管理系统"; + // + // toolStripStatusLabel3 + // + this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; + this.toolStripStatusLabel3.Size = new System.Drawing.Size(160, 24); + this.toolStripStatusLabel3.Text = " "; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(52, 24); + this.toolStripStatusLabel2.Text = "Time"; + // + // timer1 + // + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.AllowUserToOrderColumns = true; + this.dataGridView1.AllowUserToResizeColumns = false; + this.dataGridView1.AllowUserToResizeRows = false; + this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column3, + this.Column4, + this.Column5, + this.Column6, + this.Column7, + this.Column8}); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 36); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView1.Size = new System.Drawing.Size(815, 386); + this.dataGridView1.TabIndex = 2; + // + // Column1 + // + this.Column1.HeaderText = "图书编号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "图书名称"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "作者"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "出版日期"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Column5 + // + this.Column5.HeaderText = "图书数量"; + this.Column5.MinimumWidth = 8; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + // + // Column6 + // + this.Column6.HeaderText = "出版社"; + this.Column6.MinimumWidth = 8; + this.Column6.Name = "Column6"; + this.Column6.ReadOnly = true; + // + // Column7 + // + this.Column7.HeaderText = "图书类型"; + this.Column7.MinimumWidth = 8; + this.Column7.Name = "Column7"; + this.Column7.ReadOnly = true; + // + // Column8 + // + this.Column8.HeaderText = "是否可以借阅"; + this.Column8.MinimumWidth = 8; + this.Column8.Name = "Column8"; + this.Column8.ReadOnly = true; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(447, 3); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 28); + this.textBox1.TabIndex = 3; + // + // comboBox1 + // + this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(567, 3); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 32); + this.comboBox1.TabIndex = 4; + this.comboBox1.Items.AddRange(new object[] { + "安全", + "大数据", + "历史", + "小说", + "开发"}); + // + // Form3 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(815, 453); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form3"; + this.Text = "学生借书"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form3_FormClosed); + this.Load += new System.EventHandler(this.Form3_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 借阅ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 我的借阅ToolStripMenuItem; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; + private System.Windows.Forms.ToolStripMenuItem 退出当前账号ToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; + private System.Windows.Forms.DataGridViewTextBoxColumn Column6; + private System.Windows.Forms.DataGridViewTextBoxColumn Column7; + private System.Windows.Forms.DataGridViewTextBoxColumn Column8; + private System.Windows.Forms.ToolStripMenuItem 搜索图书ToolStripMenuItem; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.ComboBox comboBox1; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form3.cs b/Book_manger/Sql/Form3.cs new file mode 100644 index 0000000..c1890a5 --- /dev/null +++ b/Book_manger/Sql/Form3.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form3 : Form + { + string SID; + public Form3(string sID) + { + SID = sID; + InitializeComponent(); + toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + toolStripStatusLabel1.Text = "欢迎学号为" + SID + "的同学登录图书借阅系统"; + timer1.Start(); + Table(); + } + public void Table() //此私有类是将数据加载到窗体中 + { + dataGridView1.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + string sql = "select * from Book"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + while (dr.Read()) + { + string a, b, c, d, e,f,g,h; + a = dr["Id"].ToString(); //这例可以自己修改 + b = dr["Name"].ToString(); + c = dr["Author"].ToString(); + d = dr["DOP"].ToString(); + e = dr["Count"].ToString(); + f = dr["Publisher"].ToString(); + g = dr["Category"].ToString(); + h = dr["State"].ToString(); + string[] str = { a, b, c, d, e,f,g,h}; + dataGridView1.Rows.Add(str); //添加数据 + } + dr.Close();//关闭连接 + } + + private void timer1_Tick(object sender, EventArgs e) + { + toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + private void Form3_FormClosed(object sender, FormClosedEventArgs e) + { + Application.Exit(); //***非常重要:上面的Form3_FormClosed就是Form3右上方的那个叉叉,单击后整个程序及所有窗口都会关闭 + } + + private void 借阅ToolStripMenuItem_Click(object sender, EventArgs e) + { + string BookId = dataGridView1.SelectedCells[0].Value.ToString();//获取选中的图书号 + string sql1 = "select * from BookRecord where sID='" + SID + "'and BookId='" + BookId + "'";//查询是否已经借阅了这本书 + Dao dao = new Dao(); + IDataReader dc = dao.read(sql1); //IDataReader是什么意思?是可以进行数据库操作的对象的意思 + DialogResult r = MessageBox.Show("是否确认借阅", "提示", MessageBoxButtons.OKCancel); + + if (!dc.Read() && r == DialogResult.OK) + { + string sql5 = "select Count from BookRecord where sID='" + SID + "'";//查询该同学借阅了多少书籍 + Dao dao5 = new Dao(); + IDataReader dc5 = dao.read(sql5); + dc5.Read(); + string bcount = dc5["Count"].ToString();//bcount借过的图书数量 + string s2 = "5"; + + if (s2.CompareTo(bcount) == 1)//5和借阅数量比较,首先5大,然后成立,bcount+1,一直加假如5=5,那么不给再继续借了 + { + + + //这里要加一个查询book表的代码 + string BId = dataGridView1.SelectedCells[0].Value.ToString(); + string Author = dataGridView1.SelectedCells[1].Value.ToString(); + string Count = dataGridView1.SelectedCells[4].Value.ToString(); + string jytime = DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss"); + string ghtime = DateTime.Now.AddMonths(3).ToString("yyyy - MM - dd HH: mm:ss"); + string sql2 = "update Book set Count = '" + Count + "' - 1 WHERE Id = '" + BId + "' "; + int i2 = dao.Execute(sql2); + + if (i2 > 0)//图书数量大于的话就执行下面的 + { + string sql = "insert into BookRecord(BookId,BookName,jytime,ghtime ,SID ) values('" + BId + "','" + Author + "','" + jytime + "','" + ghtime + "','" + SID + "')"; + int i = dao.Execute(sql); + string sql3 = "UPDATE BookRecord SET Count = Count+1 WHERE SID = " + SID + " "; + int i3 = dao.Execute(sql3);//更新图书记录表,给相应用户的图书数量+1 + MessageBox.Show("借阅成功"); + } + else + { + MessageBox.Show("图书库存不足!"); + } + } + else + { + MessageBox.Show("借阅数量已达五本,请先还书再借阅!"); + } + } + else if (!dc.Read() && r == DialogResult.Cancel) + { + //无需任何操作 + } + /* else if(i2 < 0)//这个就是i2没有执行成功后来到这里 + { + MessageBox.Show("图书库存不足"); + }*/ + else + { + MessageBox.Show("你已经借阅了该图书!"); + } + } + + private void Form3_Load(object sender, EventArgs e) + { + + } + + private void 我的借阅ToolStripMenuItem_Click(object sender, EventArgs e) + { + Form31 f = new Form31(SID); + f.Show(); //打开form31窗口 + } + + private void 搜索图书ToolStripMenuItem_Click(object sender, EventArgs e) + { + string B = textBox1.Text; + string C = comboBox1.Text;//图书类型 + Form32 f = new Form32(SID, B, C); + f.Show(); //打开form32窗口 + } + private void 退出当前账号ToolStripMenuItem_Click(object sender, EventArgs e) + { + DialogResult hh = MessageBox.Show(" 是否确定退出当前账号", "提示", MessageBoxButtons.OKCancel); + if(hh == DialogResult.OK) + { + Form1 form1 = new Form1(); + form1.Show(); + this.Hide(); + } + else + { + //无需任何操作 + } + } + } +} diff --git a/Book_manger/Sql/Form3.resx b/Book_manger/Sql/Form3.resx new file mode 100644 index 0000000..fef3f7f --- /dev/null +++ b/Book_manger/Sql/Form3.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 182, 17 + + + 348, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Book_manger/Sql/Form31.Designer.cs b/Book_manger/Sql/Form31.Designer.cs new file mode 100644 index 0000000..ddaedc6 --- /dev/null +++ b/Book_manger/Sql/Form31.Designer.cs @@ -0,0 +1,177 @@ + +namespace Sql +{ + partial class Form31 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.取消借阅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.取消借阅ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 36); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // 取消借阅ToolStripMenuItem + // + this.取消借阅ToolStripMenuItem.Name = "取消借阅ToolStripMenuItem"; + this.取消借阅ToolStripMenuItem.Size = new System.Drawing.Size(98, 30); + this.取消借阅ToolStripMenuItem.Text = "归还此书"; + this.取消借阅ToolStripMenuItem.Click += new System.EventHandler(this.取消借阅ToolStripMenuItem_Click); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 36); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.Size = new System.Drawing.Size(800, 414); + this.dataGridView1.TabIndex = 2; + // + // contextMenuStrip2 + // + this.contextMenuStrip2.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip2.Name = "contextMenuStrip2"; + this.contextMenuStrip2.Size = new System.Drawing.Size(61, 4); + // + // dataGridView2 + // + this.dataGridView2.AllowUserToAddRows = false; + this.dataGridView2.AllowUserToDeleteRows = false; + this.dataGridView2.AllowUserToOrderColumns = true; + this.dataGridView2.AllowUserToResizeColumns = false; + this.dataGridView2.AllowUserToResizeRows = false; + this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column3, + this.Column4}); + this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView2.Location = new System.Drawing.Point(0, 36); + this.dataGridView2.Name = "dataGridView2"; + this.dataGridView2.ReadOnly = true; + this.dataGridView2.RowHeadersVisible = false; + this.dataGridView2.RowHeadersWidth = 62; + this.dataGridView2.RowTemplate.Height = 30; + this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView2.Size = new System.Drawing.Size(800, 414); + this.dataGridView2.TabIndex = 4; + this.dataGridView2.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView2_CellContentClick); + // + // Column1 + // + this.Column1.HeaderText = "图书编号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "图书名称"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "借阅时间"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "应还日期"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Form31 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.dataGridView2); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form31"; + this.Text = "我的借阅"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 取消借阅ToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; + private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form31.cs b/Book_manger/Sql/Form31.cs new file mode 100644 index 0000000..5673325 --- /dev/null +++ b/Book_manger/Sql/Form31.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form31 : Form + { + string SID; + public Form31(string sID) + { + SID = sID; + InitializeComponent(); + Table(); + } + public void Table() //此私有类是将数据加载到窗体中 + { + dataGridView2.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + string sql = "select * from BookRecord where sID="+SID+""; //这个逻辑是查找借阅表中的学号,然后找到学号对应的书籍,将书籍展示出来 + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + while (dr.Read()) + { +/* string cID = dr["cID"].ToString(); + string sql2 = "select * from Book where Id='" + cID + "'"; + IDataReader dr2 = dao.read(sql2); + dr2.Read();*/ + string a, b, c, d ; + a = dr["BookId"].ToString(); //这例可以自己修改 + b = dr["BookName"].ToString(); + c = dr["jytime"].ToString(); + d = dr["ghtime"].ToString(); + //e = dr["SID"].ToString(); // 不用展示学号sid了 + string[] str = { a, b, c, d}; + dataGridView2.Rows.Add(str); //添加数据 + + } + dr.Close();//关闭连接 + } + private void 取消借阅ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (dataGridView2.Rows.Count == 0) //判断是否为空 + { + MessageBox.Show("你当前还没有借阅任何图书"); + } + else + { + DialogResult hh = MessageBox.Show(" 是否归还此书", "提示", MessageBoxButtons.OKCancel); + if (hh == DialogResult.OK) + { + string BookId = dataGridView2.SelectedCells[0].Value.ToString(); //注意dataGridView2要与所选窗口对应 + string sql = "delete BookRecord where sID='" + SID + "'and BookId='" + BookId + "'"; //思考一下双引号与单引号的用法 + Dao dao = new Dao(); + dao.Execute(sql); + string sql2 = "UPDATE Book SET Count = Count+1 WHERE Id = " + BookId + " "; + Dao dao2 = new Dao(); + dao.Execute(sql2); + Table(); + } + else + { + //不执行任何操作 + } + } + } + + private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form31.resx b/Book_manger/Sql/Form31.resx new file mode 100644 index 0000000..f14096a --- /dev/null +++ b/Book_manger/Sql/Form31.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 182, 17 + + + 414, 17 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Book_manger/Sql/Form311.Designer.cs b/Book_manger/Sql/Form311.Designer.cs new file mode 100644 index 0000000..5817744 --- /dev/null +++ b/Book_manger/Sql/Form311.Designer.cs @@ -0,0 +1,250 @@ + +namespace Sql +{ + partial class Form311 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.添加图书ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.删除图书ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.修改图书信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.menuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.AllowUserToOrderColumns = true; + this.dataGridView1.AllowUserToResizeColumns = false; + this.dataGridView1.AllowUserToResizeRows = false; + this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column3, + this.Column4, + this.Column5, + this.Column6, + this.Column7, + this.Column8}); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 32); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView1.Size = new System.Drawing.Size(800, 387); + this.dataGridView1.TabIndex = 5; + this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.添加图书ToolStripMenuItem, + this.删除图书ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 32); + this.menuStrip1.TabIndex = 3; + this.menuStrip1.Text = "menuStrip1"; + // + // 添加图书ToolStripMenuItem + // + this.添加图书ToolStripMenuItem.Name = "添加图书ToolStripMenuItem"; + this.添加图书ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.添加图书ToolStripMenuItem.Text = "添加图书"; + this.添加图书ToolStripMenuItem.Click += new System.EventHandler(this.添加图书ToolStripMenuItem_Click); + // + // 删除图书ToolStripMenuItem + // + this.删除图书ToolStripMenuItem.Name = "删除图书ToolStripMenuItem"; + this.删除图书ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.删除图书ToolStripMenuItem.Text = "删除图书"; + this.删除图书ToolStripMenuItem.Click += new System.EventHandler(this.删除图书ToolStripMenuItem_Click); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.toolStripStatusLabel3, + this.toolStripStatusLabel2}); + this.statusStrip1.Location = new System.Drawing.Point(0, 419); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(800, 31); + this.statusStrip1.TabIndex = 4; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(208, 24); + this.toolStripStatusLabel1.Text = "欢迎使用图书馆管理系统"; + // + // toolStripStatusLabel3 + // + this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; + this.toolStripStatusLabel3.Size = new System.Drawing.Size(160, 24); + this.toolStripStatusLabel3.Text = " "; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(52, 24); + this.toolStripStatusLabel2.Text = "Time"; + // + // timer1 + // + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // 修改图书信息ToolStripMenuItem + // + this.修改图书信息ToolStripMenuItem.Name = "修改图书信息ToolStripMenuItem"; + this.修改图书信息ToolStripMenuItem.Size = new System.Drawing.Size(32, 19); + this.修改图书信息ToolStripMenuItem.Text = "修改图书信息"; + // + // Column1 + // + this.Column1.HeaderText = "图书编号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "图书名称"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "作者"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "出版日期"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Column5 + // + this.Column5.HeaderText = "图书数量"; + this.Column5.MinimumWidth = 8; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + // + // Column6 + // + this.Column6.HeaderText = "出版社"; + this.Column6.MinimumWidth = 8; + this.Column6.Name = "Column6"; + this.Column6.ReadOnly = true; + // + // Column7 + // + this.Column7.HeaderText = "图书类型"; + this.Column7.MinimumWidth = 8; + this.Column7.Name = "Column7"; + this.Column7.ReadOnly = true; + // + // Column8 + // + this.Column8.HeaderText = "图书状态"; + this.Column8.MinimumWidth = 8; + this.Column8.Name = "Column8"; + this.Column8.ReadOnly = true; + // + // Form311 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.menuStrip1); + this.Controls.Add(this.statusStrip1); + this.Name = "Form311"; + this.Text = "图书信息管理"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 添加图书ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 删除图书ToolStripMenuItem; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.ToolStripMenuItem 修改图书信息ToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; + private System.Windows.Forms.DataGridViewTextBoxColumn Column6; + private System.Windows.Forms.DataGridViewTextBoxColumn Column7; + private System.Windows.Forms.DataGridViewTextBoxColumn Column8; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form311.cs b/Book_manger/Sql/Form311.cs new file mode 100644 index 0000000..fc26e26 --- /dev/null +++ b/Book_manger/Sql/Form311.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form311 : Form + { + public Form311() + { + InitializeComponent(); + toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + timer1.Start(); + Table(); + } + + public void Table() //此私有类是将数据加载到窗体中 + { + dataGridView1.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + string sql = "select * from Book"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + while (dr.Read()) + { + string a, b, c, d, e, f, g, h; + a = dr["Id"].ToString(); //将数据加入到表中 + b = dr["Name"].ToString(); + c = dr["Author"].ToString(); + d = dr["DOP"].ToString(); + e = dr["Count"].ToString(); + f = dr["Publisher"].ToString(); + g = dr["Category"].ToString(); + h = dr["State"].ToString(); + string[] str = { a, b, c, d, e, f, g, h }; + dataGridView1.Rows.Add(str); //添加数据 + } + dr.Close();//关闭连接 + } + + private void timer1_Tick(object sender, EventArgs e) + { + toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + private void 添加图书ToolStripMenuItem_Click(object sender, EventArgs e) + { + Form312 f = new Form312(this); + f.ShowDialog(); + } + + private void 删除图书ToolStripMenuItem_Click(object sender, EventArgs e) + { + DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + string id, name; + id = dataGridView1.SelectedCells[0].Value.ToString(); + name = dataGridView1.SelectedCells[1].Value.ToString(); + string sql = "delete from Book where Id='" + id + "'and Name='" + name + "'"; + MessageBox.Show("已删除图书——" + name + ""); + Dao dao = new Dao(); + dao.Execute(sql); + Table(); //调用36行的私有类函数实现刷新表的功能 + } + } + + private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form311.resx b/Book_manger/Sql/Form311.resx new file mode 100644 index 0000000..1d4ee3c --- /dev/null +++ b/Book_manger/Sql/Form311.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 57, 18 + + + 222, 18 + + + 388, 18 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form312.Designer.cs b/Book_manger/Sql/Form312.Designer.cs new file mode 100644 index 0000000..f8b8a17 --- /dev/null +++ b/Book_manger/Sql/Form312.Designer.cs @@ -0,0 +1,412 @@ + +namespace Sql +{ + partial class Form312 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button7 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.button3 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.textBox7 = new System.Windows.Forms.TextBox(); + this.textBox8 = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button7 + // + this.button7.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button7.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button7.Location = new System.Drawing.Point(382, 143); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(36, 40); + this.button7.TabIndex = 31; + this.button7.Text = "X"; + this.button7.UseVisualStyleBackColor = false; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button6 + // + this.button6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(378, 96); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(36, 40); + this.button6.TabIndex = 30; + this.button6.Text = "X"; + this.button6.UseVisualStyleBackColor = false; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button5 + // + this.button5.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button5.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button5.Location = new System.Drawing.Point(378, 56); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(36, 40); + this.button5.TabIndex = 29; + this.button5.Text = "X"; + this.button5.UseVisualStyleBackColor = false; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button4 + // + this.button4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button4.Location = new System.Drawing.Point(378, 7); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(36, 40); + this.button4.TabIndex = 28; + this.button4.Text = "X"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(233, 435); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(165, 44); + this.button2.TabIndex = 26; + this.button2.Text = "退出"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(19, 435); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(95, 44); + this.button1.TabIndex = 25; + this.button1.Text = "添加"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(157, 143); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(219, 39); + this.textBox4.TabIndex = 24; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(157, 98); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(219, 39); + this.textBox3.TabIndex = 23; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(157, 56); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(219, 39); + this.textBox2.TabIndex = 22; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(157, 9); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(219, 39); + this.textBox1.TabIndex = 21; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(12, 140); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(152, 28); + this.label4.TabIndex = 20; + this.label4.Text = "出版日期:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(70, 98); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(96, 28); + this.label3.TabIndex = 19; + this.label3.Text = "作者:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(12, 56); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(152, 28); + this.label2.TabIndex = 18; + this.label2.Text = "图书名称:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(152, 28); + this.label1.TabIndex = 17; + this.label1.Text = "图书编号:"; + // + // textBox5 + // + this.textBox5.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox5.Location = new System.Drawing.Point(157, 188); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(219, 39); + this.textBox5.TabIndex = 32; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(-1, 191); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(152, 28); + this.label5.TabIndex = 33; + this.label5.Text = "图书数量:"; + // + // button3 + // + this.button3.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button3.Location = new System.Drawing.Point(382, 189); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(36, 40); + this.button3.TabIndex = 34; + this.button3.Text = "X"; + this.button3.UseVisualStyleBackColor = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button8 + // + this.button8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button8.Location = new System.Drawing.Point(120, 435); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(95, 44); + this.button8.TabIndex = 35; + this.button8.Text = "修改"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(27, 232); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(124, 28); + this.label6.TabIndex = 36; + this.label6.Text = "出版社:"; + this.label6.Click += new System.EventHandler(this.label6_Click); + // + // textBox6 + // + this.textBox6.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox6.Location = new System.Drawing.Point(157, 229); + this.textBox6.Name = "textBox6"; + this.textBox6.Size = new System.Drawing.Size(219, 39); + this.textBox6.TabIndex = 37; + // + // textBox7 + // + this.textBox7.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox7.Location = new System.Drawing.Point(157, 284); + this.textBox7.Name = "textBox7"; + this.textBox7.Size = new System.Drawing.Size(219, 39); + this.textBox7.TabIndex = 38; + // + // textBox8 + // + this.textBox8.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox8.Location = new System.Drawing.Point(157, 341); + this.textBox8.Name = "textBox8"; + this.textBox8.Size = new System.Drawing.Size(219, 39); + this.textBox8.TabIndex = 39; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.Location = new System.Drawing.Point(14, 287); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(152, 28); + this.label7.TabIndex = 40; + this.label7.Text = "图书类型:"; + this.label7.Click += new System.EventHandler(this.label7_Click); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(12, 352); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(152, 28); + this.label8.TabIndex = 41; + this.label8.Text = "图书状态:"; + // + // button9 + // + this.button9.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button9.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button9.Location = new System.Drawing.Point(382, 341); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(36, 40); + this.button9.TabIndex = 42; + this.button9.Text = "X"; + this.button9.UseVisualStyleBackColor = false; + // + // button10 + // + this.button10.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button10.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button10.Location = new System.Drawing.Point(382, 287); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(36, 40); + this.button10.TabIndex = 43; + this.button10.Text = "X"; + this.button10.UseVisualStyleBackColor = false; + // + // button11 + // + this.button11.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button11.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button11.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button11.Location = new System.Drawing.Point(382, 235); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(36, 40); + this.button11.TabIndex = 44; + this.button11.Text = "X"; + this.button11.UseVisualStyleBackColor = false; + // + // Form312 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(428, 544); + this.Controls.Add(this.button11); + this.Controls.Add(this.button10); + this.Controls.Add(this.button9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.textBox8); + this.Controls.Add(this.textBox7); + this.Controls.Add(this.textBox6); + this.Controls.Add(this.label6); + this.Controls.Add(this.button8); + this.Controls.Add(this.button3); + this.Controls.Add(this.label5); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximumSize = new System.Drawing.Size(450, 600); + this.MinimumSize = new System.Drawing.Size(450, 600); + this.Name = "Form312"; + this.Text = "图书信息管理"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.TextBox textBox7; + private System.Windows.Forms.TextBox textBox8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button11; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form312.cs b/Book_manger/Sql/Form312.cs new file mode 100644 index 0000000..c5ae7e5 --- /dev/null +++ b/Book_manger/Sql/Form312.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form312 : Form + { + Form311 form311; + string[] str = new string[4]; //定义范围,只许多不能少 + public Form312(Form311 f) + { + InitializeComponent(); + form311 = f; + } + private void button2_Click(object sender, EventArgs e) + { + + if (button1.Visible == false) + { + Close(); + } + else if (textBox1.Text != "" || textBox2.Text != "" || textBox3.Text != "" || textBox4.Text != ""|| textBox5.Text == "") + { + DialogResult r = MessageBox.Show("退出后当前输入内容不会保存", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Close(); + } + } + else + { + Close(); + } + } + private void button1_Click(object sender, EventArgs e) + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == ""|| textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "") + { + MessageBox.Show("输入不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + else + { + string sql = "Insert into Book(Id,Name,Author,DOP,Count,Publisher,Category,State) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "')"; + //判断是否有书号重复的,重复则禁止添加 + string ID = "select * from Book"; + int b = 1; + Dao doo = new Dao(); + IDataReader drr = doo.read(ID); + while (drr.Read()) + { + string a; + a = drr["Id"].ToString(); + if (a == textBox1.Text) + { + MessageBox.Show("图书编号为" + textBox1.Text + "的图书已经存在\n 请重新添加"); + b = 0; + break; + } + } + drr.Close();//关闭连接 + if (b != 0) + { + DialogResult r = MessageBox.Show(" 是否确认添加", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Dao dao = new Dao(); + int i = dao.Execute(sql); + if (i > 0) + { + MessageBox.Show("添加成功"); + textBox1.Text = null; //添加后归空,方便再次添加 + textBox2.Text = null; + textBox3.Text = null; + textBox4.Text = null; + textBox5.Text = null; + + } + form311.Table(); //实现实时刷新表 + } + } + + //判断是否有图书编号重复的,重复则禁止添加 + } + } + + private void button8_Click(object sender, EventArgs e) + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "") + { + MessageBox.Show("输入不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + string sq = "update Book set Id='" + textBox1.Text + "', Name='" + textBox2.Text + "', Author='" + textBox3.Text + "', DOP='" + textBox4.Text + "', Count='" + textBox5.Text + "', Publisher='" + textBox6.Text + "', Count='" + textBox7.Text + "', Count='" + textBox8.Text + "' where Id='" + textBox1.Text + "'"; + Dao da = new Dao(); + da.Execute(sq); //执行更新对应书籍信息的操作 + MessageBox.Show("修改书籍成功"); + Close(); + } + + } + private void button4_Click(object sender, EventArgs e) + { + textBox1.Text = null; + } + + private void button5_Click(object sender, EventArgs e) + { + textBox2.Text = null; + } + + private void button6_Click(object sender, EventArgs e) + { + textBox3.Text = null; + } + + private void button7_Click(object sender, EventArgs e) + { + textBox4.Text = null; + } + + private void button3_Click(object sender, EventArgs e) + { + textBox5.Text = null; + } + + private void label6_Click(object sender, EventArgs e) + { + + } + + private void label7_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form312.resx b/Book_manger/Sql/Form312.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Book_manger/Sql/Form312.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form32.Designer.cs b/Book_manger/Sql/Form32.Designer.cs new file mode 100644 index 0000000..86cff14 --- /dev/null +++ b/Book_manger/Sql/Form32.Designer.cs @@ -0,0 +1,216 @@ + +namespace Sql +{ + partial class Form32 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.借阅此书ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.借阅此书ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 32); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // contextMenuStrip1 + // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 32); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.Size = new System.Drawing.Size(800, 418); + this.dataGridView1.TabIndex = 2; + // + // contextMenuStrip2 + // + this.contextMenuStrip2.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip2.Name = "contextMenuStrip2"; + this.contextMenuStrip2.Size = new System.Drawing.Size(61, 4); + // + // dataGridView2 + // + this.dataGridView2.AllowUserToAddRows = false; + this.dataGridView2.AllowUserToDeleteRows = false; + this.dataGridView2.AllowUserToOrderColumns = true; + this.dataGridView2.AllowUserToResizeColumns = false; + this.dataGridView2.AllowUserToResizeRows = false; + this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column3, + this.Column4, + this.Column5, + this.Column6, + this.Column7, + this.Column8}); + this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView2.Location = new System.Drawing.Point(0, 32); + this.dataGridView2.Name = "dataGridView2"; + this.dataGridView2.ReadOnly = true; + this.dataGridView2.RowHeadersVisible = false; + this.dataGridView2.RowHeadersWidth = 62; + this.dataGridView2.RowTemplate.Height = 30; + this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView2.Size = new System.Drawing.Size(800, 418); + this.dataGridView2.TabIndex = 4; + this.dataGridView2.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView2_CellContentClick); + // + // Column1 + // + this.Column1.HeaderText = "图书编号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "图书名称"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "图书作者"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "出版日期"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Column5 + // + this.Column5.HeaderText = "图书库存"; + this.Column5.MinimumWidth = 8; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + // + // Column6 + // + this.Column6.HeaderText = "出版社"; + this.Column6.MinimumWidth = 8; + this.Column6.Name = "Column6"; + this.Column6.ReadOnly = true; + // + // Column7 + // + this.Column7.HeaderText = "图书类型"; + this.Column7.MinimumWidth = 8; + this.Column7.Name = "Column7"; + this.Column7.ReadOnly = true; + // + // Column8 + // + this.Column8.HeaderText = "是否可借"; + this.Column8.MinimumWidth = 8; + this.Column8.Name = "Column8"; + this.Column8.ReadOnly = true; + // + // 借阅此书ToolStripMenuItem + // + this.借阅此书ToolStripMenuItem.Name = "借阅此书ToolStripMenuItem"; + this.借阅此书ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.借阅此书ToolStripMenuItem.Text = "借阅此书"; + this.借阅此书ToolStripMenuItem.Click += new System.EventHandler(this.借阅此书ToolStripMenuItem_Click); + // + // Form32 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.dataGridView2); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form32"; + this.Text = "搜索结果"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; + private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; + private System.Windows.Forms.DataGridViewTextBoxColumn Column6; + private System.Windows.Forms.DataGridViewTextBoxColumn Column7; + private System.Windows.Forms.DataGridViewTextBoxColumn Column8; + private System.Windows.Forms.ToolStripMenuItem 借阅此书ToolStripMenuItem; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form32.cs b/Book_manger/Sql/Form32.cs new file mode 100644 index 0000000..507b4ff --- /dev/null +++ b/Book_manger/Sql/Form32.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form32 : Form + { + string SID,bookname,category; + public Form32(string sID,string bookname,string category) + { + SID = sID; + InitializeComponent(); + Table(bookname,category); + } + public void Table(string bookname,string category) //此私有类是将数据加载到窗体中 + { + dataGridView2.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + + string sql = "select * from Book where Name like '%"+bookname+ "%' and category like '%" + category + "%'"; //这个逻辑是查找借阅表中的学号,然后找到学号对应的书籍,将书籍展示出来 + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + while (dr.Read()) + { + string a, b, c, d, e, f, g, h ; + a = dr["Id"].ToString(); //这例可以自己修改 + b = dr["Name"].ToString(); + c = dr["Author"].ToString(); + d = dr["DOP"].ToString(); + e = dr["Count"].ToString(); // 不用展示学号sid了 + f = dr["Publisher"].ToString(); + g = dr["Category"].ToString(); + h = dr["State"].ToString(); + string[] str = { a, b, c, d, e, f, g, h}; + dataGridView2.Rows.Add(str); //添加数据 + + } + dr.Close();//关闭连接 + } + private void 借阅此书ToolStripMenuItem_Click(object sender, EventArgs e) + { + string BookId = dataGridView2.SelectedCells[0].Value.ToString();//获取选中的图书号 + string sql1 = "select * from BookRecord where sID='" + SID + "'and BookId='" + BookId + "'";//查询是否已经借阅了这本书 + Dao dao = new Dao(); + IDataReader dc = dao.read(sql1); //IDataReader是什么意思?是可以进行数据库操作的对象的意思 + DialogResult r = MessageBox.Show("是否确认借阅", "提示", MessageBoxButtons.OKCancel); + + if (!dc.Read() && r == DialogResult.OK) + { + string sql5 = "select Count from BookRecord where sID='" + SID + "'";//查询该同学借阅了多少书籍 + Dao dao5 = new Dao(); + IDataReader dc5 = dao.read(sql5); + dc5.Read(); + string bcount = dc5["Count"].ToString();//bcount借过的图书数量 + string s2 = "5"; + + if (s2.CompareTo(bcount) == 1)//5和借阅数量比较,首先5大,然后成立,bcount+1,一直加假如5=5,那么不给再继续借了 + { + + + //这里要加一个查询book表的代码 + string BId = dataGridView2.SelectedCells[0].Value.ToString(); + string Author = dataGridView2.SelectedCells[1].Value.ToString(); + string Count = dataGridView2.SelectedCells[4].Value.ToString(); + string jytime = DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss"); + string ghtime = DateTime.Now.AddMonths(3).ToString("yyyy - MM - dd HH: mm:ss"); + string sql2 = "update Book set Count = '" + Count + "' - 1 WHERE Id = '" + BId + "' "; + int i2 = dao.Execute(sql2); + + if (i2 > 0)//图书数量大于的话就执行下面的 + { + string sql = "insert into BookRecord(BookId,BookName,jytime,ghtime ,SID ) values('" + BId + "','" + Author + "','" + jytime + "','" + ghtime + "','" + SID + "')"; + int i = dao.Execute(sql); + string sql3 = "UPDATE BookRecord SET Count = Count+1 WHERE SID = " + SID + " "; + int i3 = dao.Execute(sql3);//更新图书记录表,给相应用户的图书数量+1 + MessageBox.Show("借阅成功"); + } + else + { + MessageBox.Show("图书库存不足!"); + } + } + else + { + MessageBox.Show("借阅数量已达五本,请先还书再借阅!"); + } + } + else if (!dc.Read() && r == DialogResult.Cancel) + { + //无需任何操作 + } + /* else if(i2 < 0)//这个就是i2没有执行成功后来到这里 + { + MessageBox.Show("图书库存不足"); + }*/ + else + { + MessageBox.Show("你已经借阅了该图书!"); + } + } + + private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form32.resx b/Book_manger/Sql/Form32.resx new file mode 100644 index 0000000..2b8eb42 --- /dev/null +++ b/Book_manger/Sql/Form32.resx @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 182, 17 + + + 414, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Book_manger/Sql/Form4.Designer.cs b/Book_manger/Sql/Form4.Designer.cs new file mode 100644 index 0000000..a8fc523 --- /dev/null +++ b/Book_manger/Sql/Form4.Designer.cs @@ -0,0 +1,312 @@ + +namespace Sql +{ + partial class Form4 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.系统ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.信息管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.添加预约信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.修改预约信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.删除预约信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.menuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.系统ToolStripMenuItem, + this.信息管理ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 32); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // 系统ToolStripMenuItem + // + this.系统ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.退出ToolStripMenuItem}); + this.系统ToolStripMenuItem.Name = "系统ToolStripMenuItem"; + this.系统ToolStripMenuItem.Size = new System.Drawing.Size(62, 28); + this.系统ToolStripMenuItem.Text = "系统"; + // + // 退出ToolStripMenuItem + // + this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(182, 34); + this.退出ToolStripMenuItem.Text = "退出系统"; + this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); + // + // 信息管理ToolStripMenuItem + // + this.信息管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.添加预约信息ToolStripMenuItem, + this.修改预约信息ToolStripMenuItem, + this.删除预约信息ToolStripMenuItem}); + this.信息管理ToolStripMenuItem.Name = "信息管理ToolStripMenuItem"; + this.信息管理ToolStripMenuItem.Size = new System.Drawing.Size(98, 28); + this.信息管理ToolStripMenuItem.Text = "信息管理"; + // + // 添加预约信息ToolStripMenuItem + // + this.添加预约信息ToolStripMenuItem.Name = "添加预约信息ToolStripMenuItem"; + this.添加预约信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.添加预约信息ToolStripMenuItem.Text = "添加预约信息"; + this.添加预约信息ToolStripMenuItem.Click += new System.EventHandler(this.添加预约信息ToolStripMenuItem_Click); + // + // 修改预约信息ToolStripMenuItem + // + this.修改预约信息ToolStripMenuItem.Name = "修改预约信息ToolStripMenuItem"; + this.修改预约信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.修改预约信息ToolStripMenuItem.Text = "修改预约信息"; + this.修改预约信息ToolStripMenuItem.Click += new System.EventHandler(this.修改预约信息ToolStripMenuItem_Click); + // + // 删除预约信息ToolStripMenuItem + // + this.删除预约信息ToolStripMenuItem.Name = "删除预约信息ToolStripMenuItem"; + this.删除预约信息ToolStripMenuItem.Size = new System.Drawing.Size(218, 34); + this.删除预约信息ToolStripMenuItem.Text = "删除预约信息"; + this.删除预约信息ToolStripMenuItem.Click += new System.EventHandler(this.删除预约信息ToolStripMenuItem_Click); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.toolStripStatusLabel2, + this.toolStripStatusLabel3}); + this.statusStrip1.Location = new System.Drawing.Point(0, 419); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(800, 31); + this.statusStrip1.TabIndex = 5; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(190, 24); + this.toolStripStatusLabel1.Text = "欢迎登陆图书管理系统"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(0, 24); + // + // toolStripStatusLabel3 + // + this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; + this.toolStripStatusLabel3.Size = new System.Drawing.Size(52, 24); + this.toolStripStatusLabel3.Text = "Time"; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.AllowUserToOrderColumns = true; + this.dataGridView1.AllowUserToResizeColumns = false; + this.dataGridView1.AllowUserToResizeRows = false; + this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Column1, + this.Column2, + this.Column4, + this.Column3}); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 65); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowHeadersWidth = 62; + this.dataGridView1.RowTemplate.Height = 30; + this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView1.Size = new System.Drawing.Size(800, 354); + this.dataGridView1.TabIndex = 6; + // + // Column1 + // + this.Column1.HeaderText = "座位号"; + this.Column1.MinimumWidth = 8; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + // + // Column2 + // + this.Column2.HeaderText = "姓名"; + this.Column2.MinimumWidth = 8; + this.Column2.Name = "Column2"; + this.Column2.ReadOnly = true; + // + // Column4 + // + this.Column4.HeaderText = "预约时间"; + this.Column4.MinimumWidth = 8; + this.Column4.Name = "Column4"; + this.Column4.ReadOnly = true; + // + // Column3 + // + this.Column3.HeaderText = "账户密码"; + this.Column3.MinimumWidth = 8; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::Sql.Properties.Resources.OIP__1_; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(34, 28); + this.toolStripButton1.Text = "添加信息"; + this.toolStripButton1.ToolTipText = "添加预约信息"; + this.toolStripButton1.Click += new System.EventHandler(this.添加预约信息ToolStripMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::Sql.Properties.Resources._8ae4ff6e_E773664_ab5bd2c5; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(34, 28); + this.toolStripButton2.Text = "删除信息"; + this.toolStripButton2.ToolTipText = "删除预约信息"; + this.toolStripButton2.Click += new System.EventHandler(this.删除预约信息ToolStripMenuItem_Click); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::Sql.Properties.Resources._9b554143b1bcd74106747ab848ca280f; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(34, 28); + this.toolStripButton3.Text = "修改信息"; + this.toolStripButton3.ToolTipText = "修改预约信息"; + this.toolStripButton3.Click += new System.EventHandler(this.修改预约信息ToolStripMenuItem_Click); + // + // toolStrip1 + // + this.toolStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripButton3, + this.toolStripButton4}); + this.toolStrip1.Location = new System.Drawing.Point(0, 32); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(800, 33); + this.toolStrip1.TabIndex = 2; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton4 + // + this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton4.Image = global::Sql.Properties.Resources.t01b34dced1b5dbeaac; + this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton4.Name = "toolStripButton4"; + this.toolStripButton4.Size = new System.Drawing.Size(34, 28); + this.toolStripButton4.Text = "toolStripButton4"; + // + // Form4 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.menuStrip1); + this.Name = "Form4"; + this.Text = "座位预约管理页面"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 系统ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 信息管理ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 添加预约信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 修改预约信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 删除预约信息ToolStripMenuItem; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButton4; + private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column4; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form4.cs b/Book_manger/Sql/Form4.cs new file mode 100644 index 0000000..a5a4daa --- /dev/null +++ b/Book_manger/Sql/Form4.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form4 : Form + { + public Form4() + { + InitializeComponent(); + toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + timer1.Start(); + Table(); + } + + private void timer1_Tick(object sender, EventArgs e) + { + toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + //定义表 + public void Table() + { + dataGridView1.Rows.Clear(); //清除前面的数据,方便后面重新刷新数据 + string sql = "select * from seat"; + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + while (dr.Read()) + { + string a, b, c, d; + a = dr["Id"].ToString(); //这例可以自己修改 + b = dr["Name"].ToString(); + c = dr["Time"].ToString(); + d = dr["Password"].ToString(); + string[] str = { a, b, c, d }; + dataGridView1.Rows.Add(str); //添加数据 + } + dr.Close();//关闭连接 + } + //添加 + private void 添加预约信息ToolStripMenuItem_Click(object sender, EventArgs e) + { + Form41 f = new Form41(this); //调用form41中的函数 + f.ShowDialog(); + } + //修改 + private void 修改预约信息ToolStripMenuItem_Click(object sender, EventArgs e) + { + string[] str = { dataGridView1.SelectedCells[0].Value.ToString(), dataGridView1.SelectedCells[1].Value.ToString(), dataGridView1.SelectedCells[2].Value.ToString(), dataGridView1.SelectedCells[3].Value.ToString() }; + // MessageBox.Show(str[0]+str[4]); + Form41 f = new Form41(str, this); + f.ShowDialog(); + } + //删除 + private void 删除预约信息ToolStripMenuItem_Click(object sender, EventArgs e) + { + DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + string id, name; + id = dataGridView1.SelectedCells[0].Value.ToString(); + name = dataGridView1.SelectedCells[1].Value.ToString(); + string sql = "delete from seat where Id='" + id + "'and Name='" + name + "'"; + MessageBox.Show("已删除座位——" + name + ""); + Dao dao = new Dao(); + dao.Execute(sql); + Table(); //调用36行的私有类函数实现刷新表的功能 + } + } + + private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void toolStripButton4_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Book_manger/Sql/Form4.resx b/Book_manger/Sql/Form4.resx new file mode 100644 index 0000000..2b9c7a3 --- /dev/null +++ b/Book_manger/Sql/Form4.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 327, 27 + + + 507, 24 + + + True + + + True + + + True + + + True + + + 170, 24 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form41.Designer.cs b/Book_manger/Sql/Form41.Designer.cs new file mode 100644 index 0000000..739bbf4 --- /dev/null +++ b/Book_manger/Sql/Form41.Designer.cs @@ -0,0 +1,251 @@ + +namespace Sql +{ + partial class Form41 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.button4 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(250, 330); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(139, 44); + this.button2.TabIndex = 23; + this.button2.Text = "退出"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(31, 330); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(139, 44); + this.button1.TabIndex = 22; + this.button1.Text = "添加"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(170, 251); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(219, 39); + this.textBox4.TabIndex = 20; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(170, 177); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(219, 39); + this.textBox3.TabIndex = 19; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(170, 103); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(219, 39); + this.textBox2.TabIndex = 18; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(170, 29); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(219, 39); + this.textBox1.TabIndex = 17; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(25, 254); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(96, 28); + this.label4.TabIndex = 15; + this.label4.Text = "预约时间:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(26, 179); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(96, 28); + this.label3.TabIndex = 14; + this.label3.Text = "密码:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(26, 104); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(96, 28); + this.label2.TabIndex = 13; + this.label2.Text = "姓名:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(26, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(96, 28); + this.label1.TabIndex = 12; + this.label1.Text = "座位号:"; + // + // button4 + // + this.button4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button4.Location = new System.Drawing.Point(395, 29); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(36, 40); + this.button4.TabIndex = 24; + this.button4.Text = "X"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button3 + // + this.button3.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button3.Location = new System.Drawing.Point(395, 104); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(36, 40); + this.button3.TabIndex = 25; + this.button3.Text = "X"; + this.button3.UseVisualStyleBackColor = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button5 + // + this.button5.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button5.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button5.Location = new System.Drawing.Point(395, 176); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(36, 40); + this.button5.TabIndex = 26; + this.button5.Text = "X"; + this.button5.UseVisualStyleBackColor = false; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 + // + this.button6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(395, 251); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(36, 40); + this.button6.TabIndex = 27; + this.button6.Text = "X"; + this.button6.UseVisualStyleBackColor = false; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 + // + this.button7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button7.Location = new System.Drawing.Point(31, 330); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(139, 44); + this.button7.TabIndex = 28; + this.button7.Text = "修改"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // Form41 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(441, 411); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button3); + this.Controls.Add(this.button4); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "Form41"; + this.Text = "座位信息"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form41.cs b/Book_manger/Sql/Form41.cs new file mode 100644 index 0000000..485e7b3 --- /dev/null +++ b/Book_manger/Sql/Form41.cs @@ -0,0 +1,197 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form41 : Form + { + + Form4 form4; + string[] str = new string[4]; //定义范围,只许多不能少 + public Form41(Form4 f) + { + InitializeComponent(); + button7.Visible = false; //隐藏修改按钮 + form4 = f; + } + public Form41(string[] a, Form4 f) //6 + { + InitializeComponent(); + for (int i = 0; i < 4; i++) + { + str[i] = a[i]; + + } + textBox1.Text = str[0]; + textBox2.Text = str[1]; + textBox3.Text = str[2]; + textBox4.Text = str[3]; + button1.Visible = false; //隐藏保存按钮 + form4 = f; + + } + private void button4_Click(object sender, EventArgs e) + { + textBox1.Text = null; + } + + private void button3_Click(object sender, EventArgs e) + { + textBox2.Text = null; + } + + private void button5_Click(object sender, EventArgs e) + { + textBox3.Text = null; + } + + private void button6_Click(object sender, EventArgs e) + { + textBox4.Text = null; + } + + private void button2_Click(object sender, EventArgs e) + { + if (button1.Visible == false) + { + Close(); + } + else if (textBox1.Text != "" || textBox2.Text != "" || textBox3.Text != "" || textBox4.Text != "") + { + DialogResult r = MessageBox.Show("退出后当前输入内容不会保存", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Close(); + } + } + else + { + Close(); + } + } + //添加 + private void button1_Click(object sender, EventArgs e) + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "") + { + MessageBox.Show("输入不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + else + { + string sql = "Insert into seat values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; + //判断是否有工号重复的,重复则禁止添加 + string ID = "select * from seat"; + int b = 1; + Dao doo = new Dao(); + IDataReader drr = doo.read(ID); + while (drr.Read()) + { + string a; + a = drr["Id"].ToString(); + if (a == textBox1.Text) + { + MessageBox.Show("工号为" + textBox1.Text + "的座位已经存在\n 请重新添加"); + b = 0; + break; + } + } + drr.Close();//关闭连接 + if (b != 0) + { + DialogResult r = MessageBox.Show(" 是否确认添加", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + Dao dao = new Dao(); + int i = dao.Execute(sql); + if (i > 0) + { + MessageBox.Show("添加成功"); + textBox1.Text = null; //添加后归空,方便再次添加 + textBox2.Text = null; + textBox3.Text = null; + textBox4.Text = null; + } + form4.Table(); //实现实时刷新表 + } + } + + //判断是否有工号重复的,重复则禁止添加 + } + } + //修改 + private void button7_Click(object sender, EventArgs e) + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "") + { + MessageBox.Show("修改中有空项", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + //判断是否有工号重复的,重复则禁止添加 + string ID = "select * from seat"; + int b = 1; + Dao doo = new Dao(); + IDataReader drr = doo.read(ID); + while (drr.Read()) + { + string a; + a = drr["Id"].ToString(); + if (a == textBox1.Text) + { + MessageBox.Show("工号为" + textBox1.Text + "的座位已经存在请重新修改"); + b = 0; + break; + } + } + drr.Close();//关闭连接 + if (b != 0) + { + if (textBox1.Text != str[0]) + { + string sql = "update seat set Id='" + textBox1.Text + "'where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[0] = textBox1.Text; + } + if (textBox2.Text != str[1]) + { + string sql = "update seat set Name='" + textBox2.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[1] = textBox2.Text; + } + if (textBox3.Text != str[2]) + { + string sql = "update seat set ZC='" + textBox3.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[2] = textBox3.Text; + } + if (textBox4.Text != str[3]) + { + string sql = "update seat set Password='" + textBox4.Text + "' where Id='" + str[0] + "' and Name='" + str[1] + "'"; + Dao dao = new Dao(); + dao.Execute(sql); + str[3] = textBox4.Text; + } + DialogResult r = MessageBox.Show(" 是否确认修改", "提示", MessageBoxButtons.OKCancel); + if (r == DialogResult.OK) + { + form4.Table(); //实现实时刷新表 + Close(); + } + } + //判断是否有工号重复的,重复则禁止添加 + + } + } + } +} diff --git a/Book_manger/Sql/Form41.resx b/Book_manger/Sql/Form41.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Book_manger/Sql/Form41.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form5.Designer.cs b/Book_manger/Sql/Form5.Designer.cs new file mode 100644 index 0000000..b86b6a5 --- /dev/null +++ b/Book_manger/Sql/Form5.Designer.cs @@ -0,0 +1,92 @@ + +namespace Sql +{ + partial class Form5 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 21); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(218, 61); + this.button1.TabIndex = 0; + this.button1.Text = "学生信息管理"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(248, 21); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(218, 61); + this.button3.TabIndex = 2; + this.button3.Text = "图书信息管理"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(12, 88); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(218, 61); + this.button4.TabIndex = 3; + this.button4.Text = "修改学生密码"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // Form5 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImage = global::Sql.Properties.Resources._47c5011b53b6477dadd2b697626da63e_th; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.ClientSize = new System.Drawing.Size(478, 714); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button1); + this.MaximumSize = new System.Drawing.Size(500, 770); + this.MinimumSize = new System.Drawing.Size(500, 770); + this.Name = "Form5"; + this.Text = "管理员"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form5_FormClosed); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form5.cs b/Book_manger/Sql/Form5.cs new file mode 100644 index 0000000..5317180 --- /dev/null +++ b/Book_manger/Sql/Form5.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form5 : Form + { + public Form5() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e)//第一个按钮点击触发事件(学生信息管理) + { + Form2 form2 = new Form2();//展示form2 + form2.Show(); + } + + private void button2_Click(object sender, EventArgs e)//第二个按钮点击触发事件(座位预约管理) + { + Form4 form4 = new Form4(); + form4.Show(); + } + + private void button3_Click(object sender, EventArgs e)//第三个按钮点击触发事件(图书信息管理) + { + Form311 form311 = new Form311(); + form311.Show(); + } + + private void button4_Click(object sender, EventArgs e)//第四个按钮点击触发事件(修改账户密码) + { + Form51 form51 = new Form51(); + form51.Show(); + } + + private void Form5_FormClosed(object sender, FormClosedEventArgs e) + { + Application.Exit(); + } + } +} diff --git a/Book_manger/Sql/Form5.resx b/Book_manger/Sql/Form5.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Book_manger/Sql/Form5.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Book_manger/Sql/Form51.Designer.cs b/Book_manger/Sql/Form51.Designer.cs new file mode 100644 index 0000000..27bd4c1 --- /dev/null +++ b/Book_manger/Sql/Form51.Designer.cs @@ -0,0 +1,199 @@ + +namespace Sql +{ + partial class Form51 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button6 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button6 + // + this.button6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(379, 202); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(36, 40); + this.button6.TabIndex = 30; + this.button6.Text = "X"; + this.button6.UseVisualStyleBackColor = false; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button5 + // + this.button5.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button5.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button5.Location = new System.Drawing.Point(379, 109); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(36, 40); + this.button5.TabIndex = 29; + this.button5.Text = "X"; + this.button5.UseVisualStyleBackColor = false; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button4 + // + this.button4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button4.Location = new System.Drawing.Point(379, 17); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(36, 40); + this.button4.TabIndex = 28; + this.button4.Text = "X"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button3 + // + this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.Location = new System.Drawing.Point(20, 294); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(165, 44); + this.button3.TabIndex = 27; + this.button3.Text = "确定"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(250, 294); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(165, 44); + this.button2.TabIndex = 26; + this.button2.Text = "退出"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(158, 202); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(219, 39); + this.textBox3.TabIndex = 23; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(158, 110); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(219, 39); + this.textBox2.TabIndex = 22; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(158, 18); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(219, 39); + this.textBox1.TabIndex = 21; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(15, 205); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(152, 28); + this.label3.TabIndex = 19; + this.label3.Text = " 新密码:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(43, 113); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(124, 28); + this.label2.TabIndex = 18; + this.label2.Text = "旧密码:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(43, 21); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(124, 28); + this.label1.TabIndex = 17; + this.label1.Text = "姓名:"; + // + // Form51 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(448, 374); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximumSize = new System.Drawing.Size(470, 430); + this.MinimumSize = new System.Drawing.Size(470, 430); + this.Name = "Form51"; + this.Text = "Form51"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/Book_manger/Sql/Form51.cs b/Book_manger/Sql/Form51.cs new file mode 100644 index 0000000..bc92d59 --- /dev/null +++ b/Book_manger/Sql/Form51.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + public partial class Form51 : Form + { + public Form51() + { + InitializeComponent(); + } + + private void button4_Click(object sender, EventArgs e) + { + textBox1.Text = null; + } + + private void button5_Click(object sender, EventArgs e) + { + textBox2.Text = null; + } + + private void button6_Click(object sender, EventArgs e) + { + textBox3.Text = null; + } + + private void button3_Click(object sender, EventArgs e) + { + if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "") + { + MessageBox.Show("不能有空项", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + + string sql = "select * from Student where Name='" + textBox1.Text + "'";//查询学生表中姓名等于第一个框中所填的数据的学生行 + Dao dao = new Dao(); + IDataReader dr = dao.read(sql); + dr.Read(); //这一步非常重要,缺一不可,用于读取数据 + string a; + a = dr["Password"].ToString();//读取对应姓名的学生的密码是否和第二个框中的旧密码一致 + if ( textBox2.Text!=a) + { + MessageBox.Show("旧密码输入错误!"); + } + else + { + string sq = "update Student set Password=" + textBox3.Text + " where Name='" + textBox1.Text + "'";//如果写的旧密码正确,那么执行更新操作 + // MessageBox.Show(sq); + Dao da = new Dao(); + da.Execute(sq); //执行更新对应用户名密码的功能 +/* sq = "update Student set Password='" + textBox2.Text + "'"; + da.Execute(sq);*/ + MessageBox.Show("修改密码成功"); + Close(); + } + + } + } + + private void button2_Click(object sender, EventArgs e) + { + Close(); + } + } +} diff --git a/Book_manger/Sql/Form51.resx b/Book_manger/Sql/Form51.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Book_manger/Sql/Form51.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Book_manger/Sql/Program.cs b/Book_manger/Sql/Program.cs new file mode 100644 index 0000000..1047018 --- /dev/null +++ b/Book_manger/Sql/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sql +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread]//(单一线程单元线程) + static void Main()//上面的注释会让鼠标移到Main的时候显示注释内容 + { + Application.EnableVisualStyles();//此方法为应用程序启用可视样式。 + Application.SetCompatibleTextRenderingDefault(false); + //作用:在应用程序范围内设置控件显示文本的默认方式(可以设为使用新的GDI+ , 还是旧的GDI) + //true使用GDI + 方式显示文本, + //false使用GDI方式显示文本。 + Application.Run(new Form1());//在当前线程上开始运行标准应用程序消息循环。这里就是进入了Form1.cs的意思 + } + } +} diff --git a/Book_manger/Sql/Properties/AssemblyInfo.cs b/Book_manger/Sql/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0ba3064 --- /dev/null +++ b/Book_manger/Sql/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Sql")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Sql")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("db8ae64e-8d73-41ac-aee9-6e00747fe730")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Book_manger/Sql/Properties/Resources.Designer.cs b/Book_manger/Sql/Properties/Resources.Designer.cs new file mode 100644 index 0000000..aeabd0a --- /dev/null +++ b/Book_manger/Sql/Properties/Resources.Designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace Sql.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sql.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _281ff8591fc479d8efc38bc5bc03acdd { + get { + object obj = ResourceManager.GetObject("281ff8591fc479d8efc38bc5bc03acdd", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _47c5011b53b6477dadd2b697626da63e_th { + get { + object obj = ResourceManager.GetObject("47c5011b53b6477dadd2b697626da63e_th", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _8ae4ff6e_E773664_ab5bd2c5 { + get { + object obj = ResourceManager.GetObject("8ae4ff6e_E773664_ab5bd2c5", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _9b554143b1bcd74106747ab848ca280f { + get { + object obj = ResourceManager.GetObject("9b554143b1bcd74106747ab848ca280f", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap OIP__1_ { + get { + object obj = ResourceManager.GetObject("OIP (1)", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap t01b34dced1b5dbeaac { + get { + object obj = ResourceManager.GetObject("t01b34dced1b5dbeaac", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Book_manger/Sql/Properties/Resources.resx b/Book_manger/Sql/Properties/Resources.resx new file mode 100644 index 0000000..19b5912 --- /dev/null +++ b/Book_manger/Sql/Properties/Resources.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\281ff8591fc479d8efc38bc5bc03acdd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\9b554143b1bcd74106747ab848ca280f.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\OIP (1).jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\t01b34dced1b5dbeaac.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\8ae4ff6e_E773664_ab5bd2c5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\47c5011b53b6477dadd2b697626da63e_th.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Book_manger/Sql/Properties/Settings.Designer.cs b/Book_manger/Sql/Properties/Settings.Designer.cs new file mode 100644 index 0000000..56c6b11 --- /dev/null +++ b/Book_manger/Sql/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Sql.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Book_manger/Sql/Properties/Settings.settings b/Book_manger/Sql/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Book_manger/Sql/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Book_manger/Sql/Resources/281ff8591fc479d8efc38bc5bc03acdd.png b/Book_manger/Sql/Resources/281ff8591fc479d8efc38bc5bc03acdd.png new file mode 100644 index 0000000..13484ea Binary files /dev/null and b/Book_manger/Sql/Resources/281ff8591fc479d8efc38bc5bc03acdd.png differ diff --git a/Book_manger/Sql/Resources/47c5011b53b6477dadd2b697626da63e_th.jpg b/Book_manger/Sql/Resources/47c5011b53b6477dadd2b697626da63e_th.jpg new file mode 100644 index 0000000..0e5f4f1 Binary files /dev/null and b/Book_manger/Sql/Resources/47c5011b53b6477dadd2b697626da63e_th.jpg differ diff --git a/Book_manger/Sql/Resources/8ae4ff6e_E773664_ab5bd2c5.png b/Book_manger/Sql/Resources/8ae4ff6e_E773664_ab5bd2c5.png new file mode 100644 index 0000000..708b9d3 Binary files /dev/null and b/Book_manger/Sql/Resources/8ae4ff6e_E773664_ab5bd2c5.png differ diff --git a/Book_manger/Sql/Resources/9b554143b1bcd74106747ab848ca280f.jpg b/Book_manger/Sql/Resources/9b554143b1bcd74106747ab848ca280f.jpg new file mode 100644 index 0000000..313527e Binary files /dev/null and b/Book_manger/Sql/Resources/9b554143b1bcd74106747ab848ca280f.jpg differ diff --git a/Book_manger/Sql/Resources/OIP (1).jpg b/Book_manger/Sql/Resources/OIP (1).jpg new file mode 100644 index 0000000..f95ef77 Binary files /dev/null and b/Book_manger/Sql/Resources/OIP (1).jpg differ diff --git a/Book_manger/Sql/Resources/t01b34dced1b5dbeaac.png b/Book_manger/Sql/Resources/t01b34dced1b5dbeaac.png new file mode 100644 index 0000000..d8ccd0d Binary files /dev/null and b/Book_manger/Sql/Resources/t01b34dced1b5dbeaac.png differ diff --git a/Book_manger/Sql/Sql.csproj b/Book_manger/Sql/Sql.csproj new file mode 100644 index 0000000..c08e4db --- /dev/null +++ b/Book_manger/Sql/Sql.csproj @@ -0,0 +1,202 @@ + + + + + Debug + AnyCPU + {DB8AE64E-8D73-41AC-AEE9-6E00747FE730} + WinExe + Sql + Sql + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form2.cs + + + Form + + + Form21.cs + + + Form + + + Form3.cs + + + Form + + + Form31.cs + + + Form + + + Form311.cs + + + Form + + + Form312.cs + + + Form + + + Form32.cs + + + Form + + + Form4.cs + + + Form + + + Form41.cs + + + Form + + + Form1.cs + + + Form + + + Form5.cs + + + Form + + + Form51.cs + + + + + Form1.cs + + + Form2.cs + + + Form21.cs + + + Form3.cs + + + Form31.cs + + + Form311.cs + + + Form312.cs + + + Form32.cs + + + Form4.cs + + + Form41.cs + + + Form5.cs + + + Form51.cs + + + ResXFileCodeGenerator + Designer + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Book_manger/Sql/bin/Debug/Sql.exe b/Book_manger/Sql/bin/Debug/Sql.exe new file mode 100644 index 0000000..eb21af7 Binary files /dev/null and b/Book_manger/Sql/bin/Debug/Sql.exe differ diff --git a/Book_manger/Sql/bin/Debug/Sql.exe.config b/Book_manger/Sql/bin/Debug/Sql.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Book_manger/Sql/bin/Debug/Sql.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Book_manger/Sql/bin/Debug/Sql.pdb b/Book_manger/Sql/bin/Debug/Sql.pdb new file mode 100644 index 0000000..f61fbac Binary files /dev/null and b/Book_manger/Sql/bin/Debug/Sql.pdb differ diff --git a/Book_manger/Sql/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/Book_manger/Sql/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/Book_manger/Sql/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..8bccf68 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..5301c6e Binary files /dev/null and b/Book_manger/Sql/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form1.resources b/Book_manger/Sql/obj/Debug/Sql.Form1.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form1.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form2.resources b/Book_manger/Sql/obj/Debug/Sql.Form2.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form2.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form21.resources b/Book_manger/Sql/obj/Debug/Sql.Form21.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form21.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form3.resources b/Book_manger/Sql/obj/Debug/Sql.Form3.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form3.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form31.resources b/Book_manger/Sql/obj/Debug/Sql.Form31.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form31.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form311.resources b/Book_manger/Sql/obj/Debug/Sql.Form311.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form311.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form312.resources b/Book_manger/Sql/obj/Debug/Sql.Form312.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form312.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form32.resources b/Book_manger/Sql/obj/Debug/Sql.Form32.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form32.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form4.resources b/Book_manger/Sql/obj/Debug/Sql.Form4.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form4.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form41.resources b/Book_manger/Sql/obj/Debug/Sql.Form41.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form41.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form5.resources b/Book_manger/Sql/obj/Debug/Sql.Form5.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form5.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Form51.resources b/Book_manger/Sql/obj/Debug/Sql.Form51.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Form51.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.Properties.Resources.resources b/Book_manger/Sql/obj/Debug/Sql.Properties.Resources.resources new file mode 100644 index 0000000..82f3343 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.Properties.Resources.resources differ diff --git a/Book_manger/Sql/obj/Debug/Sql.csproj.AssemblyReference.cache b/Book_manger/Sql/obj/Debug/Sql.csproj.AssemblyReference.cache new file mode 100644 index 0000000..f5b140e Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.csproj.AssemblyReference.cache differ diff --git a/Book_manger/Sql/obj/Debug/Sql.csproj.CoreCompileInputs.cache b/Book_manger/Sql/obj/Debug/Sql.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..9f70208 --- /dev/null +++ b/Book_manger/Sql/obj/Debug/Sql.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +40dfdbac20be6274f0b5326ef86584a1157c8338 diff --git a/Book_manger/Sql/obj/Debug/Sql.csproj.FileListAbsolute.txt b/Book_manger/Sql/obj/Debug/Sql.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..1c55993 --- /dev/null +++ b/Book_manger/Sql/obj/Debug/Sql.csproj.FileListAbsolute.txt @@ -0,0 +1,64 @@ +D:\Desktop\Book_manger\Sql\bin\Debug\Sql.exe.config +D:\Desktop\Book_manger\Sql\bin\Debug\Sql.exe +D:\Desktop\Book_manger\Sql\bin\Debug\Sql.pdb +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.csprojAssemblyReference.cache +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form1.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Properties.Resources.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.csproj.GenerateResource.cache +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.csproj.CoreCompileInputs.cache +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.exe +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.pdb +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form2.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form21.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form3.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form31.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form4.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form41.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form5.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form311.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form312.resources +D:\Desktop\Book_manger\Sql\obj\Debug\Sql.Form51.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\bin\Debug\Sql.exe.config +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\bin\Debug\Sql.exe +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\bin\Debug\Sql.pdb +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.csproj.AssemblyReference.cache +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.csproj.SuggestedBindingRedirects.cache +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form1.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form2.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form21.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form3.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form31.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form311.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form312.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form4.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form41.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form5.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form51.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Properties.Resources.resources +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.csproj.GenerateResource.cache +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.csproj.CoreCompileInputs.cache +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.exe +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.pdb +C:\Users\yingse\Downloads\c#图书馆管理系统\新建文件夹 (2)\Book_manger\Sql\obj\Debug\Sql.Form32.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\bin\Debug\Sql.exe.config +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\bin\Debug\Sql.exe +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\bin\Debug\Sql.pdb +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.csproj.AssemblyReference.cache +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.csproj.SuggestedBindingRedirects.cache +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form1.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form2.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form21.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form3.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form31.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form311.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form312.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form32.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form4.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form41.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form5.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Form51.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.Properties.Resources.resources +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.csproj.GenerateResource.cache +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.csproj.CoreCompileInputs.cache +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.exe +D:\360MoveData\Users\yingse\Desktop\数据库课程设计\Book_manger\Sql\obj\Debug\Sql.pdb diff --git a/Book_manger/Sql/obj/Debug/Sql.csproj.GenerateResource.cache b/Book_manger/Sql/obj/Debug/Sql.csproj.GenerateResource.cache new file mode 100644 index 0000000..2163d92 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.csproj.GenerateResource.cache differ diff --git a/Book_manger/Sql/obj/Debug/Sql.csproj.SuggestedBindingRedirects.cache b/Book_manger/Sql/obj/Debug/Sql.csproj.SuggestedBindingRedirects.cache new file mode 100644 index 0000000..e69de29 diff --git a/Book_manger/Sql/obj/Debug/Sql.csprojAssemblyReference.cache b/Book_manger/Sql/obj/Debug/Sql.csprojAssemblyReference.cache new file mode 100644 index 0000000..a9e1800 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.csprojAssemblyReference.cache differ diff --git a/Book_manger/Sql/obj/Debug/Sql.exe b/Book_manger/Sql/obj/Debug/Sql.exe new file mode 100644 index 0000000..eb21af7 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.exe differ diff --git a/Book_manger/Sql/obj/Debug/Sql.pdb b/Book_manger/Sql/obj/Debug/Sql.pdb new file mode 100644 index 0000000..f61fbac Binary files /dev/null and b/Book_manger/Sql/obj/Debug/Sql.pdb differ diff --git a/Book_manger/Sql/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/Book_manger/Sql/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..c1964f5 Binary files /dev/null and b/Book_manger/Sql/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/Book_manger/Sql/obj/Release/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/Book_manger/Sql/obj/Release/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/Book_manger/Sql/obj/Release/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/Book_manger/Sql/obj/Release/Sql.csprojAssemblyReference.cache b/Book_manger/Sql/obj/Release/Sql.csprojAssemblyReference.cache new file mode 100644 index 0000000..fcb839c Binary files /dev/null and b/Book_manger/Sql/obj/Release/Sql.csprojAssemblyReference.cache differ