📄 addf.cs
字号:
// button3
//
this.button3.Location = new System.Drawing.Point(48, 232);
this.button3.Name = "button3";
this.button3.TabIndex = 4;
this.button3.Text = "增加";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(168, 112);
this.textBox8.Name = "textBox8";
this.textBox8.TabIndex = 3;
this.textBox8.Text = "textBox8";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(168, 80);
this.textBox7.Name = "textBox7";
this.textBox7.TabIndex = 2;
this.textBox7.Text = "textBox7";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(168, 48);
this.textBox6.Name = "textBox6";
this.textBox6.TabIndex = 1;
this.textBox6.Text = "textBox6";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(168, 16);
this.textBox5.Name = "textBox5";
this.textBox5.TabIndex = 0;
this.textBox5.Text = "textBox5";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.button6);
this.tabPage3.Controls.Add(this.button5);
this.tabPage3.Controls.Add(this.label12);
this.tabPage3.Controls.Add(this.label11);
this.tabPage3.Controls.Add(this.textBox12);
this.tabPage3.Controls.Add(this.textBox11);
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(304, 279);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "借书";
//
// button6
//
this.button6.Location = new System.Drawing.Point(176, 216);
this.button6.Name = "button6";
this.button6.TabIndex = 9;
this.button6.Text = "取消";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(40, 216);
this.button5.Name = "button5";
this.button5.TabIndex = 8;
this.button5.Text = "借书";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// label12
//
this.label12.Location = new System.Drawing.Point(32, 128);
this.label12.Name = "label12";
this.label12.TabIndex = 5;
this.label12.Text = "图书编号:";
//
// label11
//
this.label11.Location = new System.Drawing.Point(32, 48);
this.label11.Name = "label11";
this.label11.TabIndex = 4;
this.label11.Text = "读者编号:";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(168, 128);
this.textBox12.Name = "textBox12";
this.textBox12.TabIndex = 1;
this.textBox12.Text = "textBox12";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(168, 48);
this.textBox11.Name = "textBox11";
this.textBox11.TabIndex = 0;
this.textBox11.Text = "textBox11";
//
// tabPage4
//
this.tabPage4.Controls.Add(this.button8);
this.tabPage4.Controls.Add(this.button7);
this.tabPage4.Controls.Add(this.label18);
this.tabPage4.Controls.Add(this.label17);
this.tabPage4.Controls.Add(this.label16);
this.tabPage4.Controls.Add(this.label15);
this.tabPage4.Controls.Add(this.textBox18);
this.tabPage4.Controls.Add(this.textBox17);
this.tabPage4.Controls.Add(this.textBox16);
this.tabPage4.Controls.Add(this.textBox15);
this.tabPage4.Location = new System.Drawing.Point(4, 21);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(304, 279);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "增加读者类型";
//
// button8
//
this.button8.Location = new System.Drawing.Point(176, 232);
this.button8.Name = "button8";
this.button8.TabIndex = 9;
this.button8.Text = "取消";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(32, 232);
this.button7.Name = "button7";
this.button7.TabIndex = 8;
this.button7.Text = "增加";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// label18
//
this.label18.Location = new System.Drawing.Point(24, 176);
this.label18.Name = "label18";
this.label18.TabIndex = 7;
this.label18.Text = "借阅期限:";
this.label18.Click += new System.EventHandler(this.label18_Click);
//
// label17
//
this.label17.Location = new System.Drawing.Point(24, 120);
this.label17.Name = "label17";
this.label17.TabIndex = 6;
this.label17.Text = "限借阅数量:";
//
// label16
//
this.label16.Location = new System.Drawing.Point(24, 72);
this.label16.Name = "label16";
this.label16.TabIndex = 5;
this.label16.Text = "类型名称:";
//
// label15
//
this.label15.Location = new System.Drawing.Point(24, 24);
this.label15.Name = "label15";
this.label15.TabIndex = 4;
this.label15.Text = "类型编号:";
//
// textBox18
//
this.textBox18.Location = new System.Drawing.Point(160, 168);
this.textBox18.Name = "textBox18";
this.textBox18.TabIndex = 3;
this.textBox18.Text = "textBox18";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(160, 120);
this.textBox17.Name = "textBox17";
this.textBox17.TabIndex = 2;
this.textBox17.Text = "textBox17";
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(160, 72);
this.textBox16.Name = "textBox16";
this.textBox16.TabIndex = 1;
this.textBox16.Text = "textBox16";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(160, 24);
this.textBox15.Name = "textBox15";
this.textBox15.TabIndex = 0;
this.textBox15.Text = "textBox15";
//
// AddF
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(352, 341);
this.Controls.Add(this.tabControl1);
this.Name = "AddF";
this.Text = "AddF";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void label18_Click(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
string no=textBox1.Text;
string name=textBox2.Text;
string TypeNo=textBox3.Text;
string yjsl=textBox4.Text;
try
{
int yjnu=int.Parse(yjsl);
string sql="select * from Reader where Rid='"+no+"'";
if(!util.isExist(sql))
{
string sql1="insert into Reader values('"+no+"','"+name+"','"+TypeNo+"',"+yjnu+")";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("发生错误,填加未成功!!");
}
else
{
MessageBox.Show("ok!! 增加成功!!");
}
}
else
{
MessageBox.Show("数据库里有该编号的读者,无法增加!!");
}
}
catch(Exception em2){
MessageBox.Show("请保证每空都是正确的格式!!");
}
}
private void button2_Click(object sender, System.EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
}
private void label10_Click(object sender, System.EventArgs e)
{
}
private void button3_Click(object sender, System.EventArgs e)
{
string bno=textBox5.Text;
string bname=textBox6.Text;
string bprice=textBox7.Text;
string bcount=textBox8.Text;
string bp=textBox9.Text;
string bpdate1=textBox10.Text;
string bpdate2=textBox19.Text;
string bpdate3=textBox20.Text;
try
{
int bpr=int.Parse(bprice);
int bnum=int.Parse(bcount);
int bpd1=int.Parse(bpdate1);
int bpd2=int.Parse(bpdate2);
int bpd3=int.Parse(bpdate3);
if(bpd2>12||!util.dayformMonth(bpd1,bpd2,bpd3)||bpd1>DateTime.Today.Year){
MessageBox.Show("你输入的日期有错误,请你输入正确的日期!!");
return;
}
DateTime date=new DateTime(bpd1,bpd2,bpd3);
string sql="select * from Book where Bid='"+bno+"'";
if(!util.isExist(sql))
{
string sql1="insert into Book values('"+bno+"','"+bname+"',"+bpr+","+bnum+" ,'"+bp+"','"+date.ToString()+"')";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("发生错误,增加未成功!!");
}
else
{
MessageBox.Show("ok!! 增加成功!!");
}
}
else
{
MessageBox.Show("数据库里有该编号的图书,无需再加!!");
}
}
catch(Exception em2)
{
MessageBox.Show("请保证每空都是正确的格式!!");
}
}
private void button4_Click(object sender, System.EventArgs e)
{
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
textBox10.Clear();
textBox19.Clear();
textBox20.Clear();
}
private void button7_Click(object sender, System.EventArgs e)
{
string TypeNo=textBox15.Text;
string TypeName=textBox16.Text;
string Ynum=textBox17.Text;
string jdate=textBox18.Text;
try
{
int yn=int.Parse(Ynum);
int jd=int.Parse(jdate);
string sql="select * from ReaderType where Typeid='"+TypeNo+"'";
if(!util.isExist(sql))
{
string sql1="insert into ReaderType values('"+TypeNo+"','"+TypeName+"',"+yn+","+jd+")";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("发生错误,增加未成功!!");
}
else
{
MessageBox.Show("ok!! 增加成功!!");
}
}
else
{
MessageBox.Show("数据库里有该编号的读者类型,无法增加!!");
}
}
catch(Exception e3){
MessageBox.Show("请保证每空都是正确的格式!!");
}
}
private void button8_Click(object sender, System.EventArgs e)
{
textBox15.Clear();
textBox16.Clear();
textBox17.Clear();
textBox18.Clear();
}
private void button5_Click(object sender, System.EventArgs e)
{
string rid=textBox11.Text;
string bid=textBox12.Text;
util.getBook(rid,bid);
}
private void button6_Click(object sender, System.EventArgs e)
{
textBox11.Clear();
textBox12.Clear();
//textBox13.Clear();
//textBox14.Clear();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -