BaoKai_202508_Wms_Jingwang_.../ServerSystem/PassWord.cs
2025-08-24 21:52:42 +08:00

150 lines
3.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 WMS.Business;
using WMS.Business.Base;
using WMS.Common;
using WMS.Model.Base;
namespace ServerSystem
{
public partial class PassWord : Form
{
public UserDataModel userData = new UserDataModel();
public PassWord()
{
InitializeComponent();
}
#region
private bool Validation()
{
#region
if (t_user.Text.Trim().Length == 0)
{
SystemCommon.ShowInfoMessageBox("User iS null");
t_user.Focus();
return false;
}
if (t_passWord.Text.Trim().Length == 0)
{
SystemCommon.ShowInfoMessageBox("PASSWORD is null!");
t_passWord.Focus();
return false;
}
if (!LogUserFrm())
return false;
string passWord = userData.PASSWORD;
if (passWord != t_passWord.Text.Trim())
{
SystemCommon.ShowInfoMessageBox("PASSWORD error!");
t_passWord.Focus();
t_passWord.Text = string.Empty;
return false;
}
#endregion
return true;
}
#endregion
private void btnAccept_Click(object sender, EventArgs e)
{
string errText = string.Empty;
// 验证
if (!Validation())
{
return;
}
string passWord = userData.PASSWORD;
DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void btnClose_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.Cancel ;
}
private void t_passWord_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
}
}
#region
/// <summary>
/// 用户登录
/// </summary>
private bool LogUserFrm()
{
string userNumber = t_user.Text.Trim();
string errText = string.Empty;
string strResult = string.Empty;
try
{
userData = IBussFactory<BussSystemUser>.Instance().GetUserData(userNumber);
if (errText.Trim().Length > 0 || userData == null)
{
SystemCommon.ShowInfoMessageBox(errText);
t_user.Focus();
t_user.SelectAll();
return false;
}
}
catch (Exception ex)
{
SystemCommon.ShowInfoMessageBox("error" + ex.Message.ToString());
return false;
}
t_passWord.Focus();
return true;
}
#endregion
private void t_user_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (t_user.Focused)
{
if (t_user.Text.Trim().Length == 0)
{
SystemCommon.ShowInfoMessageBox("user is null");
t_user.Focus();
return;
}
LogUserFrm();
return;
}
}
}
private void PassWord_Load(object sender, EventArgs e)
{
t_user.Focus();
}
}
}