Jelajahi Sumber

Добавьте файлы проекта.

максим карбышев 2 tahun lalu
induk
melakukan
1d58b7e1ec

+ 25 - 0
Kinomaks.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kinomaks", "Kinomaks\Kinomaks.csproj", "{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {904C6EB2-1C9D-42EF-99F9-6684EFDF768C}
+	EndGlobalSection
+EndGlobal

+ 6 - 0
Kinomaks/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+</configuration>

+ 9 - 0
Kinomaks/App.xaml

@@ -0,0 +1,9 @@
+<Application x:Class="Kinomaks.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:Kinomaks"
+             StartupUri="AuthorizationWindow.xaml">
+    <Application.Resources>
+        <ResourceDictionary Source="Style.xaml"/>
+    </Application.Resources>
+</Application>

+ 17 - 0
Kinomaks/App.xaml.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Kinomaks
+{
+    /// <summary>
+    /// Логика взаимодействия для App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 17 - 0
Kinomaks/AuthorizationWindow.xaml

@@ -0,0 +1,17 @@
+<Window x:Class="Kinomaks.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:local="clr-namespace:Kinomaks"
+        mc:Ignorable="d"
+        Title="Авторизация" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
+    <Grid>
+        <Label Name="LoginLab"  Content="Логин:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="388,329,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="Login" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="567,329,0,0" Height="60" Width="550" Background="White" FontSize="36"/>
+        <Label Content="Пароль:" VerticalAlignment="Top" HorizontalAlignment="Left" Foreground="White" Margin="388,411,0,0" Height="60" Width="180" FontSize="36"/>
+        <PasswordBox Name="Password" VerticalAlignment="Top" HorizontalAlignment="Left" Height="60" Width="550" Margin="567,411,0,0" FontSize="36"/>
+        <Button Name="AuthorizeButton" Content="Войти" VerticalAlignment="Top" HorizontalAlignment="Left" Height="60" Width="360" Margin="350,746,0,0" Click="AuthorizationClick" FontSize="36"/>
+        <Button Name="RegistrationButton" Content="Зарегистрироваться" VerticalAlignment="Top" HorizontalAlignment="Right" Height="60" Width="360" Margin="0,746,350,0" FontSize="36" Click="RegistrationClick"/>
+    </Grid>
+</Window>

+ 61 - 0
Kinomaks/AuthorizationWindow.xaml.cs

@@ -0,0 +1,61 @@
+using System.Linq;
+using System.Windows;
+
+namespace Kinomaks
+{
+    /// <summary>
+    /// Логика взаимодействия для AuthorizationWindow.xaml
+    /// </summary>
+    public partial class AuthorizationWindow : Window
+    {
+        public AuthorizationWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void AuthorizationClick(object sender, RoutedEventArgs e)
+        {
+            #region Авторизация
+            if (Authorization(Login.Text.ToString(), Password.Password.ToString()))
+            {
+                MainWindow mw = new MainWindow();
+                mw.Show();
+                this.Close();
+            }
+        }
+
+        public bool Authorization(string login, string password)
+        {
+            if (Login.Text == "" || Password.Password == "")
+            {
+                ErrorWindow ew = new ErrorWindow("пустые поля");
+                ew.Show();
+                return false;
+            }
+            if (Connection.db.Users.Select(item => item.Login + " " + item.Password).Contains(Login.Text + " " + Encrypt.Hash(Password.Password)))
+            {
+                int personID = Connection.db.Users.Where(users => users.Login == Login.Text).Select(users => users.IDPerson).FirstOrDefault();
+                int Role = Connection.db.Persons.Where(users => users.ID == personID).Select(users => users.IDRole).FirstOrDefault();
+                User.Role = Role;
+                User.IDPerson = personID;
+                return true;
+            }
+            else
+            {
+                ErrorWindow ew = new ErrorWindow("неверный логин/пароль");
+                ew.Show();
+                return false;
+            }
+            #endregion
+        }
+
+        private void RegistrationClick(object sender, RoutedEventArgs e)
+        {
+            #region Переход на окно регистрации
+            RegistrationWindow rw = new RegistrationWindow();
+            rw.Show();
+            this.Close();
+            #endregion
+        }
+    }
+}

+ 25 - 0
Kinomaks/Encrypt.cs

@@ -0,0 +1,25 @@
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Kinomaks
+{
+    internal class Encrypt
+    {
+        public static string Hash(string password)
+        {
+            byte[] bytes = Encoding.Unicode.GetBytes(password);
+
+            MD5CryptoServiceProvider CSP = new MD5CryptoServiceProvider();
+
+            byte[] byteHash = CSP.ComputeHash(bytes);
+
+            string hash = string.Empty;
+
+            foreach (byte b in byteHash)
+            {
+                hash += string.Format("{0:x2}", b);
+            }
+            return hash;
+        }
+    }
+}

+ 13 - 0
Kinomaks/ErrorWindow.xaml

@@ -0,0 +1,13 @@
+<Window x:Class="Kinomaks.ErrorWindow"
+        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:Kinomaks"
+        mc:Ignorable="d"
+        Title="Ошибка" Height="100" Width="300" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="CanMinimize">
+    <Grid>
+        <Button x:Name="BackButton" Content="Назад" VerticalAlignment="Top" HorizontalAlignment="Center" Height="30" Width="130" Margin="0,57,0,0" Click="BackClick"/>
+        <Label Name="Error" Content="Ошибка: " HorizontalAlignment="Center" Margin="0,18,0,0" VerticalAlignment="Top" Height="29" Width="262" Foreground="White"/>
+    </Grid>
+</Window>

+ 21 - 0
Kinomaks/ErrorWindow.xaml.cs

@@ -0,0 +1,21 @@
+using System.Windows;
+
+namespace Kinomaks
+{
+    /// <summary>
+    /// Логика взаимодействия для ErrorWindow.xaml
+    /// </summary>
+    public partial class ErrorWindow : Window
+    {
+        public ErrorWindow(string error)
+        {
+            InitializeComponent();
+            Error.Content = "Ошибка: " + error;
+        }
+
+        private void BackClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 80 - 0
Kinomaks/ImagesManip.cs

@@ -0,0 +1,80 @@
+using Microsoft.Win32;
+using System;
+using System.IO;
+using System.Windows.Media.Imaging;
+
+namespace Kinomaks
+{
+    internal class ImagesManip
+    {
+        public static byte[] BitmapSourceToByteArray(BitmapSource image)
+        {
+            #region Кодирование картинки
+            using (var stream = new MemoryStream())
+            {
+                var encoder = new PngBitmapEncoder();
+                encoder.Frames.Add(BitmapFrame.Create(image));
+                encoder.Save(stream);
+                return stream.ToArray();
+            }
+            #endregion
+        }
+
+        public static BitmapImage SelectImage()
+        {
+            #region Выбор картинки
+            OpenFileDialog op = new OpenFileDialog();
+            op.Title = "Выбрать изображение";
+            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
+                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
+                        "Portable Network Graphic (*.png)|*.png";
+            if (op.ShowDialog() == true)
+                return new BitmapImage(new Uri(op.FileName));
+            else
+                return null;
+            #endregion
+        }
+
+        public static BitmapImage NewImage(Games game)
+        {
+            #region Декодирование картинки
+            MemoryStream ms = new MemoryStream(game.Logo);
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.StreamSource = ms;
+            image.EndInit();
+            return image;
+        }
+
+        public static BitmapImage NewImage(Players player)
+        {
+            MemoryStream ms = new MemoryStream(player.Photo);
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.StreamSource = ms;
+            image.EndInit();
+            return image;
+        }
+
+        public static BitmapImage NewImage(Teams team)
+        {
+            MemoryStream ms = new MemoryStream(team.Logo);
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.StreamSource = ms;
+            image.EndInit();
+            return image;
+        }
+
+        public static BitmapImage NewImage(Tournaments tournament)
+        {
+            MemoryStream ms = new MemoryStream(tournament.Logo);
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.StreamSource = ms;
+            image.EndInit();
+            return image;
+            #endregion
+        }
+    }
+}

+ 125 - 0
Kinomaks/Kinomaks.csproj

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{94F60E4A-9390-4EF8-BCA6-413B5BB91DD9}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>Kinomaks</RootNamespace>
+    <AssemblyName>Kinomaks</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Compile Include="RegitrationConfirmedWindow.xaml.cs">
+      <DependentUpon>RegitrationConfirmedWindow.xaml</DependentUpon>
+    </Compile>
+    <Page Include="AuthorizationWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="ErrorWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="RegistrationWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="AuthorizationWindow.xaml.cs">
+      <DependentUpon>AuthorizationWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Encrypt.cs" />
+    <Compile Include="ErrorWindow.xaml.cs">
+      <DependentUpon>ErrorWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="ImagesManip.cs" />
+    <Compile Include="RegistrationWindow.xaml.cs">
+      <DependentUpon>RegistrationWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="RegitrationConfirmedWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Style.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 55 - 0
Kinomaks/Properties/AssemblyInfo.cs

@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
+// связанные со сборкой.
+[assembly: AssemblyTitle("Kinomaks")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Kinomaks")]
+[assembly: AssemblyCopyright("Copyright ©  2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM, установите атрибут ComVisible для этого типа в значение true.
+[assembly: ComVisible(false)]
+
+//Чтобы начать создание локализуемых приложений, задайте
+//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
+//в <PropertyGroup>. Например, при использовании английского (США)
+//в своих исходных файлах установите <UICulture> в en-US.  Затем отмените преобразование в комментарий
+//атрибута NeutralResourceLanguage ниже.  Обновите "en-US" в
+//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
+                                     //(используется, если ресурс не найден на странице,
+                                     // или в словарях ресурсов приложения)
+    ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
+                                              //(используется, если ресурс не найден на странице,
+                                              // в приложении или в каких-либо словарях ресурсов для конкретной темы)
+)]
+
+
+// Сведения о версии для сборки включают четыре следующих значения:
+//
+//      Основной номер версии
+//      Дополнительный номер версии
+//      Номер сборки
+//      Номер редакции
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию 
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
Kinomaks/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код был создан программным средством.
+//     Версия среды выполнения: 4.0.30319.42000
+//
+//     Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
+//     код создан повторно.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kinomaks.Properties
+{
+
+
+    /// <summary>
+    ///   Класс ресурсов со строгим типом для поиска локализованных строк и пр.
+    /// </summary>
+    // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
+    // класс с помощью таких средств, как ResGen или Visual Studio.
+    // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
+    // с параметром /str или заново постройте свой VS-проект.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Kinomaks.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   Переопределяет свойство CurrentUICulture текущего потока для всех
+        ///   подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
Kinomaks/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
Kinomaks/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kinomaks.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
Kinomaks/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 25 - 0
Kinomaks/RegistrationWindow.xaml

@@ -0,0 +1,25 @@
+<Window x:Class="Kinomaks.RegistrationWindow"
+        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:Kinomaks"
+        mc:Ignorable="d"
+        Title="Регистрация" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
+    <Grid>
+        <Label Content="Логин:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,172,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="Login" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,232,0,0" Height="60" Width="550" Background="White" FontSize="36"/>
+        <Label Content="Пароль:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,172,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <PasswordBox Name="Password" VerticalAlignment="Top" Margin="925,232,0,0" Height="60" FontSize="36" HorizontalAlignment="Left" Width="550"/>
+        <Label Content="Фамилия:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,314,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="SecondName" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,374,0,0" Height="60" Width="550" Background="White" FontSize="36" TextChanged="TextChanged"/>
+        <Label Content="Имя:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,314,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="FirstName" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,374,0,0" Height="60" Width="550" Background="White" FontSize="36" TextChanged="TextChanged"/>
+        <Label Content="Отчество:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,456,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="MiddleName" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="125,516,0,0" Height="60" Width="550" Background="White" FontSize="36" TextChanged="TextChanged"/>
+        <Label Content="Почта:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,456,0,0" Foreground="White" Height="60" Width="180" FontSize="36"/>
+        <TextBox Name="Email" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,516,0,0" Height="60" Width="550" Background="White" FontSize="36"/>
+        <Button Name="BackButton" Content="Назад" VerticalAlignment="Top" HorizontalAlignment="Left" Height="60" Width="360" Margin="350,746,0,0" Click="BackClick" FontSize="36"/>
+        <Button Name="RegistrationButton" Content="Зарегистрироваться" VerticalAlignment="Top" HorizontalAlignment="Right" Height="60" Width="360" Margin="0,746,350,0" FontSize="36" Click="RegistrationClick"/>
+    </Grid>
+</Window>

+ 120 - 0
Kinomaks/RegistrationWindow.xaml.cs

@@ -0,0 +1,120 @@
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Kinomaks
+{
+    /// <summary>
+    /// Логика взаимодействия для MainWindow.xaml
+    /// </summary>
+    public partial class RegistrationWindow : Window
+    {
+        public RegistrationWindow()
+        {
+            InitializeComponent();
+        }
+        private void RegistrationClick(object sender, RoutedEventArgs e)
+        {
+            #region Регистрация
+            bool regRes = Registration(Login.Text.ToString(), Password.Password.ToString(), FirstName.Text.ToString(),
+                                        SecondName.Text.ToString(), MiddleName.Text.ToString(), Email.Text.ToString());
+
+            if (regRes)
+            {
+                #region Результат и переход на окно авторизации
+                RegitrationConfirmedWindow rcw = new RegitrationConfirmedWindow();
+                rcw.Show();
+
+                AuthorizationWindow aw = new AuthorizationWindow();
+                aw.Show();
+                this.Close();
+                #endregion
+            }
+        }
+
+        public bool Registration(string login, string password, string Fname, string Sname, string Mname, string email)
+        {
+            #region Валидация
+            if (Login.Text == "" || Password.Password == "" || FirstName.Text == "" || SecondName.Text == "" || Email.Text == "")
+            {
+                ErrorWindow ew = new ErrorWindow("пустые поля");
+                ew.Show();
+                return false;
+            }
+            if (Connection.db.Users.Select(item => item.Login).Contains(Login.Text))
+            {
+                ErrorWindow ew = new ErrorWindow("такой пользователь уже существует");
+                ew.Show();
+                return false;
+            }
+            if (!IsValidEmail(Email.Text))
+            {
+                ErrorWindow ew = new ErrorWindow("неверный формат почты");
+                ew.Show();
+                return false;
+            }
+            #endregion
+
+
+            #region Добавление пользователя
+            Persons person = new Persons()
+            {
+                SecondName = SecondName.Text,
+                FirstName = FirstName.Text,
+                Email = Email.Text,
+                IDRole = 2
+            };
+            if (MiddleName.Text != "")
+            {
+                person.MiddleName = MiddleName.Text;
+            }
+
+            Connection.db.Persons.Add(person);
+            Connection.db.SaveChanges();
+
+            Users user = new Users()
+            {
+                IDPerson = Connection.db.Persons.Max(x => x.ID),
+                Login = Login.Text,
+                Password = Encrypt.Hash(Password.Password)
+            };
+
+            Connection.db.Users.Add(user);
+            Connection.db.SaveChanges();
+            return true;
+            #endregion
+
+            #endregion
+        }
+
+        private void BackClick(object sender, RoutedEventArgs e)
+        {
+            #region Назад
+            AuthorizationWindow aw = new AuthorizationWindow();
+            aw.Show();
+            this.Close();
+            #endregion
+        }
+
+        private bool IsValidEmail(string email)
+        {
+            #region Валидация
+            string regex = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
+            if (Regex.IsMatch(email, regex))
+                return true;
+            else
+                return false;
+        }
+
+        private void TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (Regex.IsMatch((((TextBox)sender).Text).ToString(), "[^А-я-:]"))
+            {
+                ((TextBox)sender).Text = ((TextBox)sender).Text.Remove(((TextBox)sender).Text.Length - 1);
+                ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Length;
+            }
+            #endregion
+        }
+    }
+}

+ 13 - 0
Kinomaks/RegitrationConfirmedWindow.xaml

@@ -0,0 +1,13 @@
+<Window x:Class="Kinomaks.RegitrationConfirmedWindow"
+        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:Kinomaks"
+        mc:Ignorable="d"
+        Title="RegitrationConfirmedWindow" Height="100" Width="175" WindowStartupLocation="CenterScreen" WindowStyle="None">
+    <Grid>
+        <Button x:Name="BackButton" Content="Назад" VerticalAlignment="Top" HorizontalAlignment="Center" Height="30" Width="130" Margin="0,57,0,0" Click="BackClick"/>
+        <Label Content="Вы зарегистрировались" HorizontalAlignment="Center" Margin="0,18,0,0" VerticalAlignment="Top" Height="29" Width="140" Foreground="White"/>
+    </Grid>
+</Window>

+ 20 - 0
Kinomaks/RegitrationConfirmedWindow.xaml.cs

@@ -0,0 +1,20 @@
+using System.Windows;
+
+namespace Kinomaks
+{
+    /// <summary>
+    /// Логика взаимодействия для RegitrationConfirmedWindow.xaml
+    /// </summary>
+    public partial class RegitrationConfirmedWindow : Window
+    {
+        public RegitrationConfirmedWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void BackClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 109 - 0
Kinomaks/Style.xaml

@@ -0,0 +1,109 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:local="clr-namespace:Kinomaks">
+
+    <!--#region Оформление окна-->
+    <Style TargetType="Grid">
+        <Setter Property="Background">
+            <Setter.Value>
+                <RadialGradientBrush MappingMode="RelativeToBoundingBox" GradientOrigin="0.9,0.2" Center="0.5,0.5" RadiusX="0.7" RadiusY="0.7">
+                    <GradientStop Color="#FF1B1B15" Offset="1"/>
+                    <GradientStop Color="#FF142F2C"/>
+                </RadialGradientBrush>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <!--#endregion-->
+
+    <!--#region Стиль кнопки-->
+    <Style TargetType="Button">
+
+        <!--Текст-->
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="Button">
+                    <Grid Background="{TemplateBinding Background}">
+                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                    </Grid>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+
+        <!--Тень-->
+        <Setter Property="Effect">
+            <Setter.Value>
+                <DropShadowEffect/>
+            </Setter.Value>
+        </Setter>
+
+        <!--Скруглённые углы-->
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="Button">
+                    <Border CornerRadius="15" BorderBrush="Black">
+                        <Border.Background>
+                            <RadialGradientBrush MappingMode="RelativeToBoundingBox" GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0" RadiusY="0">
+                                <GradientStop Color="#787d7c" Offset="0"/>
+                                <GradientStop Color="#4f5856" Offset="1"/>
+                            </RadialGradientBrush>
+                        </Border.Background>
+                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+
+        <!--Анимации-->
+        <Style.Triggers>
+
+            <!--Анимация при нажатии-->
+            <EventTrigger RoutedEvent="Button.PreviewMouseLeftButtonDown">
+                <EventTrigger.Actions>
+                    <BeginStoryboard>
+                        <Storyboard Duration="0:0:1" SpeedRatio="3" FillBehavior="HoldEnd">
+                            <DoubleAnimation Storyboard.TargetProperty="Background.RadiusY" To="1.0"/>
+                            <DoubleAnimation Storyboard.TargetProperty="Background.RadiusY" To="1.0"/>
+                            <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0"/>
+                        </Storyboard>
+                    </BeginStoryboard>
+                </EventTrigger.Actions>
+            </EventTrigger>
+
+            <!--Анимация при отпускании-->
+            <EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
+                <EventTrigger.Actions>
+                    <BeginStoryboard>
+                        <Storyboard Duration="0:0:1" SpeedRatio="3" FillBehavior="HoldEnd">
+                            <DoubleAnimation Storyboard.TargetProperty="Background.RadiusX" To="0"/>
+                            <DoubleAnimation Storyboard.TargetProperty="Background.RadiusY" To="0"/>
+                            <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1"/>
+                        </Storyboard>
+                    </BeginStoryboard>
+                </EventTrigger.Actions>
+            </EventTrigger>
+        </Style.Triggers>
+    </Style>
+    <!--#endregion-->
+    
+    <!--#region Оформление датагрида-->
+    <!--Поля-->
+    <Style TargetType="DataGrid">
+        <Setter Property="FontSize" Value="20"/>
+        <Setter Property="Foreground" Value="White"/>
+        <Setter Property="RowBackground" Value="Transparent"/>
+        <Setter Property="BorderBrush" Value="Transparent"/>
+        <Setter Property="Background" Value="Transparent"/>
+    </Style>
+
+    <!--Заголовки столбцов-->
+    <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="FontWeight" Value="Bold"/>
+    </Style>
+
+    <!--Заголовки строк-->
+    <Style x:Key="RowHeaderStyle" TargetType="{x:Type DataGridRowHeader}">
+        <Setter Property="Background" Value="Transparent" />
+    </Style>
+    <!--#endregion-->
+</ResourceDictionary>