using Sibintec.Classes; using Sibintec.Models; using Sibintec.Writer; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Diagnostics; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using Sibintec.Reader; namespace Sibintec { /// <summary> /// Логика взаимодействия для Authorization.xaml /// </summary> public partial class Authorization : Window { public Authorization() { InitializeComponent(); } private int loginAttempts = 0; private void Enter_Click(object sender, RoutedEventArgs e) { if (txtLogin.Text.Length != 0 && txtPassword.Password.Length != 0) { User user = App.context.Users.ToList().Find(u => u.Email == txtLogin.Text && u.Password == txtPassword.Password); if (user == null) { MessageBox.Show("Вы ввели неверные данные!"); loginAttempts++; if (loginAttempts >= 3) { Captcha captcha = new Captcha(); captcha.Show(); this.Close(); } } else if (user.Idpermission == 1) { Alldata.ID = user.Iduser; MenuReader menuReader = new MenuReader(); menuReader.Show(); this.Close(); } else if (user.Idpermission == 2) { Alldata.ID = user.Iduser; MenuWriter menuWriter = new MenuWriter(); menuWriter.Show(); this.Close(); } else { MessageBox.Show("Вы ввели неверные данные!"); } } else MessageBox.Show("Вы должны заполнить все поля!"); } private void exit_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = MessageBox.Show("Вы уверены, что хотите выйти?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (messageBoxResult == MessageBoxResult.Yes) { Environment.Exit(0); } }
License
—
Deps
0
Install Size
—
Vulns
✓ 0
Published
Apr 13, 2024
$ dotnet add package UKSIVTSOSATNo README available.