📄 frmborrowreadquery.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Bussiness;
namespace UI
{
public partial class frmBorrowReadQuery : Form
{
//初始化业务层的SelectInfo类的实例
SelectInfo objSelectInfo = new SelectInfo();
public frmBorrowReadQuery()
{
InitializeComponent();
}
//加载界面时为2个listView设置样式和列表头
/* private void frmBorrowReadQuery_Load(object sender, EventArgs e)
{
lstBookMagazineInfo.View = View.Details;
lstBookMagazineInfo.Columns.Add("图书编号",77,HorizontalAlignment.Center);
lstBookMagazineInfo.Columns.Add("名称",77,HorizontalAlignment.Center);
lstBookMagazineInfo.Columns.Add("出版社", 77, HorizontalAlignment.Center);
lstBookMagazineInfo.Columns.Add("类型", 77, HorizontalAlignment.Center);
lstBookMagazineInfo.Columns.Add("库存量", 77, HorizontalAlignment.Center);
lstReaderInfo.View = View.Details;
lstReaderInfo.Columns.Add("读者编号",77,HorizontalAlignment.Center);
lstReaderInfo.Columns.Add("姓名", 77, HorizontalAlignment.Center);
lstReaderInfo.Columns.Add("会员类型", 77, HorizontalAlignment.Center);
lstReaderInfo.Columns.Add("状态", 77, HorizontalAlignment.Center);
lstReaderInfo.Columns.Add("押金", 77, HorizontalAlignment.Center);
}*/
/// <summary>
/// 当在此文本框输入 图书或期刊 编号后,显示图书或期刊的信息 和 借此书籍的读者的信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtBookMagazineID_TextChanged(object sender, EventArgs e)
{
string Lose = "未还";
DataTable BookTable = null;
DataTable MagazineTable = null;
if (radBookInfo.Checked)//如果选中的是图书查询按钮
{
try
{
//先清空2个listView的内容
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
//然后填充2个listView的内容
BookTable = objSelectInfo.selectBookInfo(txtBookMagazineID.Text);
this.datBookMagazineInfo.DataSource = BookTable;
this.dataReader.DataSource = objSelectInfo.SelectBookBorrowInfo(BookTable.Rows[0][0].ToString(), Lose);
}
catch
{
}
}
else//如果选中的是期刊查询按钮
{
try
{
//先清空2个listView的内容
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
//然后填充2个listView的内容
MagazineTable= objSelectInfo.selectMagazineInfo(txtBookMagazineID.Text);
this.datBookMagazineInfo.DataSource = MagazineTable;
this.dataReader.DataSource = objSelectInfo.SelectBorrowMagazineReader(MagazineTable.Rows[0][0].ToString(), Lose);
}
catch
{
//出现异常清空2个listView
}
}
}
/// <summary>
/// 当在文本框输入读者编号后,会根据 单选按钮 来查询当前读者借阅着的书籍信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtReaderID_TextChanged(object sender, EventArgs e)
{
string Lose = "未还";
DataTable ReaderTable = null;
if (radBookBorrow.Checked)//如果选中的是图书借阅按钮
{
try
{
//先清空2个listView的内容
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
//lstReaderInfo.Items.Clear();
//然后填充2个listView
ReaderTable= objSelectInfo.selectReaderInfo(txtReaderID.Text);
this.dataReader.DataSource=ReaderTable;
this.datBookMagazineInfo.DataSource = objSelectInfo.SelectReaderBorrowBook(ReaderTable.Rows[0][0].ToString(), Lose);
}
catch
{
//出现异常清空2个listView
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
// lstBookMagazineInfo.Items.Clear();
// lstReaderInfo.Items.Clear();
}
}
else if (radMagazineBorrow.Checked)//如果选中的是期刊借阅按钮
{
try
{
//先清空2个listView的内容
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
//在填充2个listView
ReaderTable = objSelectInfo.selectReaderInfo(txtReaderID.Text);
this.dataReader.DataSource = ReaderTable;
this.datBookMagazineInfo.DataSource = objSelectInfo.SelectMagazineBorrowInfo(ReaderTable.Rows[0][0].ToString(), Lose);
}
catch
{
//出现异常清空2个listView
this.dataReader.DataSource = null;
this.datBookMagazineInfo.DataSource = null;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -