allWindowsWithoutPasswordValidation
BIN
demo15012025/.DS_Store
vendored
@ -7,7 +7,7 @@
|
||||
Title="Auth">
|
||||
<DockPanel Background="Bisque">
|
||||
<StackPanel Spacing="5" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBox x:Name="Id" Width="200" Watermark="id"/>
|
||||
<TextBox x:Name="Id" Width="200" Watermark="login"/>
|
||||
<TextBox x:Name="Password" Width="200" Watermark="password"/>
|
||||
<Button Click="AuthButton_OnClick" Content="auth" Foreground="Black" Background="LightGray"/>
|
||||
</StackPanel>
|
||||
|
@ -8,7 +8,6 @@ using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media.Imaging;
|
||||
using AvaloniaApplication2.Models;
|
||||
using demo15012025.Models;
|
||||
using demo15012025.ModelsMine;
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using demo15012025.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AvaloniaApplication2.Models;
|
||||
namespace demo15012025.Models;
|
||||
|
||||
public partial class DatabaseContext : DbContext
|
||||
{
|
||||
|
@ -5,57 +5,57 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="demo15012025.RegJhuri"
|
||||
Title="RegJhuri">
|
||||
<DockPanel>
|
||||
<DockPanel Background="Beige">
|
||||
<TextBlock Text="Регистрация жюри/модераторов" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center" DockPanel.Dock="Top" Foreground="Black"/>
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="15">
|
||||
|
||||
<TextBlock Text="Id Number:" VerticalAlignment="Top"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextId"/>
|
||||
<TextBlock Text="Id Number:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextId" IsReadOnly="True" Background="Gray"/>
|
||||
|
||||
<TextBlock Text="Фио:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Фио:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextFio"/>
|
||||
|
||||
<TextBlock Text="Пол:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Пол:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="TextGender" SelectionChanged="OnGenderSelectionChanged">
|
||||
<ComboBoxItem Content="Мужской" x:Name="M"/>
|
||||
<ComboBoxItem Content="Женский" x:Name="F"/>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Text="Роль:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Роль:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="TextRole" SelectionChanged="OnRoleSelectionChanged">
|
||||
<ComboBoxItem Content="Жюри" x:Name="Jhuri"/>
|
||||
<ComboBoxItem Content="Модератор" x:Name="Moderator"/>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Text="Email:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Email:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextEmail"/>
|
||||
|
||||
<TextBlock Text="Телефон:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Телефон:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" Name="PhoneTextBox" Text="+7 " KeyUp="PhoneTextBox_OnKeyUp" HorizontalAlignment="Left" x:Name="TextPhone"/>
|
||||
|
||||
<TextBlock Text="Направление:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Направление:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="ComboBoxDirection"/>
|
||||
|
||||
<CheckBox Content="Прикрепить к мероприятию" HorizontalAlignment="Right"/>
|
||||
|
||||
<TextBlock Text="Мероприятие:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Мероприятие:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="ComboBoxEvent"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="15">
|
||||
<Rectangle Width="200" Height="250" Fill="Gray" HorizontalAlignment="Right"/>
|
||||
<Button Width="105" x:Name="SelectImageButton" Content="Select Image" Click="SelectImage" Foreground="Black" Background="LightGray"/>
|
||||
<Image Width="200" Height="250" x:Name="ServiceImage"/>
|
||||
|
||||
<TextBlock Text="Пароль:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Пароль:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" Watermark="Password" x:Name="TextPassword"/>
|
||||
|
||||
<TextBlock Text="Повтор пароля:" VerticalAlignment="Top"/>
|
||||
<TextBlock Text="Повтор пароля:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" Watermark="Re-enter password" x:Name="TextRePassword"/>
|
||||
|
||||
<CheckBox Content="Видимый пароль" HorizontalAlignment="Right"/>
|
||||
<CheckBox Content="Видимый пароль" HorizontalAlignment="Right" Foreground="Black"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<Button Content="Ok" HorizontalAlignment="Right" Click="OkButton_OnClick"/>
|
||||
<Button Content="Отмена" HorizontalAlignment="Right"/>
|
||||
<Button Content="Ok" HorizontalAlignment="Right" Click="OkButton_OnClick" Foreground="Black" Background="LightGray"/>
|
||||
<Button Content="Отмена" HorizontalAlignment="Right" Foreground="Black" Background="LightGray"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
@ -1,12 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using AvaloniaApplication2.Models;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform.Storage;
|
||||
using demo15012025.Models;
|
||||
|
||||
namespace demo15012025;
|
||||
@ -16,18 +19,20 @@ public partial class RegJhuri : Window
|
||||
public string gender { get; set; }
|
||||
public string role { get; set; }
|
||||
public Client returnClient { get; set; }
|
||||
public List<string> SpecList { get; }
|
||||
public List<string> EventList { get; }
|
||||
public string PathToImage = string.Empty;
|
||||
public Guid newGuidPhoto;
|
||||
public RegJhuri()
|
||||
{
|
||||
InitializeComponent();
|
||||
using var context = new DatabaseContext();
|
||||
var events = MainWindow.EventAuthList;
|
||||
var spec = context.Directions.Select(it => new Direction
|
||||
{
|
||||
Id = it.Id,
|
||||
Name = it.Name,
|
||||
});
|
||||
ComboBoxDirection.ItemsSource = spec;
|
||||
ComboBoxEvent.ItemsSource = events;
|
||||
SpecList = context.Directions.Select(it => it.Name).ToList();
|
||||
ComboBoxDirection.ItemsSource = SpecList;
|
||||
EventList = context.Events.Select(it => it.Sobitie).ToList();
|
||||
ComboBoxEvent.ItemsSource = EventList;
|
||||
var maxId = context.Clients.Max(it => it.Id);
|
||||
TextId.Text = maxId.ToString();
|
||||
}
|
||||
|
||||
private void OnGenderSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
@ -38,8 +43,7 @@ public partial class RegJhuri : Window
|
||||
if (selectedItem != null)
|
||||
{
|
||||
string content = selectedItem.Content.ToString();
|
||||
|
||||
string gender = content == "Мужской" ? "M" : "F";
|
||||
gender = content == "Мужской" ? "M" : "F";
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,10 +55,7 @@ public partial class RegJhuri : Window
|
||||
if (selectedItem != null)
|
||||
{
|
||||
string content = selectedItem.Content.ToString();
|
||||
|
||||
int role = content == "Жюри" ? 3 : content == "Модератор" ? 4 : 0;
|
||||
|
||||
Console.WriteLine($"Выбрана роль с ID: {role}");
|
||||
role = content == "Жюри" ? "3" : content == "Модератор" ? "4" : "0"; // Обновляем свойство role
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +77,7 @@ public partial class RegJhuri : Window
|
||||
private void OkButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
using var context = new DatabaseContext();
|
||||
|
||||
var maxId = context.Clients.Max(client => client.Id);
|
||||
var returnId = maxId + 1;
|
||||
var returnFio = TextFio.Text;
|
||||
@ -83,29 +85,79 @@ public partial class RegJhuri : Window
|
||||
var returnRole = role;
|
||||
var returnEmail = TextEmail.Text;
|
||||
var returnPhone = PhoneTextBox.Text;
|
||||
|
||||
var returnSpec = ComboBoxDirection.SelectedItem;
|
||||
var returnEvent = ComboBoxEvent.SelectedItem;
|
||||
|
||||
if (returnSpec == null || returnEvent == null)
|
||||
{
|
||||
Console.WriteLine("Направление или мероприятие не выбрано.");
|
||||
return;
|
||||
}
|
||||
|
||||
var returnPassword = TextPassword.Text;
|
||||
var returnPassword2 = TextRePassword.Text;
|
||||
if (returnPassword != returnPassword2)
|
||||
{
|
||||
Console.WriteLine("wrong passwords");
|
||||
Console.WriteLine("Пароли не совпадают.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
var specId = context.Directions.FirstOrDefault(it => it.Name == returnSpec)?.Id;
|
||||
var eventId = context.Events.FirstOrDefault(it => it.Sobitie == returnEvent)?.Id;
|
||||
|
||||
if (specId == null || eventId == null)
|
||||
{
|
||||
returnClient = new Client()
|
||||
Console.WriteLine("Направление или мероприятие не найдено.");
|
||||
return;
|
||||
}
|
||||
|
||||
returnClient = new Client()
|
||||
{
|
||||
Id = returnId,
|
||||
Fio = returnFio,
|
||||
Gender = returnGender[0],
|
||||
Role = int.Parse(returnRole),
|
||||
Email = returnEmail,
|
||||
Phone = returnPhone,
|
||||
SpecId = specId.Value,
|
||||
EventId = eventId.Value,
|
||||
Password = returnPassword,
|
||||
Photopath = $"{newGuidPhoto}.jpg",
|
||||
Country = 1,
|
||||
};
|
||||
|
||||
context.Clients.Add(returnClient);
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
private async void SelectImage(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ServiceImage.Source = await SelectAndSaveImage();
|
||||
}
|
||||
|
||||
private async Task<Bitmap?> SelectAndSaveImage()
|
||||
{
|
||||
var showDialog = StorageProvider.OpenFilePickerAsync(
|
||||
options: new Avalonia.Platform.Storage.FilePickerOpenOptions()
|
||||
{
|
||||
Id = returnId,
|
||||
Fio = returnFio,
|
||||
Gender = returnGender[0],
|
||||
Role = int.Parse(returnRole),
|
||||
Email = returnEmail,
|
||||
Phone = returnPhone,
|
||||
SpecId = context.Directions.FirstOrDefault(it => it.Name == returnSpec).Id,
|
||||
EventId = context.Events.FirstOrDefault(it => it.Sobitie == returnEvent).Id,
|
||||
Password = returnPassword,
|
||||
};
|
||||
context.Clients.Add(returnClient);
|
||||
Title = "Select an image",
|
||||
FileTypeFilter = new[] { FilePickerFileTypes.ImageAll }
|
||||
});
|
||||
var storageFile = await showDialog;
|
||||
try
|
||||
{
|
||||
var bmp = new Bitmap(storageFile.First().TryGetLocalPath());
|
||||
newGuidPhoto = Guid.NewGuid();
|
||||
string path = $"/Users/rinchi/RiderProjects/demo15012025/demo15012025/bin/Debug/net8.0/{newGuidPhoto}.jpg";
|
||||
bmp.Save(path);
|
||||
PathToImage = path;
|
||||
Console.WriteLine(PathToImage);
|
||||
return bmp;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
demo15012025/bin/.DS_Store
vendored
BIN
demo15012025/bin/Debug/.DS_Store
vendored
BIN
demo15012025/bin/Debug/net8.0/.DS_Store
vendored
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 537 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 273 KiB |
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d823905d6c3ec8eb41766b1ca3e569530bce21a7")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fe0ba9320c7b42e3e952670b2be10fb55490eb04")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
ad77349803af53c5bfc1e7ca37edc522319a7f41648c37032eba4b36ce3ef074
|
||||
9be47889b8d73cd0463d35e7868addd6cbb3ce57cb06c77fc2cd288c4821de5c
|
||||
|