📄 读者类别设置.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 图书馆管理系统
{
public partial class 读者类别设置 : Form
{
private BindingManagerBase aa;
public 读者类别设置()
{
InitializeComponent();
}
private void 读者类别设置_Load(object sender, EventArgs e)
{
sqlDataAdapter1.SelectCommand.Parameters[0].Value = "%%";
sqlDataAdapter1.Fill(dataSet91,"读者类型");
aa = this.BindingContext[dataSet91, "读者类型"];
}
private void button10_Click(object sender, EventArgs e)
{
if (MessageBox.Show("真的要退出吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
else
this.Close();
}
private void setmodifymode(bool bln)
{
textBox2.ReadOnly = !bln;
textBox3.ReadOnly = !bln;
textBox4.ReadOnly = !bln;
textBox5.ReadOnly = !bln;
button11.Enabled = !bln;
}
private void button9_Click(object sender, EventArgs e)
{
try
{
aa.CancelCurrentEdit();
setmodifymode(false);
}
catch (Exception express)
{
MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
return;
}
private void button1_Click(object sender, EventArgs e)
{
this.dataGrid1.UnSelect(aa.Position);
aa.Position = 0;
this.dataGrid1.Select(aa.Position);
this.dataGrid1.CurrentRowIndex = aa.Position;
}
private void button2_Click(object sender, EventArgs e)
{
this.dataGrid1.UnSelect(aa.Position);
aa.Position--;
this.dataGrid1.Select(aa.Position);
this.dataGrid1.CurrentRowIndex = aa.Position;
}
private void button3_Click(object sender, EventArgs e)
{
this.dataGrid1.UnSelect(aa.Position);
aa.Position++;
this.dataGrid1.Select(aa.Position);
this.dataGrid1.CurrentRowIndex = aa.Position;
}
private void button4_Click(object sender, EventArgs e)
{
this.dataGrid1.UnSelect(aa.Position);
aa.Position = aa.Count - 1;
this.dataGrid1.Select(aa.Position);
this.dataGrid1.CurrentRowIndex = aa.Position;
}
private void button8_Click(object sender, EventArgs e)
{
if (textBox2.Text.Trim() == "")
{
MessageBox.Show("类型名称不能为空","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
aa.EndCurrentEdit();
if (dataSet91.GetChanges() != null)
{
try
{
sqlDataAdapter1.Update(dataSet91);
setmodifymode(false);
}
catch (Exception abc)
{
MessageBox.Show(abc.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
dataSet91.RejectChanges();
}
}
return;
}
private void button5_Click(object sender, EventArgs e)
{
aa.AddNew();
textBox3.Text = "1";
textBox4.Text = "1";
textBox5.Text = "1";
setmodifymode(true);
}
private void button6_Click(object sender, EventArgs e)
{
setmodifymode(true);
}
private void button7_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("确认删除!","删除数据",MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
if (aa.Count > 0)
{
aa.RemoveAt(aa.Position);
sqlDataAdapter1.Update(dataSet91);
}
else
MessageBox.Show("表中为空,已无可删除数据!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
private void button11_Click(object sender, EventArgs e)
{
sqlDataAdapter1.SelectCommand.Parameters[0].Value = "%"+textBox1.Text.Trim()+"%";
dataSet91.读者类型.Clear();
sqlDataAdapter1.Fill(dataSet91);
}
private void button12_Click(object sender, EventArgs e)
{
CrystalReport3 p = new CrystalReport3();
p.SetDataSource(dataSet91.Tables[0]);
读者类型 f = new 读者类型();
f.Show();
f.crystalReportViewer1.ReportSource = p;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -