⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmsubjectidfind.cs

📁 财务凭证管理系统,主要是从事公司或部门的财务方面的管理。此系统给会计人员带来很大的帮助!
💻 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.control.Subject;
using property.model.SubjectInfo;
namespace property.view.HinderInfo
{
    public partial class frmSubjectIDFind : Form
    {
        public frmSubjectIDFind()
        {
            InitializeComponent();
        }
        public int P_int_Select=5;//全局变量
        public int P_int_id;
        private void frmSubjectIDFind_Load(object sender, EventArgs e)
        {
            GetSubject getsub = new GetSubject();
            getsub.fillId(cmbSubId);

        }
        // 转变查询
        private void cmbSubId_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtSubName.Text = "";
            P_int_Select = 1;//全局变量
            P_int_id = Convert.ToInt32(this.cmbSubId.SelectedItem.ToString());
            GetSubject getsub = new GetSubject();
            SubInfo info = new SubInfo();
            info.setsubId(Convert.ToInt32(this.cmbSubId.SelectedItem.ToString()));
            getsub.GetdDataGrid(this.dataGridView1,info);

        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult a = MessageBox.Show("是否要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (Convert.ToString(a) == "Yes")
            {
                this.Close();
            }// end block 
        }
        //
        private void bntSure_Click(object sender, EventArgs e)
        {
            if (this.txtSubName.Text == "")
            {
                MessageBox.Show("请输入查询科目名称");
                this.cmbSubId.Text = "";
                txtSubName.Text = "";
                txtSubName.Focus();
            }// end block if 
            else
            {

                GetSubject getsub = new GetSubject();
                SubInfo info = new SubInfo();
                info.setsubName(txtSubName.Text.Trim());
                string P_str_result = getsub.GetDataGridInfo(this.dataGridView1, info);
                if (P_str_result == "NO")
                {
                    MessageBox.Show("对不起此科目名称不存在\n"+"请重新输入","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
                    this.txtSubName.Text = "";
                    txtSubName.Focus();
                    return;
                }//
                P_int_Select = 2;//全局变量
            }//end block else
        }
        //打印报表
        private void button1_Click(object sender, EventArgs e)
        {

            if (P_int_Select == 1)//条件判断传哪个值
            {
                frmSubjectPrint frmPrint = new frmSubjectPrint(P_int_id);
                frmPrint.Show();
                P_int_Select =5;
                return;
            }// end block if 
            if (P_int_Select == 2)
            {
                frmSubjectPrint frmPrint = new frmSubjectPrint(txtSubName.Text.Trim());
                frmPrint.Show();
                P_int_Select = 5;
                return;
            }// end block if 
            if (P_int_Select == 4)
            {
                frmSubjectPrint frmPrint = new frmSubjectPrint();
                frmPrint.Show();
                P_int_Select = 5;
                return;
            
            }// end block if 
            if(P_int_Select ==5)
            {
                MessageBox.Show("请先查找数据再打印");
                return;
                
            }

        }

        private void txtSubName_KeyPress(object sender, KeyPressEventArgs e)
        {
            this.cmbSubId.Text = "";
           P_int_Select = 3;
        }

        private void bntSelect_Click(object sender, EventArgs e)
        {
            GetSubject getsub = new GetSubject();
            getsub.GetdDataGrid(this.dataGridView1);
            P_int_Select = 4;
        }
        //
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -