📄 frmlogin.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace EMS
{
public partial class frmLogin : Form
{
BaseClass.BaseInfo baseinfo = new EMS.BaseClass.BaseInfo();
BaseClass.cPopedom popedom = new EMS.BaseClass.cPopedom();
public frmLogin()
{
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (txtUserName.Text == string.Empty)
{
MessageBox.Show("用户名称不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
DataSet ds = null;
popedom.SysUser = txtUserName.Text;
popedom.Password = txtUserPwd.Text;
ds=baseinfo.Login(popedom);
if (ds.Tables[0].Rows.Count > 0)
{
frmMain frm_main = new frmMain();
frm_main.Show();
if (Convert.ToBoolean(ds.Tables[0].Rows[0]["stock"])) frm_main.tlmBuy.Enabled = true;
if (Convert.ToBoolean(ds.Tables[0].Rows[0]["vendition"])) frm_main.tlmSale.Enabled = true;
if (Convert.ToBoolean(ds.Tables[0].Rows[0]["storage"])) frm_main.tlmStock.Enabled = true;
if (Convert.ToBoolean(ds.Tables[0].Rows[0]["system"])) frm_main.tlmSystem.Enabled = true;
if (Convert.ToBoolean(ds.Tables[0].Rows[0]["base"])) frm_main.tlmBase.Enabled = true;
this.Visible = false;
}
else
{
MessageBox.Show("用户名称或密码不正确!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void txtUserName_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13) txtUserPwd.Focus();
}
private void txtUserPwd_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13) btnLogin.Focus();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -