注塑喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

68 lines
1.9 KiB

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;
using MESClassLibrary.BLL.User;
using MESClassLibrary.Model;
namespace PaintingPrintBarCode
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
MessageBox.Show("用户名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox1.Focus();
return;
}
if (string.IsNullOrWhiteSpace(textBox2.Text))
{
MessageBox.Show("密码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox1.Focus();
return;
}
UserBLL bll=new UserBLL();
UserModel md=new UserModel();
md.Username = textBox1.Text.Trim();
md.Password = textBox2.Text.Trim();
if (!bll.Login(md))
{
MessageBox.Show("用户名或密码有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox1.Focus();
return;
}
else
{
DataTable dt = bll.SearchUserInfoByUserName(md.Username);
if (dt != null && dt.Rows.Count > 0)
{
Program.UserName = dt.Rows[0]["RealName"].ToString();
this.Visible = false;
Form fr = new Form1();
fr.Show();
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}