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

📄 formvacationmanagement.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 FormVacationManagement : Form
    {
        SqlConnection cnBlueHill_HRM;
        DataSet dsCustomers;
        SqlDataAdapter daCustomers;

        public FormVacationManagement()
        {
            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 btnDeleteVacation_Click(object sender, EventArgs e)
        {
            string ss = grdEmployee[grdEmployee.CurrentCell].ToString();
            cnBlueHill_HRM = new SqlConnection("data source=.;initial catalog=BlueHill_HRM;integrated security=true;");
            cnBlueHill_HRM.Open();
            SqlCommand cmd = new SqlCommand("delete from tblLeave where LeaveID='" + ss + "'", cnBlueHill_HRM);
            int count = Convert.ToInt32(cmd.ExecuteNonQuery());
            if (count > 0)
            {
                DialogResult = MessageBox.Show("删除成功!", "提示");

                //grdEmployee.EditItemIndex = -1;
                this.Hide();

                FormVacationManagement VM = new FormVacationManagement();
                VM.Show();

            }
            else
                DialogResult = MessageBox.Show("操作失败!", "提示");
            cnBlueHill_HRM.Close();
        }

        private void btnByGroup_Click(object sender, EventArgs e)
        {
            this.Close();
            FormDeptList FDL = new FormDeptList();
            FDL.Show();
        }

        private void btnQueryEmp_Click(object sender, EventArgs e)
        {
            this.Close();
            FormEmpList FDL = new FormEmpList();
            FDL.Show();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
            Main M = new Main();
            M.Show();
        }

        private void BtnVacationSetting_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormVacationSetting FVS = new FormVacationSetting();
            FVS.Show();
        }

        private void FormVacationManagement_Load(object sender, EventArgs e)
        {
            cnBlueHill_HRM = new SqlConnection("Data Source=.;Initial Catalog=BlueHill_HRM;integrated security=true;");
            dsCustomers = new DataSet();
            daCustomers = new SqlDataAdapter();
            SqlCommand cmSelect = new SqlCommand();
            cmSelect.Connection = cnBlueHill_HRM;
            cmSelect.CommandText = "select * from tblLeave";
            daCustomers.SelectCommand = cmSelect;
            daCustomers.Fill(dsCustomers, "Customers");
            grdEmployee.DataSource = dsCustomers.Tables["Customers"];
        }  
    }
}

⌨️ 快捷键说明

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