using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
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 HighWayIot.Winform.MainForm
{
public partial class LoginForm : Form
{
SysUserInfoService sysUserInfoService = SysUserInfoService.Instance;
public LoginForm()
{
InitializeComponent();
}
///
/// 登陆验证
///
///
///
private void Login_Click(object sender, EventArgs e)
{
//验证账号密码,或从数据库验证成功
var lists = sysUserInfoService.GetUserInfoByUserName(UserText.Text);
if (lists.Count == 1 && lists.First().Password == PassText.Text)
{
lists.First().LastLoginTime = DateTime.Now;
RoleBusiness.LoginUserName = UserText.Text;
sysUserInfoService.UpdateUserInfo(lists.First());
DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show("账号或密码错误!");
return;
}
}
}
}