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

📄 frmhortation.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 HRP.Wage
{
    public partial class frmHortation : Form
    {
        public frmHortation()
        {
            InitializeComponent();
        }
        public string strtype;
        BaseClass.SqlClass sqlclass=new HRP.BaseClass.SqlClass();
        BaseClass.WageClass wageclass = new HRP.BaseClass.WageClass();
        private void frmHortation_Load(object sender, EventArgs e)
        {
            if (strtype == "tb_Chastisement")
            {
                this.Text = "【员工惩罚管理】";
            }
            this.Bind();
        }
        public void Bind()
        {
            this.dgvHortation.DataSource = sqlclass.SqlDaAd("select * from " + strtype, strtype).Tables[strtype];
        }

        private void tlbtnAdd_Click(object sender, EventArgs e)
        {
            frmHortationAdd frm_hortationadd = new frmHortationAdd();
            frm_hortationadd.strtype = strtype;
            frm_hortationadd.frmhortation = this;
            frm_hortationadd.ShowDialog();
        }

        private void tlbtnEdit_Click(object sender, EventArgs e)
        {
            string strid = Convert.ToString(dgvHortation[0, dgvHortation.CurrentCell.RowIndex].Value);
            if (strid != "")
            {
                frmHortationEdit frm_hortationedit = new frmHortationEdit();
                frm_hortationedit.strid = strid;
                frm_hortationedit.txtMonthWage.Text = Convert.ToString(dgvHortation[1, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.txtEmployeeID.Text = Convert.ToString(dgvHortation[2, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.txtEmployeeName.Text = Convert.ToString(dgvHortation[3, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.cmbHortationItem.Text = Convert.ToString(dgvHortation[4, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.txtHortationNumber.Text = Convert.ToString(dgvHortation[5, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.txtRemark.Text = Convert.ToString(dgvHortation[6, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.dtpHortationDate.Text = Convert.ToString(dgvHortation[7, dgvHortation.CurrentCell.RowIndex].Value);
                frm_hortationedit.strtype = strtype;
                frm_hortationedit.frmhortation = this;
                frm_hortationedit.ShowDialog();
            }
        }

        private void tlbtnDelete_Click(object sender, EventArgs e)
        {
            string strid = Convert.ToString(dgvHortation[0, dgvHortation.CurrentCell.RowIndex].Value);
            if (strid != "")
            {
                sqlclass.sqlcmd("delete from " + strtype + " where ID=" + strid);
                this.Bind();
            }
        }

        private void tlbtnSearch_Click(object sender, EventArgs e)
        {
            string strdata="";
            switch(this.tlcmbData.Text)
            {
                case "员工编号":
                    strdata = "EmployeeID";
                    break;
                case "员工姓名":
                    strdata = "EmployeeName";
                    break;
                case "所属月份":
                    strdata = "MonthWage";
                    break;
                default:
                    MessageBox.Show("请选择一个要查询的字段!");
                    return;
            }
            if(this.tltxtKeyWord.Text=="")
            {
                MessageBox.Show("关键字不能为空!");
                return;
            }
            try
            {

                this.dgvHortation.DataSource = wageclass.HortationSearch(strtype, strdata, this.tltxtKeyWord.Text).Tables[strtype];
            }
            catch
            {
                MessageBox.Show("操作失败!");
            }
        }

        private void tlbtnAll_Click(object sender, EventArgs e)
        {
            this.Bind();
        }

        private void tlbtnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

⌨️ 快捷键说明

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