51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Collections.ObjectModel;
|
||
|
using System.IO;
|
||
|
using System.Linq;
|
||
|
using System.Text.RegularExpressions;
|
||
|
using Avalonia.Controls;
|
||
|
using Avalonia.Input;
|
||
|
using Avalonia.Interactivity;
|
||
|
using Avalonia.Media.Imaging;
|
||
|
using demo4_true.Models;
|
||
|
using demo4_true.ModelsMy;
|
||
|
|
||
|
namespace demo4_true;
|
||
|
|
||
|
public partial class Auth : Window
|
||
|
{
|
||
|
public Auth()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
||
|
{
|
||
|
var idText = Id?.Text;
|
||
|
var password = Password?.Text;
|
||
|
|
||
|
if (int.TryParse(idText, out var id))
|
||
|
{
|
||
|
var client = MainWindow.ClientAuthList?.FirstOrDefault(it => it.Id == id);
|
||
|
|
||
|
if (client != null && client.Password == password)
|
||
|
{
|
||
|
Console.WriteLine("success");
|
||
|
if (client.Role == 1)
|
||
|
{
|
||
|
Organizator organizatorWindow = new Organizator(client);
|
||
|
organizatorWindow.ShowDialog(this);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Console.WriteLine("wrong");
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Console.WriteLine("Invalid ID format");
|
||
|
}
|
||
|
}
|
||
|
}
|