📄 图书验收.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 图书馆管理系统
{
public partial class 图书验收 : Form
{
private BindingManagerBase Navigator;
public 图书验收()
{
InitializeComponent();
}
private void 图书验收_Load(object sender, EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11, "图书征订");
Navigator = this.BindingContext[dataSet11, "图书征订"];
}
//------------------------------搜索--------------------------------
private void button12_Click(object sender, EventArgs e)
{
sqlConnection1.Open();
string str="";
switch (comboBox1.SelectedIndex)
{
case 0:
str = "select * from 图书征订";
break;
case 1:case 2:case 3:
str = "select * from 图书征订 where "+comboBox1.Text+" like '%"+textBox1.Text+"%'";
break;
default:
str = "select * from 图书征订";
break;
}
dataSet11.Clear();
SqlDataAdapter myda = new SqlDataAdapter(str, sqlConnection1);
myda.Fill(dataSet11, "图书征订");
sqlConnection1.Close();
}
//-------------------------------------------提交验收-----------------------------------
private void button1_Click(object sender, EventArgs e)
{
sqlConnection1.Open();
SqlCommand mycom = new SqlCommand("exec sf_图书征订",sqlConnection1);
int N=mycom.ExecuteNonQuery();
if (N != 0)
{
if (checkBox1.Checked == true)
MessageBox.Show("该图书已经验收了!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
{
if (checkBox1.Checked!=true)
{
sqlDataAdapter1.Update(dataSet11, "图书征订");
dataSet11.Clear();
sqlDataAdapter1.Fill(dataSet11, "图书征订");
MessageBox.Show("提交操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
if(checkBox1.Checked!=false)
{
MessageBox.Show("不能提交!是否验收为0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else
MessageBox.Show("操作失败!请检查后重新操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
sqlConnection1.Close();
}
//---------------------------------------------------退出-----------------------------------
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
//------------------------------------上一条-----------------------------------------------------
private void button3_Click(object sender, EventArgs e)
{
if (Navigator.Position == 0)
{
dataGrid1.UnSelect(Navigator.Position);
Navigator.Position = 0;
dataGrid1.Select(Navigator.Position);
dataGrid1.CurrentRowIndex = Navigator.Position;
}
else
{
dataGrid1.UnSelect(Navigator.Position);
Navigator.Position--;
dataGrid1.Select(Navigator.Position);
dataGrid1.CurrentRowIndex = Navigator.Position;
}
}
//------------------------------------下一条-----------------------------------------------------
private void button4_Click(object sender, EventArgs e)
{
if (Navigator.Position == Navigator.Count - 1)
{
dataGrid1.UnSelect(Navigator.Position);
Navigator.Position = Navigator.Count - 1;
dataGrid1.Select(Navigator.Position);
dataGrid1.CurrentRowIndex = Navigator.Position;
}
else
{
dataGrid1.UnSelect(Navigator.Position);
Navigator.Position++;
dataGrid1.Select(Navigator.Position);
dataGrid1.CurrentRowIndex = Navigator.Position;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -