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

📄 formdept.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 System.Data.SqlClient;

namespace HumanResourceManagement
{
    public partial class FormDept : Form
    {
        SqlConnection cnBlueHill_HRM;

        public FormDept()
        {
            InitializeComponent();
        }

        private const int CP_NOCLOSE_BUTTON = 0x200;
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams myCp = base.CreateParams;
                myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
                return myCp;
            }
        } 

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
            FormSalaryManagement FSM = new FormSalaryManagement();
            FSM.Show();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() != "")
            {
                cnBlueHill_HRM = new SqlConnection("data source=.;initial catalog=BlueHill_HRM;integrated security=true;");
                cnBlueHill_HRM.Open();
                SqlCommand cmd = new SqlCommand("select count(*) from tblDepartment where DeptName='" + textBox1.Text.ToString().Trim() + "'", cnBlueHill_HRM);
                int count = Convert.ToInt32(cmd.ExecuteScalar());
                if (count == 0)
                {
                    cnBlueHill_HRM.Close();
                    DialogResult = MessageBox.Show("该部门不存在!", "提示");

                }
                else
                {
                    DB.setA = textBox1.Text.Trim();
                    this.Close();
                }
            }
            else
                DialogResult = MessageBox.Show("请输入您要查询的部门名称!", "提示");

           
        }

    }
}

⌨️ 快捷键说明

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