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

📄 loginform.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 DaFanRongMIS.Model.Login;
using System.Management;
using System.IO;


namespace DaFanRongMIS.ViewController
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }
        private void btnOK_Click(object sender, EventArgs e)
        {

            LoginEntity lE = new LoginEntity();
            lE.UserID = this.txtUserID.Text;
            lE.Password = this.txtPassword.Text;
            ManagementObjectSearcher nisc = new ManagementObjectSearcher("select * from Win32_NetworkAdapterConfiguration");
            foreach (ManagementObject nic in nisc.Get())
            {
                if (Convert.ToBoolean(nic["ipEnabled"]) == true)
                {
                    lE.mAC = Convert.ToString(nic["MACAddress"]);

                }
            }
            LoginDAO lDAO = new LoginDAOImpl();

            string str=lDAO.Login(lE);
           
            if (str == "OK")
            {
                if (this.txtUserID.Text == "admin")
                {
                    DaFanRongMIS.Model.Common.ConnectionDataBase.Userid = txtUserID.Text;
                    DaFanRongMIS.ViewController.Common.MainForm frm = new DaFanRongMIS.ViewController.Common.MainForm(txtUserID.Text,txtPassword.Text,"正常");

                    this.Hide();
                    frm.Show();
                }
                else
                {
                    DaFanRongMIS.Model.Common.ConnectionDataBase.Userid = txtUserID.Text;
                    DaFanRongMIS.ViewController.Sell.SellsForm frm = new DaFanRongMIS.ViewController.Sell.SellsForm();
                    this.Hide();
                    frm.Show();
                }
            }
            else if (str == "Error")
            {
                MessageBox.Show("请在指定的机器上登录");
                this.txtUserID.Text = "";
                this.txtPassword.Text = "";
                this.txtUserID.Focus();
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
                this.txtUserID.Text = "";
                this.txtPassword.Text = "";
                this.txtUserID.Focus();

            }

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.txtUserID.Text = "";
            this.txtPassword.Text = "";
            this.txtUserID.Focus();
        }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            this.txtUserID.Focus();
        }

      
    }
}

⌨️ 快捷键说明

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