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

📄 formempinfo.cs

📁 数据库开发与实例(1+1混合数据库开发实例丛书)人事管理系统的源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;
using System.Drawing.Printing;

namespace HRMan.HROper
{
    public partial class FormEmpInfo : Form
    {
        public FormEmpInfo()
        {
            InitializeComponent();
            emploinfo = this;
            this.Position = 0;
        }

        //初始化窗体
        private void FormEmpInfo_Load(object sender, EventArgs e)
        {            
            DBDataGrid();          
         
        }
      
        public void DBDataGrid()
        {
            string SqlText = "select distinct EmployInfo.eId as 员工编号,EmployInfo.eName as 员工姓名,EmployInfo.eSex as 性别,RaceInfo.rName as 民族,EmployInfo.eMarriage as 婚姻状况,";
            SqlText += "EmployInfo.eParty as 党派,EmployInfo.eBirth as 出生日期,EmployInfo.eNumber as 身份证号,EmployInfo.ePlace as 籍贯,EmployInfo.ePhone as 联系电话,EmployInfo.eAddress as 联系地址,";
            SqlText += "EmployInfo.eEdu as 学历,EmployInfo.ePro as 专业,EmployInfo.eDegree as 学位,EmployInfo.eSchool as 毕业学校,EmployInfo.eDate as 毕业时间,";
            SqlText += "EmployInfo.eEmpTime as 聘用时间,EmployInfo.eEmpType as 聘用方式,EmployInfo.eEmpDataSource as 聘用来源,EmployInfo.eApp as 员工状态,";
            SqlText += "SectionInfo.sName as 所在部门,JobInfo.JName as 所任职务,Title.tName as 所获职称,EndowmentInfo.endId,EndowmentInfo.enId as 养老保险号,";
            SqlText += "MedicalInfo.meId,MedicalInfo.mId as 医疗保险号,WagesInfo.waId,WagesInfo.Id as 工资号 ";
            SqlText += "from EmployInfo,RaceInfo,SectionInfo,JobInfo,Title,EndowmentInfo,MedicalInfo,WagesInfo ";
            SqlText += "where EmployInfo.rId=RaceInfo.rId and EmployInfo.sId=SectionInfo.sId and JobInfo.jId=EmployInfo.jId and Title.tId=EmployInfo.tId and ";
            SqlText += "EndowmentInfo.endId=EmployInfo.endId and MedicalInfo.meId=EmployInfo.meId and WagesInfo.waId=EmployInfo.waId order by eId asc";
            DataAccess dd = new DataAccess();
            this.table = dd.ExeSQLdt(SqlText);
            this.dataGrid1.DataSource = this.table.DefaultView;
            this.cm = (CurrencyManager)this.BindingContext[this.table];
            
            if (this.dataGrid1.Rows.Count != 0)
            {
                for (int i = 0; i < this.dataGrid1.Rows.Count; )
                {
                    this.dataGrid1.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Pink;
                    i += 2;
                }
            }
        }
       



      
        //添加
        private void InsertEmp(object sender, System.EventArgs e)
        {
            HRMan.HROper.FormEmpInfo.emploID = "insert";
            this.Enabled = false;
            if (FormMain.FM.CheckForm("FormAddEmp") == true) 
            {
                return;
            }
            else
            {
                HRMan.HROper.FormAddEmp addemp = new FormAddEmp();
                addemp.MdiParent = FormMain.FM;
                addemp.Show();
            }
        }

        //修改
        private void UpdateEmp(object sender, System.EventArgs e)
        {
            HRMan.HROper.FormEmpInfo.emploID = "update";  
            this.Enabled = false;
            if (this.dataGrid1.SelectedCells.Count <= 0)
                return;
           
            HRMan.HROper.FormEmpInfo.emploinfo.ID = this.dataGrid1[0,this.dataGrid1.CurrentCellAddress.Y].Value.ToString();

            if (FormMain.FM.CheckForm("FormAddEmp") == true)
            {
                return;
            }
            else
            {
                HRMan.HROper.FormAddEmp addemp = new FormAddEmp();
                addemp.MdiParent = FormMain.FM;
                addemp.Show();
            }

        }

        //删除
        private void DeleteEmp(object sender, System.EventArgs e)
        {
            DialogResult result = MessageBox.Show("是否删除此记录?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                string[] SqlText = new string[12];
                SqlText[0] = "delete from EmployInfo where eId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[1] = "delete from EndowmentInfo where endId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[2] = "delete from HolidayInfo where hId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[3] = "delete from MedicalInfo where meId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[4] = "delete from Photo where phId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[5] = "delete from PpInfo where pId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[6] = "delete from SocietyInfo where seId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[7] = "delete from TitleInfo where tiId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[8] = "delete from TrainInfo where trId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[9] = "delete from TransferInfo where traId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[10] = "delete from WagesInfo where waId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                SqlText[11] = "delete from WorkInfo where wId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCellAddress.Y, 0].Value.ToString());
                DataAccess DA = new DataAccess();
                DA.ExeSQLs(SqlText);
                MessageBox.Show("删除成功!");
            }
            if (result == DialogResult.No)
            {
                return;
            }
            this.DBDataGrid();

        }

        //退出
        private void ExitEmp(object sender, System.EventArgs e)
        {
            this.Close();
        }

        //查找
        private void Search(object sender, System.EventArgs e)
        {
            this.groupBox1.Visible = true;
            this.dataGrid1.Dock = DockStyle.None;
            this.dataGrid1.Location = new Point(128, 128);
            this.dataGrid1.Size = new Size(808, 328);
        }

       
     

      

       
        private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            switch (e.Node.Text)
            {
                case "全部":
                    {
                        this.DBDataGrid();
                        break;
                    }
                #region 党派为群众的员工档案
                case "群众":
                    {
                        string SqlText = "select distinct EmployInfo.eId as 员工编号,EmployInfo.eName as 员工姓名,EmployInfo.eSex as 性别,RaceInfo.rName as 民族,EmployInfo.eMarriage as 婚否,";
                        SqlText += "EmployInfo.eParty as 党派,EmployInfo.eBirth as 出生日期,EmployInfo.eNumber as 身份证号,EmployInfo.ePlace as 籍贯,EmployInfo.ePhone as 联系电话,EmployInfo.eAddress as 联系地址,";

⌨️ 快捷键说明

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