欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

C#人力资源管理系统

程序员文章站 2022-05-13 20:23:34
...

人力资源管理系统

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 人力资源管理系统
{
    public partial class main : Form
    {
        public main()
        {
            InitializeComponent();
        }

        private void main_Load(object sender, EventArgs e)
        {
            this.Text = "人力资源管理系统";
            groupBox1.Visible = false;
            groupBox2.Visible = false;
            groupBox3.Visible = false;
            foreach (TreeNode item in treeView1.Nodes)
            {

                //MessageBox.Show(((TreeNode)item).Text);
                comboBox1.Items.Add(item.Text);
                comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
                comboBox1.SelectedIndex = 0;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {

            toolStripStatusLabel4.Text = DateTime.Now.ToString();//显示当前时间
        }

        private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            groupBox1.Visible = true;//出现
            groupBox2.Visible = false;
            groupBox3.Visible = false;


        }
        //const string rsid = "123456", rpwd = "12345";
        //const string ygid = "1234", ygpwd = "123";
        //const string glyid = "12345", glypwd = "1234";
        private void button1_Click(object sender, EventArgs e)
        {
            string oldpwd = textBox1.Text;
            string newpwd = textBox2.Text;
            string repwd = textBox3.Text;
            if (oldpwd==""||newpwd==""||repwd=="")
            {
                MessageBox.Show("请输入正确的密码");
                return;
            }
            if (oldpwd.Equals("12345") || oldpwd.Equals("123") || oldpwd.Equals("1234"))
            {
                if (newpwd.Equals(repwd))
                {
                    DialogResult result=MessageBox.Show("修改密码成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
                    if (result == DialogResult.OK)

                    {
                        groupBox1.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show("重复密码和新密码一致,请重新输入");
                    }
                }
            }
            else
            {
                MessageBox.Show("密码错误请重新输入");
            }
        }

        private void 退出登录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void 切换账号ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 form = new Form1();
            form.Show();
        }

        private void 员工添加ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            label1.Hide();
            groupBox2.Visible = true;
            groupBox1.Visible = false;
            groupBox3.Visible = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string name = textBox4.Text;
            if (name == "")
            {
                MessageBox.Show("请输入姓名!");
                return;
            }
            string cname = comboBox1.SelectedItem.ToString();
            foreach (TreeNode item in treeView1.Nodes)
            {
                if (item.Text == cname)
                {
                    item.Nodes.Add(name);
                    textBox4.Text = "";
                }
            }
        }

        private void 设置字体ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fontDialog1.ShowDialog();
            this.Font = fontDialog1.Font;
        }

        private void 绿的ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackColor = Color.Green;
        }

        private void 红色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            this.BackColor = Color.PaleVioletRed;
        }

        private void 蓝色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackColor = Color.Blue;
        }

        private void 粉色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackColor = Color.DeepPink;
        }

        private void 黄色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackColor = Color.Orange;
        }

        private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;
            foreach (TreeNode item in treeView1.Nodes)
            {
                if (node.Text == item.Text)
                {
                    MessageBox.Show("不能删除班级!");
                    return;
                }
            }
           
            node.Remove();
        }

        private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string oldpwd = textBox1.Text;
            string newpwd = textBox2.Text;
            string repwd = textBox3.Text;
            if (oldpwd == "" || newpwd == "" || repwd == "")
            {
                MessageBox.Show("请输入正确的密码");
                return;
            }
            if (oldpwd.Equals("12345") || oldpwd.Equals("123") || oldpwd.Equals("1234"))
            {
                if (newpwd.Equals(repwd))
                {
                    DialogResult result = MessageBox.Show("修改密码成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (result == DialogResult.OK)

                    {
                        groupBox1.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show("重复密码和新密码一致,请重新输入");
                    }
                }
            }
            else
            {
                MessageBox.Show("密码错误请重新输入");
            }
        }

        private void 个人信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            groupBox3.Visible = true;
            groupBox2.Visible = false;
            groupBox1.Visible = false;
            label1.Hide();
        }

        private void 领导查看ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

运行结果:
C#人力资源管理系统
C#人力资源管理系统##
C#人力资源管理系统