Преглед изворни кода

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

gr682_bpv пре 4 година
родитељ
комит
196b4b1505

+ 25 - 0
BorisProject.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30804.86
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BorisProject", "BorisProject\BorisProject.csproj", "{194767AA-C8E5-456B-8616-EE40518747AA}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{194767AA-C8E5-456B-8616-EE40518747AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{194767AA-C8E5-456B-8616-EE40518747AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{194767AA-C8E5-456B-8616-EE40518747AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{194767AA-C8E5-456B-8616-EE40518747AA}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {5C417B0B-829E-4FD0-BD56-DB9D430A17F5}
+	EndGlobalSection
+EndGlobal

+ 6 - 0
BorisProject/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
BorisProject/App.xaml

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

+ 17 - 0
BorisProject/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 BorisProject
+{
+    /// <summary>
+    /// Логика взаимодействия для App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 112 - 0
BorisProject/BorisProject.csproj

@@ -0,0 +1,112 @@
+<?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>{194767AA-C8E5-456B-8616-EE40518747AA}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>BorisProject</RootNamespace>
+    <AssemblyName>BorisProject</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="TrenerWindow.xaml.cs">
+      <DependentUpon>TrenerWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="WindowAdmin.xaml.cs">
+      <DependentUpon>WindowAdmin.xaml</DependentUpon>
+    </Compile>
+    <Page Include="MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="TrenerWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="WindowAdmin.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>

+ 24 - 0
BorisProject/MainWindow.xaml

@@ -0,0 +1,24 @@
+<Window x:Class="BorisProject.MainWindow"
+        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:BorisProject"
+        mc:Ignorable="d"
+        Title="MainWindow" Height="400" Width="300" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None">
+    <Grid>
+        <Grid.Background>
+            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
+                <GradientStop Color="Black" Offset="0"/>
+                <GradientStop Color="#FF02FAFF" Offset="0.206"/>
+            </LinearGradientBrush>
+        </Grid.Background>
+        <Label Content="Авторизация" HorizontalAlignment="Center" VerticalContentAlignment="Center"  VerticalAlignment="Center"   FontSize="20" Height="46" Width="138" Margin="81,81,81,273"/>
+        <Label Content="Логин:" HorizontalAlignment="Left" Margin="35,168,0,0" VerticalAlignment="Top" FontSize="20"/>
+        <Label Content="Пароль:" HorizontalAlignment="Left" Margin="35,212,0,0" VerticalAlignment="Top" FontSize="20" Width="82"/>
+        <TextBox Name="logintxt" HorizontalAlignment="Left" Margin="119,177,0,0"  VerticalAlignment="Top" Height="24" Width="123" MaxLength="10"/>
+        <PasswordBox Name="passwordpsw" HorizontalAlignment="Left" Margin="119,222,0,0" VerticalAlignment="Top" Width="123" Height="24" MaxLength="10"/>
+        <Button Content="Войти" HorizontalAlignment="Center"  VerticalAlignment="Center" Width="88" Height="28" Margin="106,304,106,68" Click="Vhod_Click"/>
+        <Button Content="X" FontSize="25" HorizontalAlignment="Left" Margin="265,0,0,0" VerticalAlignment="Top" Width="35" Height="35" Click="Exit_Click"/>
+    </Grid>
+</Window>

+ 90 - 0
BorisProject/MainWindow.xaml.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Data.SqlClient;
+using System.Data;
+
+
+namespace BorisProject
+{
+    /// <summary>
+    /// Логика взаимодействия для MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+        }
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=boris;Integrated Security=True");
+        TrenerWindow trenerwindow = new TrenerWindow();
+
+        //Авторизация
+        private void Vhod_Click(object sender, RoutedEventArgs e)
+        {
+            if (logintxt.Text == "" || passwordpsw.Password == "")
+            {
+                MessageBox.Show("Ошибка! Пустые поля!");
+            }
+            else if (logintxt.Text =="1")
+            {
+                TrenerWindow trenerWindow = new TrenerWindow();
+                this.Close();
+                trenerWindow.Show();
+            }
+            else if (logintxt.Text == "admin" && passwordpsw.Password=="admin")
+            {
+                WindowAdmin admin = new WindowAdmin();
+                this.Close();
+                admin.Show();
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd = new SqlCommand("Select * from Trener where Login ='" + logintxt.Text + "'  and Password ='" + passwordpsw.Password + "'", con);
+                    cmd.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter = new SqlDataAdapter();
+                    adapter.SelectCommand = cmd;
+                    DataSet dataSet = new DataSet();
+                    adapter.Fill(dataSet);
+                    if (dataSet.Tables[0].Rows.Count > 0)
+                    {
+                        MessageBox.Show("Добро пожаловать!");
+                        string username = dataSet.Tables[0].Rows[0]["ID_trener"].ToString();
+                        trenerwindow.txtidtrener.Text = username;
+                        trenerwindow.Show();
+                        this.Close();
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Такого пользователь нет!");
+                    }
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+    }
+}

+ 55 - 0
BorisProject/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("BorisProject")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BorisProject")]
+[assembly: AssemblyCopyright("Copyright ©  2021")]
+[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")]

+ 70 - 0
BorisProject/Properties/Resources.Designer.cs

@@ -0,0 +1,70 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код был создан программным средством.
+//     Версия среды выполнения: 4.0.30319.42000
+//
+//     Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
+//     код создан повторно.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+
+namespace BorisProject.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("BorisProject.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
BorisProject/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>

+ 29 - 0
BorisProject/Properties/Settings.Designer.cs

@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+// <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 BorisProject.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
BorisProject/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>

+ 49 - 0
BorisProject/TrenerWindow.xaml

@@ -0,0 +1,49 @@
+<Window x:Class="BorisProject.TrenerWindow"
+        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:BorisProject"
+        mc:Ignorable="d"
+        Title="TrenerWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="NoResize">
+    <Grid>
+        <Grid.Background>
+            <LinearGradientBrush EndPoint="0,0" StartPoint="0,0">
+                <GradientStop Color="Black" Offset="0"/>
+                <GradientStop Color="#FF0E5DA6" Offset="0.215"/>
+            </LinearGradientBrush>
+        </Grid.Background>
+        <Label Content="Добро пожаловать на окно тренера" FontSize="25" HorizontalAlignment="Left" Margin="204,83,0,0" VerticalAlignment="Top"/>
+        <Button Content="Соревнования" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="53" Click="sorev_Click"/>
+        <Grid Name="sorev" Visibility="Hidden" Margin="118,0,0,0" Background="#FFE0CCCC">
+            <DataGrid Name="datasorev" HorizontalAlignment="Left" Height="249" Margin="10,191,0,0" VerticalAlignment="Top" Width="662"/>
+            <Label Content="Соревнования" FontSize="25" HorizontalAlignment="Left" Margin="251,63,0,0" VerticalAlignment="Top" Width="184"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="30,143,0,0" VerticalAlignment="Top" Width="147" Height="43" Click="showtablesorev_Click"/>
+            <Button Content="Выгрузить таблицу в PDF" HorizontalAlignment="Left" Margin="205,143,0,0" VerticalAlignment="Top" Width="147" Height="43" Click="PDF_Click"/>
+        </Grid>
+        <Button Content="Тренировки" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="53" Margin="0,53,0,0" Click="trenirovka_Click"/>
+        <Grid Name="trenirovka" Visibility="Hidden" Margin="118,0,0,0" Background="#FFE0CCCC">
+            <Label Content="Тренировки" FontSize="25" HorizontalAlignment="Left" Margin="251,63,0,0" VerticalAlignment="Top" Width="184"/>
+            <Label Content="Код тренировки:" HorizontalAlignment="Left" Margin="65,170,0,0" VerticalAlignment="Top"/>
+            <Label Content="Адрес тренировки:" HorizontalAlignment="Left" Margin="65,201,0,0" VerticalAlignment="Top"/>
+            <Label Content="Дата тренировки:" HorizontalAlignment="Left" Margin="65,232,0,0" VerticalAlignment="Top"/>
+            <TextBox Name="kodtrentxt" HorizontalAlignment="Left" Height="23" Margin="172,173,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
+            <TextBox Name="adrestrentxt" HorizontalAlignment="Left" Height="23" Margin="180,204,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
+            <DatePicker Name="datetrenpic" HorizontalAlignment="Left" Margin="172,234,0,0" VerticalAlignment="Top"/>
+            <DataGrid HorizontalAlignment="Left" Height="187" Margin="291,253,0,0" VerticalAlignment="Top" Width="381"/>
+            <Button Content="Добавить" HorizontalAlignment="Left" Margin="87,283,0,0" VerticalAlignment="Top" Width="78" Height="22"/>
+            <Button Content="Редактировать" HorizontalAlignment="Left" Margin="81,310,0,0" VerticalAlignment="Top" Width="91" Height="28"/>
+            <Button Content="Удалить" HorizontalAlignment="Left" Margin="86,343,0,0" VerticalAlignment="Top" Width="81" Height="26"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="471,201,0,0" VerticalAlignment="Top" Width="143" Height="35"/>
+        </Grid>
+        <Button Content="Тренирующиеся" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="53" Margin="0,106,0,0" Click="chel_Click"/>
+        <Grid Name="chel" Visibility="Hidden" Margin="118,0,0,0" Background="#FFE0CCCC">
+            <Label Content="Тренирующиеся" FontSize="25" HorizontalAlignment="Left" Margin="251,63,0,0" VerticalAlignment="Top" Width="202"/>
+            <DataGrid Name="datapeople" HorizontalAlignment="Left" Height="224" Margin="10,180,0,0" VerticalAlignment="Top" Width="662"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="40,138,0,0" VerticalAlignment="Top" Width="157" Height="37" Click="showctablechel_Click"/>
+        </Grid>
+
+        <Button Content="X" HorizontalAlignment="Left" FontSize="25" Margin="755,0,0,0" VerticalAlignment="Top" Width="45" Height="45" Click="Exit_Click"/>
+        <TextBox Name="txtidtrener" Visibility="Hidden" HorizontalAlignment="Left" Height="23" Margin="10,400,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="120"/>
+    </Grid>
+</Window>

+ 115 - 0
BorisProject/TrenerWindow.xaml.cs

@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Data.SqlClient;
+using System.Data;
+
+namespace BorisProject
+{
+    /// <summary>
+    /// Логика взаимодействия для TrenerWindow.xaml
+    /// </summary>
+    public partial class TrenerWindow : Window
+    {
+        public TrenerWindow()
+        {
+            InitializeComponent();
+        }
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=boris;Integrated Security=True");
+
+        private void sorev_Click(object sender, RoutedEventArgs e)
+        {
+            sorev.Visibility = Visibility.Visible;
+            trenirovka.Visibility = Visibility.Hidden;
+            chel.Visibility = Visibility.Hidden;
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        private void trenirovka_Click(object sender, RoutedEventArgs e)
+        {
+            trenirovka.Visibility = Visibility.Visible;
+            sorev.Visibility = Visibility.Hidden;
+            chel.Visibility = Visibility.Hidden;
+        }
+
+        private void chel_Click(object sender, RoutedEventArgs e)
+        {
+            chel.Visibility = Visibility.Visible;
+            sorev.Visibility = Visibility.Hidden;
+            trenirovka.Visibility = Visibility.Hidden;
+        }
+
+        private void showtablesorev_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT ID_sorev,Title,Place,[Date],Trener.LastName From Sorevnovania inner join Trener on Trener.ID_trener = Sorevnovania.ID_trener group by ID_sorev,Title,Place,[Date],Trener.ID_trener,Trener.LastName having Trener.ID_trener = '"+txtidtrener.Text+"'";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("Sorevnovania");
+                dataAdapter.Fill(data);
+                datasorev.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datasorev.Columns[0].Header = "Номер соревнования";
+                datasorev.Columns[1].Header = "Название";
+                datasorev.Columns[2].Header = "Место";
+                datasorev.Columns[3].Header = "Дата";
+                datasorev.Columns[4].Header = "Тренер";
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+
+        private void PDF_Click(object sender, RoutedEventArgs e)
+        {
+            PrintDialog print = new PrintDialog();
+            if (print.ShowDialog() == true)
+            {
+                print.PrintVisual(datasorev, "Sorevnovania");
+            }
+        }
+
+        private void showctablechel_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT PeopleTrain.FirstName,PeopleTrain.LastName,PeopleTrain.MiddleName,PeopleTrain.DOB,Trener.LastName From PeopleTrain inner join Trener on Trener.ID_trener = PeopleTrain.ID_Trener group by PeopleTrain.FirstName,PeopleTrain.LastName,PeopleTrain.MiddleName,PeopleTrain.DOB,Trener.LastName,Trener.ID_trener having Trener.ID_trener = '"+txtidtrener.Text+"'";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("TrainPeople");
+                dataAdapter.Fill(data);
+                datapeople.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datapeople.Columns[0].Header = "Имя";
+                datapeople.Columns[1].Header = "Фамилия";
+                datapeople.Columns[2].Header = "Отчество";
+                datapeople.Columns[3].Header = "Дата рождения";
+                datapeople.Columns[4].Header = "Тренер";
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+    }
+}

+ 83 - 0
BorisProject/WindowAdmin.xaml

@@ -0,0 +1,83 @@
+<Window x:Class="BorisProject.WindowAdmin"
+        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:BorisProject"
+        mc:Ignorable="d"
+        Title="WindowAdmin" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="NoResize">
+    <Grid>
+        <Grid.Background>
+            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
+                <GradientStop Color="Black" Offset="0"/>
+                <GradientStop Color="#FF0091FF" Offset="0.172"/>
+            </LinearGradientBrush>
+        </Grid.Background>
+        <Label Content="Добро пожаловать на окно администратора" FontSize="25" HorizontalAlignment="Left" Margin="204,83,0,0" VerticalAlignment="Top"/>
+        <Button Content="Соревнования" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="63" Click="sorev_Click"/>
+        <Button Content="Тренеры" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="63" Margin="0,63,0,0" Click="trener_Click"/>
+        <Button Content="Тренирующиеся" HorizontalAlignment="Left" VerticalAlignment="Top" Width="118" Height="63" Margin="0,126,0,0" Click="chel_Click"/>
+        <Grid Name="sorev" Visibility="Hidden" HorizontalAlignment="Left" Height="450" Margin="118,0,0,0" VerticalAlignment="Top" Width="682" Background="#FFE0CCCC">
+            <DataGrid Name="datasorev" HorizontalAlignment="Left" Height="271" VerticalAlignment="Top" Width="465" Margin="207,169,0,0"/>
+            <Label Content="Соревнования" HorizontalAlignment="Left" Margin="229,18,0,0" VerticalAlignment="Top" Width="198" FontSize="25"/>
+            <Label Content="ID:" HorizontalAlignment="Left" Margin="406,129,0,0" VerticalAlignment="Top"/>
+            <Label Content="Название:" HorizontalAlignment="Left" Margin="10,87,0,0" VerticalAlignment="Top"/>
+            <Label Content="Тренер:" HorizontalAlignment="Left" Margin="10,113,0,0" VerticalAlignment="Top"/>
+            <Label Content="Место:" HorizontalAlignment="Left" Margin="10,142,0,0" VerticalAlignment="Top"/>
+            <Label Content="Дата:" HorizontalAlignment="Left" Margin="10,176,0,0" VerticalAlignment="Top"/>
+            <TextBox Name="idsorevtxt" MaxLength="4" HorizontalAlignment="Left" Height="23" Margin="432,131,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="61"/>
+            <TextBox Name="nazvtxt" HorizontalAlignment="Left" MaxLength="18" Height="23" Margin="76,91,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183"/>
+            <TextBox Name="mestotxt" HorizontalAlignment="Left" MaxLength="18" Height="23" Margin="56,146,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="146"/>
+            <DatePicker Name="datapic" HorizontalAlignment="Left" Margin="48,179,0,0" VerticalAlignment="Top" Width="118" SelectedDateFormat="Short"/>
+            <Button Content="Добавить" HorizontalAlignment="Left" Margin="62,255,0,0" VerticalAlignment="Top" Width="84" Click="Addsorev_Click" Height="29"/>
+            <Button Content="Редактировать" HorizontalAlignment="Left" Margin="61,302,0,0" VerticalAlignment="Top" Width="89" Height="31" Click="Updatesorev_Click"/>
+            <Button Content="Удалить" HorizontalAlignment="Left" Margin="63,351,0,0" VerticalAlignment="Top" Width="83" Height="29" Click="deletesorev_Click"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="514,123,0,0" VerticalAlignment="Top" Width="158" Height="35" Click="showsorevtable_Click"/>
+            <ComboBox Name="sorevcombo" HorizontalAlignment="Left" Margin="76,119,0,0" VerticalAlignment="Top" Width="120"/>
+        </Grid>
+        <Grid Name="trener" Visibility="Hidden" Margin="118,0,0,0" Background="#FFE0CCCC">
+            <Label Content="Тренеры" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="132" FontSize="25" Margin="275,40,275,0"/>
+            <Label Content="Фамилия:" HorizontalAlignment="Left" Margin="53,126,0,0" VerticalAlignment="Top"/>
+            <Label Content="Имя:" HorizontalAlignment="Left" Margin="53,156,0,0" VerticalAlignment="Top"/>
+            <Label Content="Отчество:" HorizontalAlignment="Left" Margin="53,188,0,0" VerticalAlignment="Top"/>
+            <Label Content="Дата рождения:" HorizontalAlignment="Left" Margin="53,299,0,0" VerticalAlignment="Top"/>
+            <Label Content="Пароль:" HorizontalAlignment="Left" Margin="53,250,0,0" VerticalAlignment="Top"/>
+            <Label Content="Логин:" HorizontalAlignment="Left" Margin="53,219,0,0" VerticalAlignment="Top"/>
+
+            <TextBox Name="trenerfamiliatxt" HorizontalAlignment="Left" Height="23" Margin="120,128,0,0" TextWrapping="Wrap" MaxLength="15" VerticalAlignment="Top" Width="139"/>
+            <TextBox Name="trenernametxt" HorizontalAlignment="Left" Height="23" Margin="120,159,0,0" TextWrapping="Wrap" MaxLength="15" VerticalAlignment="Top" Width="139"/>
+            <TextBox Name="trenerotchestvotxt" HorizontalAlignment="Left" Height="23" Margin="120,191,0,0" TextWrapping="Wrap" MaxLength="15" VerticalAlignment="Top" Width="139"/>
+            <TextBox Name="logintxt" HorizontalAlignment="Left" Height="23" Margin="112,222,0,0" TextWrapping="Wrap" MaxLength="15" VerticalAlignment="Top" Width="139"/>
+            <PasswordBox Name="passwordtxt" HorizontalAlignment="Left" Height="23" Margin="112,253,0,0"  MaxLength="15" VerticalAlignment="Top" Width="139"/>
+            <DatePicker Name="trenerdatepic" HorizontalAlignment="Left" Height="31" Margin="160,299,0,0" VerticalAlignment="Top"/>
+            <Button Content="Добавить" HorizontalAlignment="Left" Margin="358,129,0,0" VerticalAlignment="Top" Width="101" Height="23" Click="Addtrener_Click"/>
+            <Button Content="Редактировать" HorizontalAlignment="Left" Margin="358,159,0,0" VerticalAlignment="Top" Width="101" Height="23" Click="Updatetrener_Click"/>
+            <Button Content="Удалить" HorizontalAlignment="Left" Margin="358,191,0,0" VerticalAlignment="Top" Width="101" Height="23" Click="Deletetrener_Click"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="487,289,0,0" VerticalAlignment="Top" Width="161" Height="36" Click="showtabletrener_Click"/>
+            <DataGrid Name="datagridtrener" HorizontalAlignment="Left" Height="108" Margin="10,332,0,0" VerticalAlignment="Top" Width="662"/>
+            <TextBox Name="Idtrener"  Height="23" Margin="570,254,46,0" TextWrapping="Wrap"  VerticalAlignment="Top"/>
+            <Label Content="ID" HorizontalAlignment="Left" Margin="544,253,0,0" VerticalAlignment="Top"/>
+        </Grid>
+        <Grid Name="chel" Visibility="Hidden" Background="#FFE0CCCC" Margin="118,0,0,0">
+            <Label Content="Тренирующиеся" HorizontalAlignment="Center"  VerticalAlignment="Top" Width="209" FontSize="25" Margin="225,40,248,0"/>
+            <Label Content="Фамилия:" HorizontalAlignment="Left" Margin="53,126,0,0" VerticalAlignment="Top"/>
+            <Label Content="Имя:" HorizontalAlignment="Left" Margin="53,156,0,0" VerticalAlignment="Top"/>
+            <Label Content="Отчество:" HorizontalAlignment="Left" Margin="53,188,0,0" VerticalAlignment="Top"/>
+            <Label Content="Тренер:" HorizontalAlignment="Left" Margin="53,218,0,0" VerticalAlignment="Top"/>
+            <Label Content="ID:" HorizontalAlignment="Left" Margin="381,249,0,0" VerticalAlignment="Top"/>
+            <Label Content="Дата рождения:" HorizontalAlignment="Left" Margin="53,249,0,0" VerticalAlignment="Top"/>
+            <TextBox Name="chelfamiliatxt" MaxLength="15" HorizontalAlignment="Left" Height="23" Margin="115,132,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
+            <TextBox Name="chelnametxt" MaxLength="15" HorizontalAlignment="Left" Height="23" Margin="115,160,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
+            <TextBox Name="chelotchestxt" MaxLength="15" HorizontalAlignment="Left" Height="23" Margin="115,191,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
+            <ComboBox Name="combotrener" HorizontalAlignment="Left" Margin="115,222,0,0" VerticalAlignment="Top" Width="120"/>
+            <DatePicker Name="cheldatepic" HorizontalAlignment="Left" Margin="151,251,0,0" VerticalAlignment="Top"/>
+            <DataGrid Name="cheldata" HorizontalAlignment="Left" Height="155" Margin="183,285,0,0" VerticalAlignment="Top" Width="489"/>
+            <Button Content="Сформировать таблицу" HorizontalAlignment="Left" Margin="526,236,0,0" VerticalAlignment="Top" Width="146" Height="33" Click="chelshowtable_Click"/>
+            <Button Content="Добавить" HorizontalAlignment="Left" Margin="89,303,0,0" VerticalAlignment="Top" Width="89" Height="30" Click="Addchel_Click"/>
+            <Button Content="Редактировать" HorizontalAlignment="Left" Margin="89,338,0,0" VerticalAlignment="Top" Width="89" Height="30" Click="updatechel_Click"/>
+            <Button Content="Удалить" HorizontalAlignment="Left" Margin="89,373,0,0" VerticalAlignment="Top" Width="89" Height="30" Click="deletechel_Click"/>
+            <TextBox Name="chelid" HorizontalAlignment="Left" Height="23" Margin="405,251,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="29"/>
+        </Grid>
+        <Button Content="X" HorizontalAlignment="Left" FontSize="25" Margin="755,0,0,0" VerticalAlignment="Top" Width="45" Height="45" Click="Exit_Click"/>
+    </Grid>
+</Window>

+ 473 - 0
BorisProject/WindowAdmin.xaml.cs

@@ -0,0 +1,473 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Data.SqlClient;
+using System.Data;
+
+namespace BorisProject
+{
+    /// <summary>
+    /// Логика взаимодействия для WindowAdmin.xaml
+    /// </summary>
+    public partial class WindowAdmin : Window
+    {
+        public WindowAdmin()
+        {
+            InitializeComponent();
+            fillcombosorev();
+            fillcombopeopletrain();
+        }
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=boris;Integrated Security=True");
+
+        //Добавить соревнование
+        private void Addsorev_Click(object sender, RoutedEventArgs e)
+        {
+            if (sorevcombo.Text == "" || nazvtxt.Text == "" || mestotxt.Text == "" || datapic.SelectedDate == null)
+            {
+                MessageBox.Show("Пустые поля");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd1 = new SqlCommand("Select ID_trener from Trener where LastName = '" + sorevcombo.Text + "'", con);
+                    cmd1.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter1 = new SqlDataAdapter();
+                    adapter1.SelectCommand = cmd1;
+                    DataSet dataSet1 = new DataSet();
+                    adapter1.Fill(dataSet1);
+                    if (dataSet1.Tables[0].Rows.Count > 0)
+                    {
+                        string stridtren = dataSet1.Tables[0].Rows[0]["ID_trener"].ToString();
+                        string sql = "INSERT INTO Sorevnovania (Title,Place,Date,ID_trener)  VALUES('" + nazvtxt.Text + "','" + mestotxt.Text + "','" + datapic.SelectedDate + "','" + stridtren.ToString()+ "')";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        MessageBox.Show("Успешно добавлен!");
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Ошибка!");
+                    }
+                }
+                catch (Exception)
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка!");
+                }          
+            }
+        }
+
+        private void trener_Click(object sender, RoutedEventArgs e)
+        {
+            trener.Visibility = Visibility.Visible;
+            chel.Visibility = Visibility.Hidden;
+            sorev.Visibility = Visibility.Hidden;
+        }
+
+        private void sorev_Click(object sender, RoutedEventArgs e)
+        {
+            sorev.Visibility = Visibility.Visible;
+            trener.Visibility = Visibility.Hidden;
+            chel.Visibility = Visibility.Hidden;
+        }
+
+        private void chel_Click(object sender, RoutedEventArgs e)
+        {
+            chel.Visibility = Visibility.Visible;
+            sorev.Visibility = Visibility.Hidden;
+            trener.Visibility = Visibility.Hidden;
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        private void Addtrener_Click(object sender, RoutedEventArgs e)
+        {
+            if (trenerfamiliatxt.Text == "" || trenernametxt.Text == "" || trenerotchestvotxt.Text == "" || trenerdatepic.SelectedDate == null || logintxt.Text == "" || passwordtxt.Password == "")
+            {
+                MessageBox.Show("Пустые поля!");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "INSERT INTO Trener (LastName,FirstName,MiddleName,DOB,Login,Password)  VALUES('" + trenerfamiliatxt.Text + "','" + trenernametxt.Text + "','" + trenerotchestvotxt.Text + "','" + trenerdatepic.SelectedDate + "','" + logintxt.Text + "','" + passwordtxt.Password + "')";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    MessageBox.Show("Тренер добавлен!");
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void Deletetrener_Click(object sender, RoutedEventArgs e)
+        {
+            if (Idtrener.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Trener WHERE ID_trener = '" + Idtrener.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    MessageBox.Show("Тренер удален!");
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void Updatetrener_Click(object sender, RoutedEventArgs e)
+        {
+            if (Idtrener.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "Update Trener set LastName ='" + trenerfamiliatxt.Text + "', FirstName = '" + trenernametxt.Text + "', MiddleName = '" + trenerotchestvotxt.Text + "', DOB = '" + trenerdatepic.SelectedDate + "', Login = '" + logintxt.Text + "', Password = '" + passwordtxt.Password + "' where ID_trener = '" + Idtrener.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    MessageBox.Show("Тренер изменен");
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void showtabletrener_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT * From Trener";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("Trener");
+                dataAdapter.Fill(data);
+                datagridtrener.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datagridtrener.Columns[0].Header = "ID";
+                datagridtrener.Columns[1].Header = "Фамилия";
+                datagridtrener.Columns[2].Header = "Имя";
+                datagridtrener.Columns[3].Header = "Отчество";
+                datagridtrener.Columns[4].Header = "Дата рождения";
+                datagridtrener.Columns[5].Header = "Логин";
+                datagridtrener.Columns[6].Header = "Пароль";
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+
+       void fillcombosorev()
+        {
+            try
+            {
+                sorevcombo.Items.Clear();
+                con.Open();
+                SqlCommand sql = con.CreateCommand();
+                sql.CommandType = CommandType.Text;        
+                sql.CommandText = "Select LastName from Trener";
+                sql.ExecuteNonQuery();
+                DataTable dt = new DataTable();
+                SqlDataAdapter da = new SqlDataAdapter(sql);
+                da.Fill(dt);
+                foreach (DataRow dr in dt.Rows)
+                {
+                    sorevcombo.Items.Add(dr["LastName"].ToString());
+                }
+                con.Close();
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+
+        private void showsorevtable_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT ID_sorev,Title,Place,[Date], Trener.LastName From Sorevnovania inner join Trener on Trener.ID_trener = Sorevnovania.ID_trener";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("Sorevnovania");
+                dataAdapter.Fill(data);
+                datasorev.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datasorev.Columns[0].Header = "ID";
+                datasorev.Columns[1].Header = "Название";
+                datasorev.Columns[2].Header = "Место";
+                datasorev.Columns[3].Header = "Дата";
+                datasorev.Columns[4].Header = "Тренер";
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+        void fillcombopeopletrain()
+        {
+            try
+            {
+                combotrener.Items.Clear();
+                con.Open();
+                SqlCommand sql = con.CreateCommand();
+                sql.CommandType = CommandType.Text;
+                sql.CommandText = "Select LastName from Trener";
+                sql.ExecuteNonQuery();
+                DataTable dt = new DataTable();
+                SqlDataAdapter da = new SqlDataAdapter(sql);
+                da.Fill(dt);
+                foreach (DataRow dr in dt.Rows)
+                {
+                    combotrener.Items.Add(dr["LastName"].ToString());
+                }
+                con.Close();
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+
+        private void deletesorev_Click(object sender, RoutedEventArgs e)
+        {
+            if (idsorevtxt.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Sorevnovania WHERE ID_sorev = '" + idsorevtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    MessageBox.Show("Тренер удален!");
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void Updatesorev_Click(object sender, RoutedEventArgs e)
+        {
+            if (idsorevtxt.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd1 = new SqlCommand("Select ID_trener from Trener where LastName = '" + sorevcombo.Text + "'", con);
+                    cmd1.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter1 = new SqlDataAdapter();
+                    adapter1.SelectCommand = cmd1;
+                    DataSet dataSet1 = new DataSet();
+                    adapter1.Fill(dataSet1);
+                    if (dataSet1.Tables[0].Rows.Count > 0)
+                    {
+                        string stridtren = dataSet1.Tables[0].Rows[0]["ID_trener"].ToString();
+                        string sql = "Update Sorevnovania set Title ='" + nazvtxt.Text + "', Place = '" + mestotxt.Text + "', Date = '" + datapic.SelectedDate + "', ID_trener = '" + stridtren.ToString() + "' where ID_sorev = '" + idsorevtxt.Text + "'";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        MessageBox.Show("Успешно изменен!");
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Ошибка combo!");
+                    }
+                }
+                catch
+                {
+                    con.Close();
+                     MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void Addchel_Click(object sender, RoutedEventArgs e)
+        {
+            if (chelnametxt.Text==""||chelfamiliatxt.Text==""||chelotchestxt.Text==""||cheldatepic.SelectedDate==null||combotrener.Text=="")
+            {
+                MessageBox.Show("Пустые поля");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd1 = new SqlCommand("Select ID_trener from Trener where LastName = '" + combotrener.Text + "'", con);
+                    cmd1.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter1 = new SqlDataAdapter();
+                    adapter1.SelectCommand = cmd1;
+                    DataSet dataSet1 = new DataSet();
+                    adapter1.Fill(dataSet1);
+                    if (dataSet1.Tables[0].Rows.Count > 0)
+                    {
+                        string stridtren = dataSet1.Tables[0].Rows[0]["ID_trener"].ToString();
+                        string sql = "INSERT INTO PeopleTrain (FirstName,LastName,MiddleName,DOB,ID_Trener)  VALUES('" + chelnametxt.Text  + "','" + chelfamiliatxt.Text + "','" + chelotchestxt.Text + "','" + cheldatepic.SelectedDate + "','" + stridtren.ToString() + "')";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        MessageBox.Show("Успешно добавлен!");
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Ошибка!");
+                    }
+                }
+                catch (Exception)
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка!");
+                }
+            }
+        }
+
+        private void chelshowtable_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT ID_People,PeopleTrain.FirstName,PeopleTrain.LastName,PeopleTrain.MiddleName,PeopleTrain.DOB,Trener.LastName From PeopleTrain inner join Trener on Trener.ID_trener = PeopleTrain.ID_Trener";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("PeopleTraim");
+                dataAdapter.Fill(data);
+                cheldata.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                cheldata.Columns[0].Header = "ID";
+                cheldata.Columns[1].Header = "Имя";
+                cheldata.Columns[2].Header = "Фамилия";
+                cheldata.Columns[3].Header = "Отчество";
+                cheldata.Columns[4].Header = "Дата рождения";
+                cheldata.Columns[5].Header = "Тренер";
+            }
+            catch
+            {
+                con.Close();
+                MessageBox.Show("Ошибка");
+            }
+        }
+
+        private void deletechel_Click(object sender, RoutedEventArgs e)
+        {
+            if (chelid.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM PeopleTrain WHERE ID_people = '" + chelid.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    MessageBox.Show("Запись удалена!");
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+
+        private void updatechel_Click(object sender, RoutedEventArgs e)
+        {
+            if (chelid.Text == "")
+            {
+                MessageBox.Show("ID не указано");
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd1 = new SqlCommand("Select ID_trener from Trener where LastName = '" + combotrener.Text + "'", con);
+                    cmd1.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter1 = new SqlDataAdapter();
+                    adapter1.SelectCommand = cmd1;
+                    DataSet dataSet1 = new DataSet();
+                    adapter1.Fill(dataSet1);
+                    if (dataSet1.Tables[0].Rows.Count > 0)
+                    {
+                        string stridtren = dataSet1.Tables[0].Rows[0]["ID_trener"].ToString();
+                        string sql = "Update PeopleTrain set FirstName ='" + chelnametxt.Text + "', LastName = '" + chelfamiliatxt.Text + "', MiddleName = '" + chelotchestxt.Text + "', DOB = '" + cheldatepic.SelectedDate + "', ID_Trener = '" + stridtren.ToString() + "' where ID_people = '" + chelid.Text + "'";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        MessageBox.Show("Успешно изменен!");
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Ошибка combo!");
+                    }
+                }
+                catch
+                {
+                    con.Close();
+                    MessageBox.Show("Ошибка");
+                }
+            }
+        }
+    }
+}