duheng
2024-07-23 64fc752794b8bdb846f7af17c7722955363a2a8b
Desktop/HStation.DeskTop.Xhs.Main/Login/LoginFrm.cs
@@ -9,6 +9,8 @@
using System.Windows.Forms;
using System.Configuration;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Internal;
using HStation.WinFrmUI;
namespace HStation.Desktop
{
@@ -47,7 +49,7 @@
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Login();
            LocalLogin();
        }
        /// <summary>
@@ -106,7 +108,7 @@
            }
        }
        //登录
        //登录  (远程登录)
        private async void Login()
        {
            if (!Valid())
@@ -142,5 +144,30 @@
            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;
            }
        }
    }
}