KalkulatorISP-31rrrrr/source/repos/WinFormsApp4/Form1.cs
2025-11-11 14:18:33 +04:00

42 lines
1013 B
C#

using WinFormsApp4.Controllers;
using WinFormsApp4.Models;
namespace WinFormsApp4
{
public partial class Form1 : Form
{
public UserController _userController { get; set; } = new();
public Form1()
{
InitializeComponent();
}
private void loginButton_Click(object sender, EventArgs e)
{
string login = loginTextBox.Text;
string password = pwdTextBox.Text;
try
{
User? user = _userController.Authorize(login, password);
if (user == null)
{
MessageBox.Show("ÏÎÏÐÎÁÓÉ ÑÍÎÂÀ ÈËÈ ÇÀÊÐÎÉ ÏÐÎÃÐÀÌÌÓ, ÑÛÍÎÊ!");
}
else
{
Form2 form2 = new Form2();
form2.Show();
Hide();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}