allWindowsWithoutPasswordValidation
BIN
demo15012025/.DS_Store
vendored
@ -7,7 +7,7 @@
|
|||||||
Title="Auth">
|
Title="Auth">
|
||||||
<DockPanel Background="Bisque">
|
<DockPanel Background="Bisque">
|
||||||
<StackPanel Spacing="5" HorizontalAlignment="Center" VerticalAlignment="Center">
|
<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"/>
|
<TextBox x:Name="Password" Width="200" Watermark="password"/>
|
||||||
<Button Click="AuthButton_OnClick" Content="auth" Foreground="Black" Background="LightGray"/>
|
<Button Click="AuthButton_OnClick" Content="auth" Foreground="Black" Background="LightGray"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -8,7 +8,6 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using AvaloniaApplication2.Models;
|
|
||||||
using demo15012025.Models;
|
using demo15012025.Models;
|
||||||
using demo15012025.ModelsMine;
|
using demo15012025.ModelsMine;
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using demo15012025.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace AvaloniaApplication2.Models;
|
namespace demo15012025.Models;
|
||||||
|
|
||||||
public partial class DatabaseContext : DbContext
|
public partial class DatabaseContext : DbContext
|
||||||
{
|
{
|
||||||
|
@ -5,57 +5,57 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="demo15012025.RegJhuri"
|
x:Class="demo15012025.RegJhuri"
|
||||||
Title="RegJhuri">
|
Title="RegJhuri">
|
||||||
<DockPanel>
|
<DockPanel Background="Beige">
|
||||||
|
<TextBlock Text="Регистрация жюри/модераторов" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center" DockPanel.Dock="Top" Foreground="Black"/>
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="15">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="15">
|
||||||
|
|
||||||
<TextBlock Text="Id Number:" VerticalAlignment="Top"/>
|
<TextBlock Text="Id Number:" VerticalAlignment="Top" Foreground="Black"/>
|
||||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextId"/>
|
<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"/>
|
<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">
|
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="TextGender" SelectionChanged="OnGenderSelectionChanged">
|
||||||
<ComboBoxItem Content="Мужской" x:Name="M"/>
|
<ComboBoxItem Content="Мужской" x:Name="M"/>
|
||||||
<ComboBoxItem Content="Женский" x:Name="F"/>
|
<ComboBoxItem Content="Женский" x:Name="F"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Text="Роль:" VerticalAlignment="Top"/>
|
<TextBlock Text="Роль:" VerticalAlignment="Top" Foreground="Black"/>
|
||||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="TextRole" SelectionChanged="OnRoleSelectionChanged">
|
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="TextRole" SelectionChanged="OnRoleSelectionChanged">
|
||||||
<ComboBoxItem Content="Жюри" x:Name="Jhuri"/>
|
<ComboBoxItem Content="Жюри" x:Name="Jhuri"/>
|
||||||
<ComboBoxItem Content="Модератор" x:Name="Moderator"/>
|
<ComboBoxItem Content="Модератор" x:Name="Moderator"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Text="Email:" VerticalAlignment="Top"/>
|
<TextBlock Text="Email:" VerticalAlignment="Top" Foreground="Black"/>
|
||||||
<TextBox Width="250" HorizontalAlignment="Left" x:Name="TextEmail"/>
|
<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"/>
|
<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"/>
|
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="ComboBoxDirection"/>
|
||||||
|
|
||||||
<CheckBox Content="Прикрепить к мероприятию" HorizontalAlignment="Right"/>
|
<TextBlock Text="Мероприятие:" VerticalAlignment="Top" Foreground="Black"/>
|
||||||
|
|
||||||
<TextBlock Text="Мероприятие:" VerticalAlignment="Top"/>
|
|
||||||
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="ComboBoxEvent"/>
|
<ComboBox Width="250" HorizontalAlignment="Left" x:Name="ComboBoxEvent"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="15">
|
<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"/>
|
<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"/>
|
<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">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||||
<Button Content="Ok" HorizontalAlignment="Right" Click="OkButton_OnClick"/>
|
<Button Content="Ok" HorizontalAlignment="Right" Click="OkButton_OnClick" Foreground="Black" Background="LightGray"/>
|
||||||
<Button Content="Отмена" HorizontalAlignment="Right"/>
|
<Button Content="Отмена" HorizontalAlignment="Right" Foreground="Black" Background="LightGray"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using AvaloniaApplication2.Models;
|
using Avalonia.Media.Imaging;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
using demo15012025.Models;
|
using demo15012025.Models;
|
||||||
|
|
||||||
namespace demo15012025;
|
namespace demo15012025;
|
||||||
@ -16,18 +19,20 @@ public partial class RegJhuri : Window
|
|||||||
public string gender { get; set; }
|
public string gender { get; set; }
|
||||||
public string role { get; set; }
|
public string role { get; set; }
|
||||||
public Client returnClient { 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()
|
public RegJhuri()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
using var context = new DatabaseContext();
|
using var context = new DatabaseContext();
|
||||||
var events = MainWindow.EventAuthList;
|
SpecList = context.Directions.Select(it => it.Name).ToList();
|
||||||
var spec = context.Directions.Select(it => new Direction
|
ComboBoxDirection.ItemsSource = SpecList;
|
||||||
{
|
EventList = context.Events.Select(it => it.Sobitie).ToList();
|
||||||
Id = it.Id,
|
ComboBoxEvent.ItemsSource = EventList;
|
||||||
Name = it.Name,
|
var maxId = context.Clients.Max(it => it.Id);
|
||||||
});
|
TextId.Text = maxId.ToString();
|
||||||
ComboBoxDirection.ItemsSource = spec;
|
|
||||||
ComboBoxEvent.ItemsSource = events;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGenderSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
private void OnGenderSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
@ -38,8 +43,7 @@ public partial class RegJhuri : Window
|
|||||||
if (selectedItem != null)
|
if (selectedItem != null)
|
||||||
{
|
{
|
||||||
string content = selectedItem.Content.ToString();
|
string content = selectedItem.Content.ToString();
|
||||||
|
gender = content == "Мужской" ? "M" : "F";
|
||||||
string gender = content == "Мужской" ? "M" : "F";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +55,7 @@ public partial class RegJhuri : Window
|
|||||||
if (selectedItem != null)
|
if (selectedItem != null)
|
||||||
{
|
{
|
||||||
string content = selectedItem.Content.ToString();
|
string content = selectedItem.Content.ToString();
|
||||||
|
role = content == "Жюри" ? "3" : content == "Модератор" ? "4" : "0"; // Обновляем свойство role
|
||||||
int role = content == "Жюри" ? 3 : content == "Модератор" ? 4 : 0;
|
|
||||||
|
|
||||||
Console.WriteLine($"Выбрана роль с ID: {role}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ public partial class RegJhuri : Window
|
|||||||
private void OkButton_OnClick(object? sender, RoutedEventArgs e)
|
private void OkButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
using var context = new DatabaseContext();
|
using var context = new DatabaseContext();
|
||||||
|
|
||||||
var maxId = context.Clients.Max(client => client.Id);
|
var maxId = context.Clients.Max(client => client.Id);
|
||||||
var returnId = maxId + 1;
|
var returnId = maxId + 1;
|
||||||
var returnFio = TextFio.Text;
|
var returnFio = TextFio.Text;
|
||||||
@ -83,16 +85,33 @@ public partial class RegJhuri : Window
|
|||||||
var returnRole = role;
|
var returnRole = role;
|
||||||
var returnEmail = TextEmail.Text;
|
var returnEmail = TextEmail.Text;
|
||||||
var returnPhone = PhoneTextBox.Text;
|
var returnPhone = PhoneTextBox.Text;
|
||||||
|
|
||||||
var returnSpec = ComboBoxDirection.SelectedItem;
|
var returnSpec = ComboBoxDirection.SelectedItem;
|
||||||
var returnEvent = ComboBoxEvent.SelectedItem;
|
var returnEvent = ComboBoxEvent.SelectedItem;
|
||||||
|
|
||||||
|
if (returnSpec == null || returnEvent == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Направление или мероприятие не выбрано.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var returnPassword = TextPassword.Text;
|
var returnPassword = TextPassword.Text;
|
||||||
var returnPassword2 = TextRePassword.Text;
|
var returnPassword2 = TextRePassword.Text;
|
||||||
if (returnPassword != returnPassword2)
|
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)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Направление или мероприятие не найдено.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
returnClient = new Client()
|
returnClient = new Client()
|
||||||
{
|
{
|
||||||
Id = returnId,
|
Id = returnId,
|
||||||
@ -101,11 +120,44 @@ public partial class RegJhuri : Window
|
|||||||
Role = int.Parse(returnRole),
|
Role = int.Parse(returnRole),
|
||||||
Email = returnEmail,
|
Email = returnEmail,
|
||||||
Phone = returnPhone,
|
Phone = returnPhone,
|
||||||
SpecId = context.Directions.FirstOrDefault(it => it.Name == returnSpec).Id,
|
SpecId = specId.Value,
|
||||||
EventId = context.Events.FirstOrDefault(it => it.Sobitie == returnEvent).Id,
|
EventId = eventId.Value,
|
||||||
Password = returnPassword,
|
Password = returnPassword,
|
||||||
|
Photopath = $"{newGuidPhoto}.jpg",
|
||||||
|
Country = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
context.Clients.Add(returnClient);
|
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()
|
||||||
|
{
|
||||||
|
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.AssemblyCompanyAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
ad77349803af53c5bfc1e7ca37edc522319a7f41648c37032eba4b36ce3ef074
|
9be47889b8d73cd0463d35e7868addd6cbb3ce57cb06c77fc2cd288c4821de5c
|
||||||
|