| | |
| | | using System.Windows.Forms; |
| | | using System.Configuration; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Internal; |
| | | using HStation.WinFrmUI; |
| | | |
| | | namespace HStation.Desktop |
| | | { |
| | |
| | | |
| | | private void btnLogin_Click(object sender, EventArgs e) |
| | | { |
| | | Login(); |
| | | LocalLogin(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | |
| | | //登录 |
| | | //登录 (远程登录) |
| | | private async void Login() |
| | | { |
| | | if (!Valid()) |
| | |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | //本地登录 |
| | | private async void LocalLogin() |
| | | { |
| | | if (!Valid()) |
| | | return; |
| | | var bll = new BLL.LoginUserMain(); |
| | | var alluser = await bll.GetAll(); |
| | | bool found = false; |
| | | foreach (var item in alluser) |
| | | { |
| | | if (item.LoginName == this.txtLoginName.Text.Trim() && item.PassWord == this.txtPwd.Text.Trim()) |
| | | { |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!found) |
| | | { |
| | | MessageBoxHelper.ShowError("登录失败"); |
| | | this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
| | | } |
| | | } |
| | | } |
| | | } |