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

📄 form_main.cs

📁 .net 2005 c# 完整的门禁考勤系统
💻 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.Odbc ;
namespace AttendManager
{
    public partial class Form_Main : Form
    {
        public string m_sUser;
        public string m_sPW;
        public int m_iUserTpye;

        public  OdbcConnection  m_connection;

        
        public Form_UserManage m_fUM;
        public Form_PersonManage m_fPM;

        public Form_Main()
        {
            InitializeComponent();
        }

        private void Form_Main_Load(object sender, EventArgs e)
        {

            this.考勤管理ToolStripMenuItem.Enabled = false;
            this.修改密码ToolStripMenuItem.Enabled = false;
            this.员工信息管理ToolStripMenuItem.Enabled = false;
            this.考勤管理ToolStripMenuItem.Enabled = false;
            this.重新登录ToolStripMenuItem.Enabled = false;
            this.考勤报表ToolStripMenuItem.Enabled = false;
            LoginFrm lF = new LoginFrm(this,"1");
            lF.ShowDialog();

            this.考勤管理ToolStripMenuItem.Enabled = true ;
            this.修改密码ToolStripMenuItem.Enabled = true;
            this.员工信息管理ToolStripMenuItem.Enabled = true;
            this.考勤管理ToolStripMenuItem.Enabled = true;
            this.重新登录ToolStripMenuItem.Enabled = true;
            this.考勤报表ToolStripMenuItem.Enabled = true;

            this.StatusLabel_user.Text  = "       登录用户:" + m_sUser;
            string ss;
            switch (m_iUserTpye)
            {
                case 1: 
                    ss=Properties.Settings.Default.UT_1 ;
                    break;
                case 2: 
                    ss=Properties.Settings.Default.UT_2 ;
                    break;
                case 3: 
                    ss=Properties.Settings.Default.UT_3 ;
                    break;
                default:
                    ss=Properties.Settings.Default.UT_4 ;
                    break;
            }
            this.StatusLabel_usertype.Text   = "      用户类型:" + ss;
            DateTime dt=DateTime.Now ;
            this.StatusLabel_LoginTime.Text = "       登录时间:" + dt.ToLongDateString() + "  "+ dt.ToLongTimeString();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //this.StatusLabel_time = now();
        }

        private void 用户管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(m_fUM== null)
            {
                m_fUM = new Form_UserManage(this);
                m_fUM.MdiParent = this;
                m_fUM.Show();
            }
            else
            {
                m_fUM.Activate();
            }
        }

        private void 退出EToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }






        ///======================================================
        public  bool  isEditer()
        {
            return (m_iUserTpye != 2);
        }

        private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_EditPW FF = new Form_EditPW(this );
            FF.ShowDialog();
        }

        private void 重新登录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                //关闭所有打开的窗口
                if (m_fUM != null) {
                    m_fUM.Close();
                    m_fUM = null;
                }
                if (m_fPM != null)
                {
                    m_fPM.Close();
                    m_fPM = null;
                }


                LoginFrm lF = new LoginFrm(this, "1");
                lF.ShowDialog();
                this.StatusLabel_user.Text = "       登录用户:" + m_sUser;
                string ss;
                switch (m_iUserTpye)
                {
                    case 1:
                        ss = Properties.Settings.Default.UT_1;
                        break;
                    case 2:
                        ss = Properties.Settings.Default.UT_2;
                        break;
                    case 3:
                        ss = Properties.Settings.Default.UT_3;
                        break;
                    default:
                        ss = Properties.Settings.Default.UT_4;
                        break;
                }
                this.StatusLabel_usertype.Text = "      用户类型:" + ss;
                DateTime dt = DateTime.Now;
                this.StatusLabel_LoginTime.Text = "       登录时间:" + dt.ToLongDateString() + "  " + dt.ToLongTimeString();
            }
            catch (System.Exception ex)
            {

                MessageBox.Show(ex.Message, "IN 重新登录ToolStripMenuItem_Click()", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {

            }
        }

        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox lF = new AboutBox();
            lF.ShowDialog();
        }

        private void 管理员员工信息AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (m_fPM == null)
            {
                m_fPM = new Form_PersonManage(this);
                m_fPM.MdiParent = this;
                m_fPM.Show();
            }
            else
            {
                m_fPM.Activate();
            }
        }
    }
}

⌨️ 快捷键说明

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