Microsovft.Framework.Core 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsovft.Framework.Core --version 1.0.4
                    
NuGet\Install-Package Microsovft.Framework.Core -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsovft.Framework.Core" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsovft.Framework.Core" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Microsovft.Framework.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsovft.Framework.Core --version 1.0.4
                    
#r "nuget: Microsovft.Framework.Core, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsovft.Framework.Core@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsovft.Framework.Core&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Microsovft.Framework.Core&version=1.0.4
                    
Install as a Cake Tool

-- 1. Создаем базу данных CREATE DATABASE ИнтернетМагазин; GO

USE ИнтернетМагазин; GO

-- 2. Таблица Клиенты CREATE TABLE Клиенты ( ID_Клиента INT PRIMARY KEY IDENTITY(1,1), Имя_Клиента NVARCHAR(100) NOT NULL, Email_Клиента NVARCHAR(100) UNIQUE NOT NULL, Телефон NVARCHAR(20) ); GO

-- 3. Таблица Адреса_клиентов CREATE TABLE Адреса_клиентов ( ID_Адреса INT PRIMARY KEY IDENTITY(1,1), ID_Клиента INT NOT NULL, Город NVARCHAR(50) NOT NULL, Улица NVARCHAR(100) NOT NULL, Дом NVARCHAR(10) NOT NULL, FOREIGN KEY (ID_Клиента) REFERENCES Клиенты(ID_Клиента) ON DELETE CASCADE ); GO

-- 4. Таблица Категории_товаров CREATE TABLE Категории_товаров ( ID_Категории INT PRIMARY KEY IDENTITY(1,1), Название_категории NVARCHAR(50) NOT NULL UNIQUE ); GO

-- 5. Таблица Товары CREATE TABLE Товары ( ID_Товара INT PRIMARY KEY IDENTITY(1,1), Название_товара NVARCHAR(100) NOT NULL, ID_Категории INT NOT NULL, Текущая_цена DECIMAL(10,2) NOT NULL CHECK (Текущая_цена >= 0), FOREIGN KEY (ID_Категории) REFERENCES Категории_товаров(ID_Категории) ); GO

-- 6. Таблица Статусы_заказов CREATE TABLE Статусы_заказов ( ID_Статуса INT PRIMARY KEY IDENTITY(1,1), Название_статуса NVARCHAR(30) NOT NULL UNIQUE ); GO

-- 7. Таблица Заказы CREATE TABLE Заказы ( ID_Заказа INT PRIMARY KEY IDENTITY(1001,1), Дата_заказа DATE DEFAULT GETDATE(), ID_Статуса INT NOT NULL, ID_Клиента INT NOT NULL, ID_Адреса_доставки INT NOT NULL, FOREIGN KEY (ID_Статуса) REFERENCES Статусы_заказов(ID_Статуса), FOREIGN KEY (ID_Клиента) REFERENCES Клиенты(ID_Клиента), FOREIGN KEY (ID_Адреса_доставки) REFERENCES Адреса_клиентов(ID_Адреса) ); GO

-- 8. Таблица Состав_заказа CREATE TABLE Состав_заказа ( ID_Позиции INT PRIMARY KEY IDENTITY(1,1), ID_Заказа INT NOT NULL, ID_Товара INT NOT NULL, Количество INT NOT NULL CHECK (Количество > 0), Цена_на_момент_заказа DECIMAL(10,2) NOT NULL CHECK (Цена_на_момент_заказа >= 0), FOREIGN KEY (ID_Заказа) REFERENCES Заказы(ID_Заказа), FOREIGN KEY (ID_Товара) REFERENCES Товары(ID_Товара) ); GO

public static class Account { public static Users acc { get; set; } }

<Window x:Class="ConferenceApp.MainWindow"

    Title="Просмотр мероприятий" 
    Height="450" Width="800"
    MaxHeight="550" MaxWidth="900"
    MinHeight="350" MinWidth="700">
<Grid >
    <Grid.RowDefinitions>
        <RowDefinition Height="0.5*"/>
        <RowDefinition Height="3*"/>
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <Label Content="Направление"
           HorizontalAlignment="Center"/>

    <ComboBox x:Name="ComboBoxDirectionFilter"
              Grid.Column="1" Grid.Row="0"
              Margin="5"
              SelectedIndex="0"
              DisplayMemberPath="Name" 
              SelectionChanged="ComboBoxDirectionFilter_SelectionChanged"/>

    <Label Content="Дата"
           Grid.Column="2"
           HorizontalAlignment="Center"/>

    <DatePicker x:Name="DatePickerDateFilter"
              Grid.Column="3" Grid.Row="0"
              Margin="5"
              SelectedDateChanged="DatePickerDateFilter_SelectedDateChanged"/>

    <DataGrid x:Name="DataGridEvents" 
        Grid.Row="1" Grid.Column="0"
        Grid.ColumnSpan="4"
        AutoGenerateColumns="False"
        CanUserAddRows="False"
        CanUserResizeColumns="False"
        CanUserDeleteRows="False"
        CanUserReorderColumns="False">
        <DataGrid.Columns>
            <DataGridTemplateColumn Header="Логотип"
                                   IsReadOnly="True" Width="3*">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <Image Source="{Binding ImagePath}"
                               Stretch="UniformToFill"/>
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>    
            </DataGridTemplateColumn>

            <DataGridTextColumn Header="Наименование" Binding="{Binding Name}" 
                                Width="6*"/>

            <DataGridTextColumn Header="Направление" Binding="{Binding DirectionName}"
                                Width="2*"/>

            <DataGridTextColumn Header="Дата" Binding="{Binding StartDate}"
                                Width="2*"/>
        </DataGrid.Columns>
    </DataGrid>

    <Button x:Name="ButtonAuthorization"
            Grid.Column="1" Grid.Row="3"
            Grid.ColumnSpan="2"
            Margin="10"
            Content="Авторизация" Click="ButtonAuthorization_Click"/>
</Grid>

</Window> /// <summary> /// Логика взаимодействия для MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Load();

        var directions = ConferenceDBEntities.GetContext().Directions.Select(x => new
        {
            Id = (int?)x.Id,
            Name = x.Name
        }).ToList();

        directions.Insert(0, new
        {
            Id = (int?)null,
            Name = "Все данные"
        });

        ComboBoxDirectionFilter.ItemsSource = directions;
    }

    public void Load()
    {
        DataGridEvents.ItemsSource = ConferenceDBEntities.GetContext().Events.ToList();
    }

    private void ComboBoxDirectionFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        ApplyFilters();
    }

    private void DatePickerDateFilter_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
    {
        ApplyFilters();
    }

    private void ApplyFilters()
    {
        var events = ConferenceDBEntities.GetContext().Events.AsQueryable();
        var selectedDirection = ComboBoxDirectionFilter.SelectedItem as dynamic;

        if (selectedDirection?.Id != null)
        {
            events = events.Where(d => d.DirectionId == ComboBoxDirectionFilter.SelectedIndex);
        }

        if (DatePickerDateFilter.SelectedDate != null) 
        {
            var selectedDate = DatePickerDateFilter.SelectedDate.Value;
            events = events.Where(d => d.StartDate == DatePickerDateFilter.SelectedDate);
        }

        DataGridEvents.ItemsSource = events.ToList();
    }

    private void ButtonAuthorization_Click(object sender, RoutedEventArgs e)
    {
        new AuthorizationWindow().Show();
        this.Close();
    }
}

<Window x:Class="ConferenceApp.Windows.OrganizerWindow" Title="Окно организатора" WindowStartupLocation="CenterScreen" Height="550" Width="800" MaxHeight="650" MaxWidth="900" MinHeight="500" MinWidth="700"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition Height="0.5*"/>
        <RowDefinition Height="0.5*"/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Label Grid.Row="0" Grid.Column="0"
           Grid.ColumnSpan="3"
           FontSize="18"
           HorizontalAlignment="Center"
           Content="Окно организатора"/>

    <Label x:Name="LabelMeetPhrase" 
        Grid.Row="1" Grid.Column="1"/>

    <Label x:Name="LabelSNP"
           Grid.Row="2" Grid.Column="1"/>

    <Viewbox Grid.Row="1" Grid.Column="0"
             Grid.RowSpan="4"
             Margin="50 20 50 20">
        <Image x:Name="ImageProfile"
               Stretch="UniformToFill"/>
    </Viewbox>

    <Button x:Name="ButtonEvents"
            Grid.Column="1" Grid.Row="3"
            Content="Мероприятия"
            Click="ButtonEvents_Click"/>

    <Button x:Name="ButtonPlayers"
            Grid.Column="1" Grid.Row="4"
            Content="Участники"
            Click="ButtonPlayers_Click"/>

    <Button x:Name="ButtonJuries"
            Grid.Column="1" Grid.Row="5"
            Content="Жюри"
            Click="ButtonJuries_Click"/>

    <Button x:Name="ButtonProfile"
            Grid.Column="0" Grid.Row="5"
            Content="Мой профиль"
            Click="ButtonProfile_Click"/>
</Grid>

</Window> { /// <summary> /// Логика взаимодействия для OrganizerWindow.xaml /// </summary> public partial class OrganizerWindow : Window { public OrganizerWindow() { InitializeComponent();

            if (Account.acc.GenderId == 1)
                LabelSNP.Content = "Мистер " + Account.acc.SNP;
            else
                LabelSNP.Content = "Mисс " + Account.acc.SNP;

            if (DateTime.Now.Hour >= 9 && DateTime.Now.Hour < 11)
                LabelMeetPhrase.Content = "Доброе утро!";
            if (DateTime.Now.Hour >= 11 && DateTime.Now.Hour < 18)
                LabelMeetPhrase.Content = "Добрый день!";
            if (DateTime.Now.Hour >= 18 && DateTime.Now.Hour < 24)
                LabelMeetPhrase.Content = "Добрый вечер!";
            if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 9)
                LabelMeetPhrase.Content = "Доброй ночи!";

            var imageUri = new Uri($"pack://application:,,,/Images/Users/{Account.acc.Image}");
            var bitmap = new BitmapImage();

            bitmap.BeginInit();
            bitmap.UriSource = imageUri;
            bitmap.EndInit();

            ImageProfile.Source = bitmap;
        }

        private void ButtonEvents_Click(object sender, RoutedEventArgs e)
        {
            new EventWindow().ShowDialog();
        }

        private void ButtonProfile_Click(object sender, RoutedEventArgs e)
        {
            new ProfileWindow().ShowDialog();
        }

        private void ButtonJuries_Click(object sender, RoutedEventArgs e)
        {
            new JuryWindow().ShowDialog();
        }

        private void ButtonPlayers_Click(object sender, RoutedEventArgs e)
        {
            new PlayerWindow().ShowDialog();
        }
    }
}
<Window x:Class="ConferenceApp.Windows.AuthorizationWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ec="clr-namespace:EasyCaptcha.Wpf;assembly=EasyCaptcha.Wpf"
    xmlns:local="clr-namespace:ConferenceApp.Windows"
    mc:Ignorable="d"
    Title="Авторизация" 
    Height="450" Width="800"
    MaxHeight="550" MaxWidth="900"
    MinHeight="350" MinWidth="700">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="0.5*"/>
        <ColumnDefinition/>
        <ColumnDefinition/>
        <ColumnDefinition Width="0.5*"/>
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Label Grid.Row="0" Grid.Column="1"
           Grid.ColumnSpan="2"
           HorizontalAlignment="Center"
           FontSize="23"
           Content="Авторизация"/>

    <Label Grid.Row="1" Grid.Column="1"
           Margin="5"
           HorizontalAlignment="Center"
           VerticalAlignment="Center"
           FontSize="18"
           Content="Номер пользователя"/>

    <TextBox x:Name="TextBoxId"
           Grid.Row="1" Grid.Column="2"/>

    <Label Grid.Row="2" Grid.Column="1"
           HorizontalAlignment="Center"
           VerticalAlignment="Center"
           FontSize="18"
           Content="Пароль"/>

    <TextBox x:Name="TextBoxPassword"
           Grid.Row="2" Grid.Column="2"/>

    <ec:Captcha x:Name="Captcha" 
        Grid.Column="1" Grid.Row="3"/>

    <TextBox x:Name="TextBoxCaptcha"
             Grid.Row="3" Grid.Column="2"
             MaxLength="5"/>

    <Button x:Name="ButtonAuthorization"
            Grid.Column="1" Grid.Row="4"
            Grid.ColumnSpan="2"
            Content="Войти в систему"
            Click="ButtonAuthorization_Click"/>
</Grid>

</Window> { /// <summary> /// Логика взаимодействия для AuthorizationWindow.xaml /// </summary> public partial class AuthorizationWindow : Window { int EnterCount = 0; public AuthorizationWindow() { InitializeComponent(); Captcha.CreateCaptcha(EasyCaptcha.Wpf.Captcha.LetterOption.Alphanumeric, 4); }

    private async void ButtonAuthorization_Click(object sender, RoutedEventArgs e)
    {
        if (EnterCount != 3)
        {
            try
            {
                int id = 0;
                StringBuilder err = new StringBuilder();

                if (!int.TryParse(TextBoxId.Text, out id) &&
                    TextBoxId.Text == string.Empty)
                    err.Append("Введите корректное значение номера пользователя\n");
                if (TextBoxPassword.Text == string.Empty)
                    err.Append("Введите корректное значение пароля\n");
                if (!(Captcha.CaptchaText == TextBoxCaptcha.Text))
                    err.Append("Капча не пройдена, попробуйте снова\n");
                if (ConferenceDBEntities.GetContext().
                    Users.FirstOrDefault(u => u.Id == id &&
                    u.Password == TextBoxPassword.Text) == null)
                    err.Append("Аккаунт не найден");

                if (err.Length > 0)
                {
                    EnterCount++;
                    MessageBox.Show(err.ToString(), "Ошибка",
                        MessageBoxButton.OK, MessageBoxImage.Error);
                    err.Clear();
                }
                else
                {
                    EnterCount = 0;
                    err.Clear();
                    Account.acc = ConferenceDBEntities.GetContext().
                        Users.FirstOrDefault(u => u.Id == id &&
                        u.Password == TextBoxPassword.Text);
                    MessageBox.Show("Добро пожаловать!","Успешный вход!",
                        MessageBoxButton.OK, MessageBoxImage.Information);
                    if (Account.acc.RoleId == 1)
                        new PlayerWindow().Show();
                    if (Account.acc.RoleId == 2)
                        new ModeratorWindow().Show();
                    if (Account.acc.RoleId == 3)
                        new OrganizerWindow().Show();
                    if (Account.acc.RoleId == 4)
                        new JuryWindow().Show();
                    Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK);
            }
        }
        else
        {
            ButtonAuthorization.IsEnabled = false;
            await Task.Delay(10000);
            ButtonAuthorization.IsEnabled = true;
            EnterCount = 0;
        }
    }
}

} <Window x:Class="ConferenceApp.Windows.JuryModeratorRegistrationWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ConferenceApp.Windows" mc:Ignorable="d" Title="Регистрация жюри или модератора" WindowStartupLocation="CenterScreen" Height="550" Width="800" MaxHeight="650" MaxWidth="900" MinHeight="500" MinWidth="700"> <Window.Resources> <Style TargetType="TextBox"> <Setter Property="Margin" Value="5"/> </Style> </Window.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.6*"/> <ColumnDefinition/> <ColumnDefinition Width="0.75*"/> <ColumnDefinition/> </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Label Grid.Row="0" Grid.Column="0"
   Grid.ColumnSpan="4"
   FontSize="16"
   HorizontalAlignment="Center"
   Content="Регистрация жюри или модератора"/>

    <Label Grid.Row="1" Grid.Column="0"
           Content="Идентификатор"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="2" Grid.Column="0"
           Content="ФИО"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="3" Grid.Column="0"
           Content="Пол"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="4" Grid.Column="0"
           Content="Роль"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="5" Grid.Column="0"
           Content="Почта"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="6" Grid.Column="0"
           Content="Телефон"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="7" Grid.Column="0"
           Content="Направление"
           HorizontalAlignment="Right"/>
    <Label Grid.Row="9" Grid.Column="0"
           Content="Мероприятие"
           HorizontalAlignment="Right"
           Visibility="Hidden"/>
    <Label Grid.Row="7" Grid.Column="2"
           HorizontalAlignment="Right"
           Content="Пароль:"/>
    <Label Grid.Row="8" Grid.Column="2"
           HorizontalAlignment="Right"
           Content="Повтор пароля:"/>

    <TextBox x:Name="TextboxId"
             Grid.Row="1" Grid.Column="1"
             IsEnabled="False"/>
    <TextBox x:Name="TextboxSNP"
     Grid.Row="2" Grid.Column="1"/>
    <ComboBox x:Name="ComboboxGender"
     Grid.Row="3" Grid.Column="1"
     DisplayMemberPath="Name"/>
    <ComboBox x:Name="ComboboxRole"
     Grid.Row="4" Grid.Column="1"
              DisplayMemberPath="Name"/>
    <TextBox x:Name="TextboxEmail"
     Grid.Row="5" Grid.Column="1"/>
    <TextBox x:Name="TextboxPhone"
     Grid.Row="6" Grid.Column="1"
     MaxLength="17"
     Text="+7(___)-___-__-__"/>
    <ComboBox x:Name="ComboboxDirection"
     Grid.Row="7" Grid.Column="1"
              DisplayMemberPath="Name"/>
    <ComboBox x:Name="ComboboxEvent"
     Grid.Row="9" Grid.Column="1"
     Visibility="Hidden"
     DisplayMemberPath="Name"/>

    <CheckBox x:Name="CheckBoxEvent"
        Grid.Row="8" Grid.Column="1"
        HorizontalAlignment="Right"
              Margin="10"
        Content="Прикрепить к мероприятию" Checked="CheckBoxEvent_Checked"
              Unchecked="CheckBoxEvent_Unchecked"/>

    <CheckBox x:Name="CheckBoxVisibilityPassword"
        Grid.Row="9" Grid.Column="3"
        HorizontalAlignment="Right"
              Margin="10"
        Content="Показать пароль" Checked="CheckBoxVisibilityPassword_Checked"/>

    <PasswordBox x:Name="PasswordBoxPassword"
                 Grid.Row="7" Grid.Column="3"
                 Margin="5"/>
    <TextBox x:Name="TextBoxPassword"
             Grid.Row="7" Grid.Column="3"
             Margin="5"
             Visibility="Hidden"/>
    <PasswordBox x:Name="PasswordBoxRepeatPassword"
                Grid.Row="8" Grid.Column="3"
                Margin="5"/>


    <Button Grid.Row="1" Grid.Column="4"
            Grid.RowSpan="5"
            x:Name="ButtonImageProfile"
            Content="Выберите изображение" Click="ButtonImageProfile_Click"/>

    <Image x:Name="ImageProfile"
   Grid.Row="1" Grid.Column="4"
   Grid.RowSpan="5"
   Stretch="Uniform"
   Visibility="Collapsed"/>


    <TextBox x:Name="TextBoxImage"
             Visibility="Hidden"/>

    <Button x:Name="ButtonOk"
            Grid.Column="2" Grid.Row="10"
            Content="Ок"
            Margin="50 10 50 10" Click="ButtonOk_Click"/>
    <Button x:Name="ButtonCancel"
    Grid.Column="3" Grid.Row="10"
    Content="Отмена"
    Margin="50 10 50 10" Click="ButtonCancel_Click"/>
</Grid>

</Window> { /// <summary> /// Логика взаимодействия для JuryModeratorRegistrationWindow.xaml /// </summary> public partial class JuryModeratorRegistrationWindow : Window { public JuryModeratorRegistrationWindow() { InitializeComponent(); int idd = ConferenceDBEntities.GetContext().Users.ToList().Last().Id + 1; TextboxId.Text = Convert.ToString(idd); ComboboxRole.ItemsSource = ConferenceDBEntities.GetContext(). Roles.Where(n ⇒ n.Name == "Жюри" || n.Name == "Модератор").ToList(); ComboboxGender.ItemsSource = ConferenceDBEntities.GetContext(). Genders.ToList(); ComboboxDirection.ItemsSource = ConferenceDBEntities.GetContext(). Directions.ToList(); ComboboxEvent.ItemsSource = ConferenceDBEntities.GetContext(). Events.ToList(); }

    private void ButtonOk_Click(object sender, RoutedEventArgs e)
    {
        var err = new StringBuilder();
        string pattern = @"^\+7\(\d{3}\)-\d{3}-\d{2}-\d{2}$";
        string specialsymbols = "!@#$%^&*()_+=-~";

        if (TextboxPhone.Text == string.Empty ||
            TextboxSNP.Text == string.Empty ||
            TextboxId.Text == string.Empty ||
            TextboxEmail.Text == string.Empty ||
            (TextBoxPassword.Text == string.Empty &&
            PasswordBoxPassword.Password == string.Empty))
            err.AppendLine("Заполните все поля, пожалуйста\n");

        if (!Regex.IsMatch(TextboxPhone.Text, pattern))
        {
            err.Append("Напишите номер в соответствии с шаблоном\n");
            TextboxPhone.Text = "+7(___)-___-__-__";
        }

        try
        {
            MailAddress mail = new MailAddress(TextboxEmail.Text);
        }
        catch
        {
            err.Append("Исправьте адрес электронной почты\n");
        }

        bool HasDigit(string str)
        {
            foreach (char n in str)
            {
                if (char.IsDigit(n))
                    return true;
            }
            return false;
        }

        bool HasUpper(string str)
        {
            foreach (char n in str)
            {
                if (char.IsUpper(n))
                    return true;
            }
            return false;
        }

        bool HasLower(string str)
        {
            foreach (char n in str)
            {
                if (char.IsLower(n))
                    return true;
            }
            return false;
        }

        bool HasSpecialSymbol(string str)
        {
            foreach (char n in str)
            {
                foreach (char c in specialsymbols)
                    if (c == n)
                        return true;
            }
            return false;
        }

        string password = CheckBoxVisibilityPassword.IsChecked == true
        ? TextBoxPassword.Text
        : PasswordBoxPassword.Password;

        if (password.Length < 6)
            err.Append("Пароль должен быть не менее 6 символов\n");
        if (!HasDigit(password))
            err.Append("Пароль должен содержать цифры\n");
        if (!HasUpper(password))
            err.Append("Пароль должен содержать заглавные буквы\n");
        if (!HasLower(password))
            err.Append("Пароль должен содержать строчные буквы\n");
        if (!HasSpecialSymbol(password))
            err.Append("Пароль должен содержать специальные символы\n");

        if (password != PasswordBoxRepeatPassword.Password)
            err.Append("Неправильно повторён пароль\n");

        if (ComboboxGender.SelectedItem == null)
            err.Append("Выберите пол\n");
        if (ComboboxRole.SelectedItem == null)
            err.Append("Выберите роль\n");
        if (ComboboxDirection.SelectedItem == null)
            err.Append("Выберите направление\n");

        if (err.Length > 0)
            MessageBox.Show(err.ToString(), "Ошибка",
                MessageBoxButton.OK, MessageBoxImage.Warning);
        else
        {
            try
            {
                string imageFileName = null;
                if (!string.IsNullOrEmpty(TextBoxImage.Text) && System.IO.File.Exists(TextBoxImage.Text))
                {
                    imageFileName = CopyImageToFolder(TextBoxImage.Text);
                    if (imageFileName == null)
                    {
                        MessageBox.Show("Не удалось сохранить изображение", "Ошибка");
                        return;
                    }
                }
                var selecteddirection = (Directions)ComboboxDirection.SelectedItem;
                var selectedrole = (Roles)ComboboxRole.SelectedItem;
                var newuser = new Users()
                {
                    SNP = TextboxSNP.Text,
                    GenderId = ((Genders)ComboboxGender.SelectedItem).Id,
                    RoleId = selectedrole.Id,
                    Email = TextboxEmail.Text,
                    Phone = TextboxPhone.Text,
                    DirectionId = selecteddirection.Id,
                    Birthday = DateTime.Now,
                    CountryCode = "RU",
                    CountryCode2 = 643
                };

                newuser.Image = imageFileName;
                if (!(bool)CheckBoxVisibilityPassword.IsChecked)
                    newuser.Password = PasswordBoxPassword.Password;
                else
                    newuser.Password = TextBoxPassword.Text;

                ConferenceDBEntities.GetContext().Users.Add(newuser);
                ConferenceDBEntities.GetContext().SaveChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка",
                    MessageBoxButton.OK, MessageBoxImage.Error);
                Console.WriteLine(ex.Message);
            }

        }
    }

    private void ButtonCancel_Click(object sender, RoutedEventArgs e)
    {
        new JuryWindow().Show();
        Close();
    }

    private void CheckBoxVisibilityPassword_Checked(object sender, RoutedEventArgs e)
    {
        if (CheckBoxVisibilityPassword.IsChecked == true)
        {
            TextBoxPassword.Text = PasswordBoxPassword.Password;
            PasswordBoxPassword.Visibility = Visibility.Hidden;
            TextBoxPassword.Visibility = Visibility.Visible;
        }
        else
        {
            PasswordBoxPassword.Password = TextBoxPassword.Text;
            PasswordBoxPassword.Visibility = Visibility.Visible;
            TextBoxPassword.Visibility = Visibility.Hidden;
        }
    }

    private void CheckBoxEvent_Checked(object sender, RoutedEventArgs e)
    {
        ComboboxEvent.Visibility = Visibility.Visible;
    }

    private void CheckBoxEvent_Unchecked(object sender, RoutedEventArgs e)
    {
        ComboboxEvent.SelectedItem = null;
        ComboboxEvent.Visibility = Visibility.Hidden;
    }

    private void ButtonImageProfile_Click(object sender, RoutedEventArgs e)
    {
        var ofd = new OpenFileDialog();
        ofd.Filter = "Изображения (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp|Все файлы (*.*)|*.*";

        bool? result = ofd.ShowDialog();
        if (result == true)
        {
            string selectedFilePath = ofd.FileName;
            try
            {
                var bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(selectedFilePath);
                bitmap.CacheOption = BitmapCacheOption.OnLoad;
                bitmap.EndInit();

                ImageProfile.Source = bitmap;
                ImageProfile.Visibility = Visibility.Visible;
                ButtonImageProfile.Visibility = Visibility.Collapsed;
                TextBoxImage.Text = selectedFilePath;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка");
            }
        }
    }

    private string CopyImageToFolder(string sourceImagePath)
    {
        try
        {
            string extension = System.IO.Path.GetExtension(sourceImagePath);

            string fileName = $"user_{DateTime.Now:yyyyMMddHHmmssfff}{extension}";

            string destinationFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images", "Users");

            if (!System.IO.Directory.Exists(destinationFolder))
            {
                System.IO.Directory.CreateDirectory(destinationFolder);
            }

            string destinationPath = System.IO.Path.Combine(destinationFolder, fileName);

            System.IO.File.Copy(sourceImagePath, destinationPath, true);

            return fileName;
        }
        catch (Exception ex)
        {
            MessageBox.Show($"Ошибка при сохранении изображения: {ex.Message}", "Ошибка");
            return null;
        }
    }
}

}

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 210 12/23/2025
1.0.4 201 12/23/2025
1.0.3 191 12/23/2025
1.0.2 198 12/23/2025
1.0.1 197 12/23/2025
1.0.0 208 12/23/2025