📄 frmsubjectfindinfo.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using property.model.GetConnection;
using property.model.SubjectInfo;
using property.control.Subject;
namespace property.view.HinderInfo
{
public partial class frmSubjectFindInfo : Form
{
public frmSubjectFindInfo()
{
InitializeComponent();
}
public int P_int_sed;
private void SubjectFindInfo_Load(object sender, EventArgs e)
{
}
private void bntsure_Click(object sender, EventArgs e)
{
if (cmbTiaoJian.Text == "" || txtsubject.Text == "")
{
MessageBox.Show("请先选择查询条件,然后输入查询条件", "查询提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (cmbTiaoJian.Text == "")
{
cmbTiaoJian.Focus();
return;
}// end block if
if (txtsubject.Text == "")
{
this.txtsubject.Focus();
return;
}// end block if
}// end block
else {
SubInfo info = new SubInfo();
FinSubject fidsub = new FinSubject();
if (P_int_sed == 0)
{
info.setsubId(Convert.ToInt32(this.txtsubject.Text.Trim()));
}// end block if
else if(P_int_sed==1)
{
info.setsubName(txtsubject.Text.Trim());
}// end block if
else if (P_int_sed == 2)
{
info.setsubGkb(txtsubject.Text.Trim());
}// end block if
//调用查找函数
string P_str_result = fidsub.GetFindSubject(info, cmbTiaoJian.Text, this.dataGridView1);
if (P_str_result == "NO")
{
MessageBox.Show("没有符合条件的记录\n"+"请输入正确的查询条件");
this.cmbTiaoJian.Text = "";
this.txtsubject.Text = "";
txtsubject.Focus();
}// end block if
if (P_str_result == "Error")
{
MessageBox.Show("错误信息","错误提示");
this.cmbTiaoJian.Text = "";
this.txtsubject.Text = "";
txtsubject.Focus();
}// end block if
}//end block else
}
private void cmbTiaoJian_SelectedIndexChanged(object sender, EventArgs e)
{
txtsubject.Text = "";
this.P_int_sed = cmbTiaoJian.SelectedIndex;
}
private void bntEsce_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Convert.ToString(a) == "Yes")
{
this.Close();
}// end block
}
private void txtsubject_KeyPress(object sender, KeyPressEventArgs e)
{
if (P_int_sed == 0)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("科目编号只能输入数字", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Handled = true;
}
}// end block if
}
private void button1_Click(object sender, EventArgs e)
{
}// end block
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -