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.
77 lines
2.5 KiB
77 lines
2.5 KiB
|
2 months ago
|
using System;
|
||
|
|
using System.Windows;
|
||
|
|
|
||
|
|
namespace Housing.Login;
|
||
|
|
|
||
|
|
public sealed class StartupLoginWindowResult
|
||
|
|
{
|
||
|
|
public string Maker { get; set; } = string.Empty;
|
||
|
|
public string Model { get; set; } = string.Empty;
|
||
|
|
public string Variant1 { get; set; } = string.Empty;
|
||
|
|
public string Variant2 { get; set; } = string.Empty;
|
||
|
|
public string Operator { get; set; } = string.Empty;
|
||
|
|
public string Password { get; set; } = string.Empty;
|
||
|
|
public string LineNo { get; set; } = string.Empty;
|
||
|
|
public string LotNo { get; set; } = string.Empty;
|
||
|
|
public string JigNo { get; set; } = string.Empty;
|
||
|
|
}
|
||
|
|
|
||
|
|
public partial class StartupLoginWindow : Window
|
||
|
|
{
|
||
|
|
private const string MasterId = "su";
|
||
|
|
private const string MasterPassword = "su";
|
||
|
|
|
||
|
|
public StartupLoginWindowResult Result { get; private set; } = new();
|
||
|
|
|
||
|
|
public StartupLoginWindow()
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
OperatorTextBox.Focus();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void LogInButton_Click(object sender, RoutedEventArgs e)
|
||
|
|
{
|
||
|
|
var loginId = OperatorTextBox.Text.Trim();
|
||
|
|
var password = PasswordBox.Password;
|
||
|
|
|
||
|
|
if (string.IsNullOrWhiteSpace(loginId))
|
||
|
|
{
|
||
|
|
MessageBox.Show(this, "ID를 입력하세요.", "Login", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||
|
|
OperatorTextBox.Focus();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (string.IsNullOrWhiteSpace(password))
|
||
|
|
{
|
||
|
|
MessageBox.Show(this, "PW를 입력하세요.", "Login", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||
|
|
PasswordBox.Focus();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!string.Equals(loginId, MasterId, StringComparison.Ordinal) ||
|
||
|
|
!string.Equals(password, MasterPassword, StringComparison.Ordinal))
|
||
|
|
{
|
||
|
|
MessageBox.Show(this, "마스터 계정만 로그인할 수 있습니다.", "Login", MessageBoxButton.OK, MessageBoxImage.Error);
|
||
|
|
PasswordBox.Clear();
|
||
|
|
PasswordBox.Focus();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
Result = new StartupLoginWindowResult
|
||
|
|
{
|
||
|
|
Maker = MakerTextBox.Text.Trim(),
|
||
|
|
Model = ModelTextBox.Text.Trim(),
|
||
|
|
Variant1 = Variant1TextBox.Text.Trim(),
|
||
|
|
Variant2 = Variant2TextBox.Text.Trim(),
|
||
|
|
Operator = loginId,
|
||
|
|
Password = password,
|
||
|
|
LineNo = LineNoTextBox.Text.Trim(),
|
||
|
|
LotNo = LotNoTextBox.Text.Trim(),
|
||
|
|
JigNo = JigNoTextBox.Text.Trim()
|
||
|
|
};
|
||
|
|
|
||
|
|
DialogResult = true;
|
||
|
|
Close();
|
||
|
|
}
|
||
|
|
}
|