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

📄 frmbase.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.BaseInfo
{
    public partial class frmBase : Form
    {
        public frmBase()
        {
            InitializeComponent();
        }
        public string strName;
        BaseClass.SqlClass sqlclass = new HRP.BaseClass.SqlClass();
        BaseClass.BaseClass baseclass = new HRP.BaseClass.BaseClass();
        private void frmBase_Load(object sender, EventArgs e)
        {
            this.tlYes.Enabled = false;
            this.tlReturn.Enabled = false;
            this.bind();
        }
        //添加按钮
        private void tlAdd_Click(object sender, EventArgs e)
        {
            this.tlYes.Enabled = true;
            this.tlReturn.Enabled = true;
            this.tlAdd.Enabled = false;
            this.tlEdit.Enabled = false;
            this.tlDelete.Enabled = false;
        }
        //返回
        private void tlReturn_Click(object sender, EventArgs e)
        {
            this.tlYes.Enabled = false;
            this.tlReturn.Enabled = false;
            this.tlAdd.Enabled = true;
            this.tlEdit.Enabled = true;
            this.tlDelete.Enabled = true;
        }

        private void tlYes_Click(object sender, EventArgs e)
        {
            baseclass.AddNew(txtName.Text, strName);
            this.bind();
        }

        private void tlEdit_Click(object sender, EventArgs e)
        {
            if (txtName.Text=="")
            {
                MessageBox.Show("名称不能为空!");
            }
            else
            {
                string strid = dgvInfo[0, dgvInfo.CurrentCell.RowIndex].Value.ToString();
                baseclass.Edit(txtName.Text, strName, strid);
                this.bind();
            }

        }
        //绑定dgvInfo
        public void bind()
        {
            this.dgvInfo.DataSource = sqlclass.SqlDaAd("select * from " + strName, strName).Tables[strName];
        }

        private void tlDelete_Click(object sender, EventArgs e)
        {
            string strid = dgvInfo[0, dgvInfo.CurrentCell.RowIndex].Value.ToString();
            baseclass.del(strName,strid);
            this.bind();
        }

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

⌨️ 快捷键说明

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