浏览代码

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

Артем Гавриленко 3 年之前
当前提交
e5ae482b18
共有 50 个文件被更改,包括 4745 次插入0 次删除
  1. 63 0
      .gitattributes
  2. 363 0
      .gitignore
  3. 25 0
      Kusach.sln
  4. 85 0
      Kusach/AddDriverWindow.xaml
  5. 53 0
      Kusach/AddDriverWindow.xaml.cs
  6. 61 0
      Kusach/AddPointWindow.xaml
  7. 51 0
      Kusach/AddPointWindow.xaml.cs
  8. 61 0
      Kusach/AddRouteWindow.xaml
  9. 51 0
      Kusach/AddRouteWindow.xaml.cs
  10. 61 0
      Kusach/AddTransportWindow.xaml
  11. 51 0
      Kusach/AddTransportWindow.xaml.cs
  12. 64 0
      Kusach/AddUserWindow.xaml
  13. 43 0
      Kusach/AddUserWindow.xaml.cs
  14. 10 0
      Kusach/App.config
  15. 9 0
      Kusach/App.xaml
  16. 17 0
      Kusach/App.xaml.cs
  17. 233 0
      Kusach/DataWindow.xaml
  18. 107 0
      Kusach/DataWindow.xaml.cs
  19. 60 0
      Kusach/DeleteUserWindow.xaml
  20. 33 0
      Kusach/DeleteUserWindow.xaml.cs
  21. 30 0
      Kusach/Dispatcher.cs
  22. 33 0
      Kusach/Drivers.cs
  23. 24 0
      Kusach/DriversList.cs
  24. 37 0
      Kusach/EDM.Context.cs
  25. 636 0
      Kusach/EDM.Context.tt
  26. 10 0
      Kusach/EDM.Designer.cs
  27. 9 0
      Kusach/EDM.cs
  28. 504 0
      Kusach/EDM.edmx
  29. 26 0
      Kusach/EDM.edmx.diagram
  30. 304 0
      Kusach/EDM.edmx.sql
  31. 733 0
      Kusach/EDM.tt
  32. 20 0
      Kusach/Encrypt.cs
  33. 238 0
      Kusach/Kusach.csproj
  34. 62 0
      Kusach/LogWindow.xaml
  35. 39 0
      Kusach/LogWindow.xaml.cs
  36. 30 0
      Kusach/Points.cs
  37. 24 0
      Kusach/PointsList.cs
  38. 55 0
      Kusach/Properties/AssemblyInfo.cs
  39. 70 0
      Kusach/Properties/Resources.Designer.cs
  40. 117 0
      Kusach/Properties/Resources.resx
  41. 29 0
      Kusach/Properties/Settings.Designer.cs
  42. 7 0
      Kusach/Properties/Settings.settings
  43. 59 0
      Kusach/RegWindow.xaml
  44. 46 0
      Kusach/RegWindow.xaml.cs
  45. 24 0
      Kusach/RouteList.cs
  46. 36 0
      Kusach/Routes.cs
  47. 30 0
      Kusach/Transport.cs
  48. 7 0
      Kusach/cnt.cs
  49. 5 0
      Kusach/packages.config
  50. 二进制
      Kusach/placeholder.png

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 363 - 0
.gitignore

@@ -0,0 +1,363 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd

+ 25 - 0
Kusach.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31605.320
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kusach", "Kusach\Kusach.csproj", "{DC74454C-D8E7-43E9-B525-38E48BE898E7}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DC74454C-D8E7-43E9-B525-38E48BE898E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DC74454C-D8E7-43E9-B525-38E48BE898E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DC74454C-D8E7-43E9-B525-38E48BE898E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DC74454C-D8E7-43E9-B525-38E48BE898E7}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {EC602ADA-8094-49B9-9F8F-6FB8DDA7392C}
+	EndGlobalSection
+EndGlobal

+ 85 - 0
Kusach/AddDriverWindow.xaml

@@ -0,0 +1,85 @@
+<Window x:Class="Kusach.AddDriverWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddDriverWindow" 
+        Height="350" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="IdTransport" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="IdTransportBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+            Content="Имя" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="NameBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+                Content="Фамилия" 
+                HorizontalAlignment="Left" 
+                VerticalAlignment="Top" 
+                Height="30" 
+                Width="190"/>
+            <TextBox 
+                x:Name="SurnameBox"
+                HorizontalAlignment="Left" 
+                VerticalAlignment="Top" 
+                Height="30" 
+                Width="190"/>
+            <Label 
+                Content="Отчество" 
+                HorizontalAlignment="Left" 
+                VerticalAlignment="Top" 
+                Height="30" 
+                Width="190"/>
+            <TextBox 
+                x:Name="PatronymicBox"
+                HorizontalAlignment="Left" 
+                VerticalAlignment="Top" 
+                Height="30" 
+                Width="190"/>
+        </StackPanel>
+        <Button 
+            Content="Создать &#xD;&#xA;водителя" 
+            HorizontalAlignment="Left"
+            Margin="170,300,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="AddDriverButton_Click"/>
+        <Button 
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,300,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 53 - 0
Kusach/AddDriverWindow.xaml.cs

@@ -0,0 +1,53 @@
+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;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для AddDriverWindow.xaml
+    /// </summary>
+    public partial class AddDriverWindow : Window
+    {
+        public AddDriverWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void AddDriverButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (IdTransportBox.Text == "" || NameBox.Text == "" || SurnameBox.Text == "" || PatronymicBox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else
+            {
+                Drivers newDriver = new Drivers()
+                {
+                    IdDriver = cnt.db.Drivers.Count()+1,
+                    IdTransport = Convert.ToInt32(IdTransportBox.Text),
+                    Name = NameBox.Text,
+                    Surname = SurnameBox.Text,
+                    Patronymic = PatronymicBox.Text
+                };
+                cnt.db.Drivers.Add(newDriver);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Водитель успешно создан.");
+                this.Close();
+            }
+        }
+    }
+}

+ 61 - 0
Kusach/AddPointWindow.xaml

@@ -0,0 +1,61 @@
+<Window x:Class="Kusach.AddPointWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddPointWindow" 
+        Height="250" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="Название" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="NameBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+            Content="Локация" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="LocationBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+        </StackPanel>
+        <Button 
+            Content="Создать &#xD;&#xA;место остановки" 
+            HorizontalAlignment="Left"
+            Margin="170,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="AddPointButton_Click"/>
+        <Button 
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 51 - 0
Kusach/AddPointWindow.xaml.cs

@@ -0,0 +1,51 @@
+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;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для AddPointWindow.xaml
+    /// </summary>
+    public partial class AddPointWindow : Window
+    {
+        public AddPointWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void AddPointButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (NameBox.Text == "" || LocationBox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else
+            {
+                Points newPoint = new Points()
+                {
+                    IdPoint = cnt.db.Points.Count() + 1,
+                    Name = NameBox.Text,
+                    location = LocationBox.Text
+                };
+                cnt.db.Points.Add(newPoint);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Точка остановки успешно создана.");
+                this.Close();
+            }
+        }
+    }
+}

+ 61 - 0
Kusach/AddRouteWindow.xaml

@@ -0,0 +1,61 @@
+<Window x:Class="Kusach.AddRouteWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddRouteWindow" 
+        Height="250" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="IdDriver" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="IdDriverBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+            Content="Название" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="RouteNameBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+        </StackPanel>
+        <Button 
+            Content="Создать &#xD;&#xA;маршрут" 
+            HorizontalAlignment="Left"
+            Margin="170,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="AddUserButton_Click"/>
+        <Button 
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 51 - 0
Kusach/AddRouteWindow.xaml.cs

@@ -0,0 +1,51 @@
+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;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для AddRouteWindow.xaml
+    /// </summary>
+    public partial class AddRouteWindow : Window
+    {
+        public AddRouteWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void AddUserButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (IdDriverBox.Text == "" || RouteNameBox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else
+            {
+                Routes newRoute = new Routes()
+                {
+                    IdRoute = cnt.db.Routes.Count() + 1,
+                    IdDriver = Convert.ToInt32(IdDriverBox.Text),
+                    Name = RouteNameBox.Text
+                };
+                cnt.db.Routes.Add(newRoute);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Маршрут успешно создан.");
+                this.Close();
+            }
+        }
+    }
+}

+ 61 - 0
Kusach/AddTransportWindow.xaml

@@ -0,0 +1,61 @@
+<Window x:Class="Kusach.AddTransportWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddTransportWindow"         
+        Height="250" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="Название ТС" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="NameOfTransportBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+            Content="Номерной знак" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="NumberPlateBox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+        </StackPanel>
+        <Button 
+            Content="Создать &#xD;&#xA;транспорт" 
+            HorizontalAlignment="Left"
+            Margin="170,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="AddTransportButton_Click"/>
+        <Button 
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 51 - 0
Kusach/AddTransportWindow.xaml.cs

@@ -0,0 +1,51 @@
+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;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для AddTransportWindow.xaml
+    /// </summary>
+    public partial class AddTransportWindow : Window
+    {
+        public AddTransportWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void AddTransportButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (NameOfTransportBox.Text == "" || NumberPlateBox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else
+            {
+                Transport newTransport = new Transport()
+                {
+                    IdTransport = cnt.db.Transport.Count() + 1,
+                    NameOfTransport = NameOfTransportBox.Text,
+                    NumberPlate = NumberPlateBox.Text
+                };
+                cnt.db.Transport.Add(newTransport);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Транспортное средство успешно создано.");
+                this.Close();
+            }
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 64 - 0
Kusach/AddUserWindow.xaml

@@ -0,0 +1,64 @@
+<Window x:Class="Kusach.AddUserWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddUserWindow" 
+        Height="250" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="Логин:" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="logbox" 
+            HorizontalAlignment="Left" 
+            TextWrapping="Wrap" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <Label 
+            Content="Пароль:" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <TextBox 
+            x:Name="passbox"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+        </StackPanel>
+        <Button 
+            x:Name="AddUserButton" 
+            Content="Создать &#xD;&#xA;пользователя" 
+            HorizontalAlignment="Left"
+            Margin="170,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="AddUserButton_Click"/>
+        <Button 
+            x:Name="BackButton"
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,200,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 43 - 0
Kusach/AddUserWindow.xaml.cs

@@ -0,0 +1,43 @@
+using System.Linq;
+using System.Windows;
+
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для AddUserWindow.xaml
+    /// </summary>
+    public partial class AddUserWindow : Window
+    {
+        public AddUserWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void AddUserButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (logbox.Text == "" || passbox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else if (cnt.db.Dispatcher.Select(item => item.Login).Contains(logbox.Text))
+                MessageBox.Show("Данный логин уже занят");
+            else
+            {
+                Dispatcher newUser = new Dispatcher()
+                {
+                    IdDispatcher = cnt.db.Dispatcher.Count() + 1,
+                    Login = logbox.Text,
+                    Password = passbox.Text
+                };
+                cnt.db.Dispatcher.Add(newUser);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Пользователь успешно создан.");
+                this.Close();
+            }
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

文件差异内容过多而无法显示
+ 10 - 0
Kusach/App.config


+ 9 - 0
Kusach/App.xaml

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

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

+ 233 - 0
Kusach/DataWindow.xaml

@@ -0,0 +1,233 @@
+<Window x:Class="Kusach.DataWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Loaded="UserDateView"
+        Title="Взаимодействие с информацией" Height="450" Width="800">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="100" />
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <Button 
+            x:Name="BackButton" 
+            Content="Выход" 
+            HorizontalAlignment="Stretch" 
+            VerticalAlignment="Stretch" 
+            Click="BackButton_Click"/>
+        <TabControl
+            Name="TabContrl"
+            Grid.Row="2">
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Width="90">
+                            <Run Text="Управление"/>
+                            <LineBreak/>
+                            <Run Text="пользователями"/>
+                        </TextBlock>
+                    </StackPanel>
+                </TabItem.Header>
+                <TabItem.Content>
+                    <StackPanel>
+                        <TextBox 
+                            Name="UserSearch" 
+                            HorizontalAlignment="Left" 
+                            TextWrapping="Wrap" 
+                            Text="Поиск..."
+                            Width="94"
+                            Foreground="#808080"
+                            VerticalAlignment="Top" TextChanged="UserSearch_TextChanged"/>
+                        <Button 
+                            Content="Добавить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="AddUserButton_Click"/>
+                        <Button 
+                            Content="Изменить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="UpdateUserButton_Click"/>
+                        <Button 
+                            Content="Обновить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="UserDateView"/>
+                        <Button 
+                            Content="Удалить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="DeleteUserButton_Click"/>
+                    </StackPanel>
+                </TabItem.Content>
+            </TabItem>
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Width="90">
+                            <Run Text="Управление"/>
+                            <LineBreak/>
+                            <Run Text="маршрутами"/>
+                        </TextBlock>
+                    </StackPanel>
+                </TabItem.Header>
+                <TabItem.Content>
+                    <StackPanel>
+                        <Button 
+                            Content="Поиск" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="FindRouteButton_Click"/>
+                        <Button
+                            Content="Добавить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="AddRouteButton_Click"/>
+                        <Button 
+                            Content="Обновить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="RoutesDateView"/>
+                        <Button 
+                            Content="Удалить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"/>
+                    </StackPanel>
+                </TabItem.Content>
+            </TabItem>
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Width="90">
+                            <Run Text="Управление"/>
+                            <LineBreak/>
+                            <Run Text="точками"/>
+                        </TextBlock>
+                    </StackPanel>
+                </TabItem.Header>
+                <TabItem.Content>
+                    <StackPanel>
+                        <Button 
+                            Content="Поиск" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="FindRouteButton_Click"/>
+                        <Button 
+                            Content="Добавить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="AddPointButton_Click"/>
+                        <Button 
+                            Content="Обновить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="PointDateView"/>
+                        <Button 
+                            Content="Удалить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"/>
+                    </StackPanel>
+                </TabItem.Content>
+            </TabItem>
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Width="90">
+                            <Run Text="Управление"/>
+                            <LineBreak/>
+                            <Run Text="водителями"/>
+                        </TextBlock>
+                    </StackPanel>
+                </TabItem.Header>
+                <TabItem.Content>
+                    <StackPanel>
+                        <Button 
+                            Content="Поиск" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="FindRouteButton_Click"/>
+                        <Button 
+                            Content="Добавить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="AddDriverButton_Click"/>
+                        <Button 
+                            Content="Обновить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="DriversDateView"/>
+                        <Button 
+                            Content="Удалить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"/>
+                    </StackPanel>
+                </TabItem.Content>
+            </TabItem>
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Width="90">
+                            <Run Text="Управление"/>
+                            <LineBreak/>
+                            <Run Text="транспортом"/>
+                        </TextBlock>
+                    </StackPanel>
+                </TabItem.Header>
+                <TabItem.Content>
+                    <StackPanel>
+                        <Button 
+                            Content="Поиск" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="FindRouteButton_Click"/>
+                        <Button 
+                            Content="Добавить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="AddTransportButton_Click"/>
+                        <Button 
+                            Content="Обновить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"
+                            Click="TransportDateView"/>
+                        <Button 
+                            Content="Удалить" 
+                            HorizontalAlignment="Stretch" 
+                            VerticalAlignment="Top" 
+                            Height="20"/>
+                    </StackPanel>
+                </TabItem.Content>
+            </TabItem>
+        </TabControl>
+        <DataGrid
+            x:Name="DataGrid"
+            Grid.Column="1"
+            Grid.RowSpan="2"/>
+    </Grid>
+</Window>

+ 107 - 0
Kusach/DataWindow.xaml.cs

@@ -0,0 +1,107 @@
+using System.Data;
+using System.Linq;
+using System.Windows;
+using System.Windows.Media;
+using System.Diagnostics;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для DataWindow.xaml
+    /// </summary>
+    public partial class DataWindow : Window
+    {
+        public DataWindow()
+        {
+            InitializeComponent();
+        }
+        private void UserDateView(object sender, RoutedEventArgs e)
+        {
+            var query = from Dispatcher in cnt.db.Dispatcher
+                        select new { Dispatcher.IdDispatcher, Dispatcher.Login, Dispatcher.Password };
+            DataGrid.ItemsSource = query.ToList();
+        }
+        private void RoutesDateView(object sender, RoutedEventArgs e)
+        {
+            var query = from Routes in cnt.db.Routes
+                        select new { Routes.IdRoute, Routes.IdDriver, Routes.Name };
+            DataGrid.ItemsSource = query.ToList();
+        }
+        private void TransportDateView(object sender, RoutedEventArgs e)
+        {
+            var query = from Transport in cnt.db.Transport
+                        select new { Transport.IdTransport, Transport.NameOfTransport, Transport.NumberPlate };
+            DataGrid.ItemsSource = query.ToList();
+        }
+        private void PointDateView(object sender, RoutedEventArgs e)
+        {
+            var query = from Points in cnt.db.Points
+                        select new { Points.IdPoint, Points.Name, Points.location };
+            DataGrid.ItemsSource = query.ToList();
+        }
+        private void DriversDateView(object sender, RoutedEventArgs e)
+        {
+            var query = from Drivers in cnt.db.Drivers
+                        select new { Drivers.IdDriver, Drivers.Transport, Drivers.Name, Drivers.Surname, Drivers.Patronymic };
+            DataGrid.ItemsSource = query.ToList();
+        }
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            LogWindow lw = new LogWindow();
+            lw.Show();
+            this.Close();
+        }
+
+        private void AddUserButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddUserWindow auw = new AddUserWindow();
+            auw.ShowDialog();
+        }
+        private void DeleteUserButton_Click(object sender, RoutedEventArgs e)
+        {
+
+            //MessageBox.Show(TabContrl.SelectedItem());
+        }
+
+        private void FindRouteButton_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void AddRouteButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddRouteWindow arw = new AddRouteWindow();
+            arw.ShowDialog();
+        }
+
+        private void AddTransportButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddTransportWindow atw = new AddTransportWindow();
+            atw.ShowDialog();
+        }
+
+        private void AddPointButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddPointWindow apw = new AddPointWindow();
+            apw.ShowDialog();
+        }
+
+        private void AddDriverButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddDriverWindow adw = new AddDriverWindow();
+            adw.ShowDialog();
+        }
+
+        private void UpdateUserButton_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void UserSearch_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+        {
+            //var query = from Dispatcher in cnt.db.Dispatcher
+            //            select new { Dispatcher.IdDispatcher, Dispatcher.Login, Dispatcher.Password };
+            //DataGrid.ItemsSource = query.ToList().Where(item => item.Login == UserSearch.Text);
+        }
+    }
+}

+ 60 - 0
Kusach/DeleteUserWindow.xaml

@@ -0,0 +1,60 @@
+<Window x:Class="Kusach.DeleteUserWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Title="AddUserWindow" 
+        Height="200" 
+        Width="300"
+        ResizeMode="NoResize"
+        WindowStyle="None"
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <StackPanel
+            Margin="0,10,0,0"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Top">
+            <Label 
+            Content="Удалить по: " 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+            <ComboBox
+                Name="DeleteList"
+                Margin="0,10,0,0"
+                Height="30" 
+                VerticalAlignment="Top">
+                <TextBlock>id</TextBlock>
+                <TextBlock>Логину</TextBlock>
+            </ComboBox>
+            <TextBox 
+            x:Name="DeleteBox"
+            Margin="0,10,0,0"
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top" 
+            Height="30" 
+            Width="190"/>
+        </StackPanel>
+        <Button 
+            x:Name="DeleteUserButton" 
+            Content="Удалить &#xD;&#xA;пользователя" 
+            HorizontalAlignment="Left"
+            Margin="170,145,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="DeleteUserButton_Click"/>
+        <Button 
+            x:Name="BackButton"
+            Content="Отмена"
+            HorizontalAlignment="Left" 
+            Margin="10,145,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="120" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 33 - 0
Kusach/DeleteUserWindow.xaml.cs

@@ -0,0 +1,33 @@
+using System.Windows;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для DeleteUserWindow.xaml
+    /// </summary>
+    public partial class DeleteUserWindow : Window
+    {
+        public DeleteUserWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void DeleteUserButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (DeleteList.Text == "" || DeleteBox.Text == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else
+            {
+                //cnt.db.Users.Remove();
+                //cnt.db.SaveChanges();
+                MessageBox.Show("Пользователь успешно удален.");
+                this.Close();
+            }
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 30 - 0
Kusach/Dispatcher.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Dispatcher
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Dispatcher()
+        {
+            this.RouteList = new HashSet<RouteList>();
+        }
+    
+        public int IdDispatcher { get; set; }
+        public string Login { get; set; }
+        public string Password { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<RouteList> RouteList { get; set; }
+    }
+}

+ 33 - 0
Kusach/Drivers.cs

@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Drivers
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Drivers()
+        {
+            this.DriversList = new HashSet<DriversList>();
+        }
+    
+        public int IdDriver { get; set; }
+        public int IdTransport { get; set; }
+        public string Surname { get; set; }
+        public string Name { get; set; }
+        public string Patronymic { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<DriversList> DriversList { get; set; }
+        public virtual Transport Transport { get; set; }
+    }
+}

+ 24 - 0
Kusach/DriversList.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class DriversList
+    {
+        public int Id { get; set; }
+        public int IdDriver { get; set; }
+        public int IdRoute { get; set; }
+    
+        public virtual Drivers Drivers { get; set; }
+        public virtual Routes Routes { get; set; }
+    }
+}

+ 37 - 0
Kusach/EDM.Context.cs

@@ -0,0 +1,37 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Data.Entity;
+    using System.Data.Entity.Infrastructure;
+    
+    public partial class EDM : DbContext
+    {
+        public EDM()
+            : base("name=EDM")
+        {
+        }
+    
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            throw new UnintentionalCodeFirstException();
+        }
+    
+        public virtual DbSet<Dispatcher> Dispatcher { get; set; }
+        public virtual DbSet<Drivers> Drivers { get; set; }
+        public virtual DbSet<DriversList> DriversList { get; set; }
+        public virtual DbSet<Points> Points { get; set; }
+        public virtual DbSet<PointsList> PointsList { get; set; }
+        public virtual DbSet<RouteList> RouteList { get; set; }
+        public virtual DbSet<Routes> Routes { get; set; }
+        public virtual DbSet<Transport> Transport { get; set; }
+    }
+}

+ 636 - 0
Kusach/EDM.Context.tt

@@ -0,0 +1,636 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@
+ output extension=".cs"#><#
+
+const string inputFile = @"EDM.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
+var itemCollection = loader.CreateEdmItemCollection(inputFile);
+var modelNamespace = loader.GetModelNamespace(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
+if (container == null)
+{
+    return string.Empty;
+}
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+<#
+
+var codeNamespace = code.VsNamespaceSuggestion();
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#
+    PushIndent("    ");
+}
+
+#>
+using System;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+<#
+if (container.FunctionImports.Any())
+{
+#>
+using System.Data.Entity.Core.Objects;
+using System.Linq;
+<#
+}
+#>
+
+<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
+{
+    public <#=code.Escape(container)#>()
+        : base("name=<#=container.Name#>")
+    {
+<#
+if (!loader.IsLazyLoadingEnabled(container))
+{
+#>
+        this.Configuration.LazyLoadingEnabled = false;
+<#
+}
+
+foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+{
+    // Note: the DbSet members are defined below such that the getter and
+    // setter always have the same accessibility as the DbSet definition
+    if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
+    {
+#>
+        <#=codeStringGenerator.DbSetInitializer(entitySet)#>
+<#
+    }
+}
+#>
+    }
+
+    protected override void OnModelCreating(DbModelBuilder modelBuilder)
+    {
+        throw new UnintentionalCodeFirstException();
+    }
+
+<#
+    foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+    {
+#>
+    <#=codeStringGenerator.DbSet(entitySet)#>
+<#
+    }
+
+    foreach (var edmFunction in container.FunctionImports)
+    {
+        WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
+    }
+#>
+}
+<#
+
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+    PopIndent();
+#>
+}
+<#
+}
+#>
+<#+
+
+private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+{
+    if (typeMapper.IsComposable(edmFunction))
+    {
+#>
+
+    [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
+    <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
+    }
+<#+
+    }
+    else
+    {
+#>
+
+    <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
+    }
+<#+
+        if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
+        {
+            WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
+        }
+    }
+}
+
+public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
+{
+#>
+        var <#=name#> = <#=isNotNull#> ?
+            <#=notNullInit#> :
+            <#=nullInit#>;
+
+<#+
+}
+
+public const string TemplateId = "CSharp_DbContext_Context_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string DbSetInitializer(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} = Set<{1}>();",
+            _code.Escape(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 10 - 0
Kusach/EDM.Designer.cs

@@ -0,0 +1,10 @@
+// Создание кода T4 для модели "G:\Kusach\KusachVER2\Kusach\EDM.edmx" включено. 
+// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
+// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
+// открыта в конструкторе.
+
+// Если не сформированы контекст и классы сущности, возможная причина в том, что вы создали пустую модель, но
+// еще не выбрали версию Entity Framework для использования. Чтобы сформировать класс контекста и классы сущностей
+// для своей модели, откройте модель в конструкторе, щелкните правой кнопкой область конструктора и
+// выберите "Обновить модель из базы данных", "Сформировать базу данных из модели" или "Добавить элемент формирования
+// кода...".

+ 9 - 0
Kusach/EDM.cs

@@ -0,0 +1,9 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+

+ 504 - 0
Kusach/EDM.edmx

@@ -0,0 +1,504 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+  <!-- EF Runtime content -->
+  <edmx:Runtime>
+    <!-- SSDL content -->
+    <edmx:StorageModels>
+    <Schema Namespace="gr692_gavModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2012" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+  <EntityContainer Name="gr692_gavModelStoreContainer">
+    <EntitySet Name="Dispatcher" EntityType="gr692_gavModel.Store.Dispatcher" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Drivers" EntityType="gr692_gavModel.Store.Drivers" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="DriversList" EntityType="gr692_gavModel.Store.DriversList" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Points" EntityType="gr692_gavModel.Store.Points" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="PointsList" EntityType="gr692_gavModel.Store.PointsList" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="RouteList" EntityType="gr692_gavModel.Store.RouteList" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Routes" EntityType="gr692_gavModel.Store.Routes" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Transport" EntityType="gr692_gavModel.Store.Transport" store:Type="Tables" Schema="dbo" />
+    <AssociationSet Name="FK__RouteList__IdRou__6383C8BA" Association="gr692_gavModel.Store.FK__RouteList__IdRou__6383C8BA">
+      <End Role="Dispatcher" EntitySet="Dispatcher" />
+      <End Role="RouteList" EntitySet="RouteList" />
+    </AssociationSet>
+    <AssociationSet Name="FK__DriversLi__IdDri__0C85DE4D" Association="gr692_gavModel.Store.FK__DriversLi__IdDri__0C85DE4D">
+      <End Role="Drivers" EntitySet="Drivers" />
+      <End Role="DriversList" EntitySet="DriversList" />
+    </AssociationSet>
+    <AssociationSet Name="FK_Drivers_Transport" Association="gr692_gavModel.Store.FK_Drivers_Transport">
+      <End Role="Transport" EntitySet="Transport" />
+      <End Role="Drivers" EntitySet="Drivers" />
+    </AssociationSet>
+    <AssociationSet Name="FK__DriversLi__IdRou__68487DD7" Association="gr692_gavModel.Store.FK__DriversLi__IdRou__68487DD7">
+      <End Role="Routes" EntitySet="Routes" />
+      <End Role="DriversList" EntitySet="DriversList" />
+    </AssociationSet>
+    <AssociationSet Name="FK__PointsLis__IdPoi__6477ECF3" Association="gr692_gavModel.Store.FK__PointsLis__IdPoi__6477ECF3">
+      <End Role="Points" EntitySet="Points" />
+      <End Role="PointsList" EntitySet="PointsList" />
+    </AssociationSet>
+    <AssociationSet Name="FK__PointsLis__IdRou__66603565" Association="gr692_gavModel.Store.FK__PointsLis__IdRou__66603565">
+      <End Role="Routes" EntitySet="Routes" />
+      <End Role="PointsList" EntitySet="PointsList" />
+    </AssociationSet>
+    <AssociationSet Name="FK__RouteList__IdRou__628FA481" Association="gr692_gavModel.Store.FK__RouteList__IdRou__628FA481">
+      <End Role="Routes" EntitySet="Routes" />
+      <End Role="RouteList" EntitySet="RouteList" />
+    </AssociationSet>
+  </EntityContainer>
+  <EntityType Name="Dispatcher">
+    <Key>
+      <PropertyRef Name="IdDispatcher" />
+    </Key>
+    <Property Name="IdDispatcher" Type="int" Nullable="false" />
+    <Property Name="Login" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Password" Type="nvarchar" Nullable="false" MaxLength="50" />
+  </EntityType>
+  <EntityType Name="Drivers">
+    <Key>
+      <PropertyRef Name="IdDriver" />
+    </Key>
+    <Property Name="IdDriver" Type="int" Nullable="false" />
+    <Property Name="IdTransport" Type="int" Nullable="false" />
+    <Property Name="Surname" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Patronymic" Type="nvarchar" Nullable="false" MaxLength="50" />
+  </EntityType>
+  <EntityType Name="DriversList">
+    <Key>
+      <PropertyRef Name="Id" />
+    </Key>
+    <Property Name="Id" Type="int" Nullable="false" />
+    <Property Name="IdDriver" Type="int" Nullable="false" />
+    <Property Name="IdRoute" Type="int" Nullable="false" />
+  </EntityType>
+  <EntityType Name="Points">
+    <Key>
+      <PropertyRef Name="IdPoint" />
+    </Key>
+    <Property Name="IdPoint" Type="int" Nullable="false" />
+    <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="location" Type="nvarchar" Nullable="false" MaxLength="150" />
+  </EntityType>
+  <EntityType Name="PointsList">
+    <Key>
+      <PropertyRef Name="Id" />
+    </Key>
+    <Property Name="Id" Type="int" Nullable="false" />
+    <Property Name="IdPoint" Type="int" Nullable="false" />
+    <Property Name="IdRoute" Type="int" Nullable="false" />
+  </EntityType>
+  <EntityType Name="RouteList">
+    <Key>
+      <PropertyRef Name="Id" />
+    </Key>
+    <Property Name="Id" Type="int" Nullable="false" />
+    <Property Name="IdRoute" Type="int" Nullable="false" />
+    <Property Name="IdDispatcher" Type="int" Nullable="false" />
+  </EntityType>
+  <EntityType Name="Routes">
+    <Key>
+      <PropertyRef Name="IdRoute" />
+    </Key>
+    <Property Name="IdRoute" Type="int" Nullable="false" />
+    <Property Name="IdDriver" Type="int" Nullable="false" />
+    <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
+  </EntityType>
+  <EntityType Name="Transport">
+    <Key>
+      <PropertyRef Name="IdTransport" />
+    </Key>
+    <Property Name="IdTransport" Type="int" Nullable="false" />
+    <Property Name="NameOfTransport" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="NumberPlate" Type="nvarchar" Nullable="false" MaxLength="10" />
+  </EntityType>
+  <Association Name="FK__RouteList__IdRou__6383C8BA">
+    <End Role="Dispatcher" Type="gr692_gavModel.Store.Dispatcher" Multiplicity="1" />
+    <End Role="RouteList" Type="gr692_gavModel.Store.RouteList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Dispatcher">
+        <PropertyRef Name="IdDispatcher" />
+      </Principal>
+      <Dependent Role="RouteList">
+        <PropertyRef Name="IdRoute" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK__DriversLi__IdDri__0C85DE4D">
+    <End Role="Drivers" Type="gr692_gavModel.Store.Drivers" Multiplicity="1" />
+    <End Role="DriversList" Type="gr692_gavModel.Store.DriversList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Drivers">
+        <PropertyRef Name="IdDriver" />
+      </Principal>
+      <Dependent Role="DriversList">
+        <PropertyRef Name="IdDriver" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK_Drivers_Transport">
+    <End Role="Transport" Type="gr692_gavModel.Store.Transport" Multiplicity="1" />
+    <End Role="Drivers" Type="gr692_gavModel.Store.Drivers" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Transport">
+        <PropertyRef Name="IdTransport" />
+      </Principal>
+      <Dependent Role="Drivers">
+        <PropertyRef Name="IdTransport" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK__DriversLi__IdRou__68487DD7">
+    <End Role="Routes" Type="gr692_gavModel.Store.Routes" Multiplicity="1" />
+    <End Role="DriversList" Type="gr692_gavModel.Store.DriversList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Routes">
+        <PropertyRef Name="IdRoute" />
+      </Principal>
+      <Dependent Role="DriversList">
+        <PropertyRef Name="IdRoute" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK__PointsLis__IdPoi__6477ECF3">
+    <End Role="Points" Type="gr692_gavModel.Store.Points" Multiplicity="1" />
+    <End Role="PointsList" Type="gr692_gavModel.Store.PointsList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Points">
+        <PropertyRef Name="IdPoint" />
+      </Principal>
+      <Dependent Role="PointsList">
+        <PropertyRef Name="IdPoint" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK__PointsLis__IdRou__66603565">
+    <End Role="Routes" Type="gr692_gavModel.Store.Routes" Multiplicity="1" />
+    <End Role="PointsList" Type="gr692_gavModel.Store.PointsList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Routes">
+        <PropertyRef Name="IdRoute" />
+      </Principal>
+      <Dependent Role="PointsList">
+        <PropertyRef Name="IdRoute" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK__RouteList__IdRou__628FA481">
+    <End Role="Routes" Type="gr692_gavModel.Store.Routes" Multiplicity="1" />
+    <End Role="RouteList" Type="gr692_gavModel.Store.RouteList" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Routes">
+        <PropertyRef Name="IdRoute" />
+      </Principal>
+      <Dependent Role="RouteList">
+        <PropertyRef Name="IdRoute" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+</Schema></edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema Namespace="gr692_gavModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
+        <EntityType Name="Dispatcher">
+          <Key>
+            <PropertyRef Name="IdDispatcher" />
+          </Key>
+          <Property Name="IdDispatcher" Type="Int32" Nullable="false" />
+          <Property Name="Login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="RouteList" Relationship="Self.FK__RouteList__IdRou__6383C8BA" FromRole="Dispatcher" ToRole="RouteList" />
+        </EntityType>
+        <EntityType Name="Drivers">
+          <Key>
+            <PropertyRef Name="IdDriver" />
+          </Key>
+          <Property Name="IdDriver" Type="Int32" Nullable="false" />
+          <Property Name="IdTransport" Type="Int32" Nullable="false" />
+          <Property Name="Surname" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Patronymic" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="DriversList" Relationship="Self.FK__DriversLi__IdDri__0C85DE4D" FromRole="Drivers" ToRole="DriversList" />
+          <NavigationProperty Name="Transport" Relationship="Self.FK_Drivers_Transport" FromRole="Drivers" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="DriversList">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int32" Nullable="false" />
+          <Property Name="IdDriver" Type="Int32" Nullable="false" />
+          <Property Name="IdRoute" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Drivers" Relationship="Self.FK__DriversLi__IdDri__0C85DE4D" FromRole="DriversList" ToRole="Drivers" />
+          <NavigationProperty Name="Routes" Relationship="Self.FK__DriversLi__IdRou__68487DD7" FromRole="DriversList" ToRole="Routes" />
+        </EntityType>
+        <EntityType Name="Points">
+          <Key>
+            <PropertyRef Name="IdPoint" />
+          </Key>
+          <Property Name="IdPoint" Type="Int32" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="location" Type="String" MaxLength="150" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="PointsList" Relationship="Self.FK__PointsLis__IdPoi__6477ECF3" FromRole="Points" ToRole="PointsList" />
+        </EntityType>
+        <EntityType Name="PointsList">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int32" Nullable="false" />
+          <Property Name="IdPoint" Type="Int32" Nullable="false" />
+          <Property Name="IdRoute" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Points" Relationship="Self.FK__PointsLis__IdPoi__6477ECF3" FromRole="PointsList" ToRole="Points" />
+          <NavigationProperty Name="Routes" Relationship="Self.FK__PointsLis__IdRou__66603565" FromRole="PointsList" ToRole="Routes" />
+        </EntityType>
+        <EntityType Name="RouteList">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int32" Nullable="false" />
+          <Property Name="IdRoute" Type="Int32" Nullable="false" />
+          <Property Name="IdDispatcher" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Dispatcher" Relationship="Self.FK__RouteList__IdRou__6383C8BA" FromRole="RouteList" ToRole="Dispatcher" />
+          <NavigationProperty Name="Routes" Relationship="Self.FK__RouteList__IdRou__628FA481" FromRole="RouteList" ToRole="Routes" />
+        </EntityType>
+        <EntityType Name="Routes">
+          <Key>
+            <PropertyRef Name="IdRoute" />
+          </Key>
+          <Property Name="IdRoute" Type="Int32" Nullable="false" />
+          <Property Name="IdDriver" Type="Int32" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="DriversList" Relationship="Self.FK__DriversLi__IdRou__68487DD7" FromRole="Routes" ToRole="DriversList" />
+          <NavigationProperty Name="PointsList" Relationship="Self.FK__PointsLis__IdRou__66603565" FromRole="Routes" ToRole="PointsList" />
+          <NavigationProperty Name="RouteList" Relationship="Self.FK__RouteList__IdRou__628FA481" FromRole="Routes" ToRole="RouteList" />
+        </EntityType>
+        <EntityType Name="Transport">
+          <Key>
+            <PropertyRef Name="IdTransport" />
+          </Key>
+          <Property Name="IdTransport" Type="Int32" Nullable="false" />
+          <Property Name="NameOfTransport" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="NumberPlate" Type="String" MaxLength="10" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Drivers" Relationship="Self.FK_Drivers_Transport" FromRole="Transport" ToRole="Drivers" />
+        </EntityType>
+        <Association Name="FK__RouteList__IdRou__6383C8BA">
+          <End Role="Dispatcher" Type="Self.Dispatcher" Multiplicity="1" />
+          <End Role="RouteList" Type="Self.RouteList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Dispatcher">
+              <PropertyRef Name="IdDispatcher" />
+            </Principal>
+            <Dependent Role="RouteList">
+              <PropertyRef Name="IdRoute" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK__DriversLi__IdDri__0C85DE4D">
+          <End Role="Drivers" Type="Self.Drivers" Multiplicity="1" />
+          <End Role="DriversList" Type="Self.DriversList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Drivers">
+              <PropertyRef Name="IdDriver" />
+            </Principal>
+            <Dependent Role="DriversList">
+              <PropertyRef Name="IdDriver" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Drivers_Transport">
+          <End Role="Transport" Type="Self.Transport" Multiplicity="1" />
+          <End Role="Drivers" Type="Self.Drivers" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Transport">
+              <PropertyRef Name="IdTransport" />
+            </Principal>
+            <Dependent Role="Drivers">
+              <PropertyRef Name="IdTransport" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK__DriversLi__IdRou__68487DD7">
+          <End Role="Routes" Type="Self.Routes" Multiplicity="1" />
+          <End Role="DriversList" Type="Self.DriversList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Routes">
+              <PropertyRef Name="IdRoute" />
+            </Principal>
+            <Dependent Role="DriversList">
+              <PropertyRef Name="IdRoute" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK__PointsLis__IdPoi__6477ECF3">
+          <End Role="Points" Type="Self.Points" Multiplicity="1" />
+          <End Role="PointsList" Type="Self.PointsList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Points">
+              <PropertyRef Name="IdPoint" />
+            </Principal>
+            <Dependent Role="PointsList">
+              <PropertyRef Name="IdPoint" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK__PointsLis__IdRou__66603565">
+          <End Role="Routes" Type="Self.Routes" Multiplicity="1" />
+          <End Role="PointsList" Type="Self.PointsList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Routes">
+              <PropertyRef Name="IdRoute" />
+            </Principal>
+            <Dependent Role="PointsList">
+              <PropertyRef Name="IdRoute" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK__RouteList__IdRou__628FA481">
+          <End Role="Routes" Type="Self.Routes" Multiplicity="1" />
+          <End Role="RouteList" Type="Self.RouteList" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Routes">
+              <PropertyRef Name="IdRoute" />
+            </Principal>
+            <Dependent Role="RouteList">
+              <PropertyRef Name="IdRoute" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityContainer Name="EDM" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Dispatcher" EntityType="Self.Dispatcher" />
+          <EntitySet Name="Drivers" EntityType="Self.Drivers" />
+          <EntitySet Name="DriversList" EntityType="Self.DriversList" />
+          <EntitySet Name="Points" EntityType="Self.Points" />
+          <EntitySet Name="PointsList" EntityType="Self.PointsList" />
+          <EntitySet Name="RouteList" EntityType="Self.RouteList" />
+          <EntitySet Name="Routes" EntityType="Self.Routes" />
+          <EntitySet Name="Transport" EntityType="Self.Transport" />
+          <AssociationSet Name="FK__RouteList__IdRou__6383C8BA" Association="Self.FK__RouteList__IdRou__6383C8BA">
+            <End Role="Dispatcher" EntitySet="Dispatcher" />
+            <End Role="RouteList" EntitySet="RouteList" />
+          </AssociationSet>
+          <AssociationSet Name="FK__DriversLi__IdDri__0C85DE4D" Association="Self.FK__DriversLi__IdDri__0C85DE4D">
+            <End Role="Drivers" EntitySet="Drivers" />
+            <End Role="DriversList" EntitySet="DriversList" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Drivers_Transport" Association="Self.FK_Drivers_Transport">
+            <End Role="Transport" EntitySet="Transport" />
+            <End Role="Drivers" EntitySet="Drivers" />
+          </AssociationSet>
+          <AssociationSet Name="FK__DriversLi__IdRou__68487DD7" Association="Self.FK__DriversLi__IdRou__68487DD7">
+            <End Role="Routes" EntitySet="Routes" />
+            <End Role="DriversList" EntitySet="DriversList" />
+          </AssociationSet>
+          <AssociationSet Name="FK__PointsLis__IdPoi__6477ECF3" Association="Self.FK__PointsLis__IdPoi__6477ECF3">
+            <End Role="Points" EntitySet="Points" />
+            <End Role="PointsList" EntitySet="PointsList" />
+          </AssociationSet>
+          <AssociationSet Name="FK__PointsLis__IdRou__66603565" Association="Self.FK__PointsLis__IdRou__66603565">
+            <End Role="Routes" EntitySet="Routes" />
+            <End Role="PointsList" EntitySet="PointsList" />
+          </AssociationSet>
+          <AssociationSet Name="FK__RouteList__IdRou__628FA481" Association="Self.FK__RouteList__IdRou__628FA481">
+            <End Role="Routes" EntitySet="Routes" />
+            <End Role="RouteList" EntitySet="RouteList" />
+          </AssociationSet>
+        </EntityContainer>
+      </Schema>
+    </edmx:ConceptualModels>
+    <!-- C-S mapping content -->
+    <edmx:Mappings>
+    <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
+  <EntityContainerMapping StorageEntityContainer="gr692_gavModelStoreContainer" CdmEntityContainer="EDM">
+    <EntitySetMapping Name="Dispatcher">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.Dispatcher)">
+        <MappingFragment StoreEntitySet="Dispatcher">
+          <ScalarProperty Name="IdDispatcher" ColumnName="IdDispatcher" />
+          <ScalarProperty Name="Login" ColumnName="Login" />
+          <ScalarProperty Name="Password" ColumnName="Password" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Drivers">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.Drivers)">
+        <MappingFragment StoreEntitySet="Drivers">
+          <ScalarProperty Name="IdDriver" ColumnName="IdDriver" />
+          <ScalarProperty Name="IdTransport" ColumnName="IdTransport" />
+          <ScalarProperty Name="Surname" ColumnName="Surname" />
+          <ScalarProperty Name="Name" ColumnName="Name" />
+          <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="DriversList">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.DriversList)">
+        <MappingFragment StoreEntitySet="DriversList">
+          <ScalarProperty Name="Id" ColumnName="Id" />
+          <ScalarProperty Name="IdDriver" ColumnName="IdDriver" />
+          <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Points">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.Points)">
+        <MappingFragment StoreEntitySet="Points">
+          <ScalarProperty Name="IdPoint" ColumnName="IdPoint" />
+          <ScalarProperty Name="Name" ColumnName="Name" />
+          <ScalarProperty Name="location" ColumnName="location" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="PointsList">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.PointsList)">
+        <MappingFragment StoreEntitySet="PointsList">
+          <ScalarProperty Name="Id" ColumnName="Id" />
+          <ScalarProperty Name="IdPoint" ColumnName="IdPoint" />
+          <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="RouteList">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.RouteList)">
+        <MappingFragment StoreEntitySet="RouteList">
+          <ScalarProperty Name="Id" ColumnName="Id" />
+          <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+          <ScalarProperty Name="IdDispatcher" ColumnName="IdDispatcher" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Routes">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.Routes)">
+        <MappingFragment StoreEntitySet="Routes">
+          <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+          <ScalarProperty Name="IdDriver" ColumnName="IdDriver" />
+          <ScalarProperty Name="Name" ColumnName="Name" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Transport">
+      <EntityTypeMapping TypeName="IsTypeOf(gr692_gavModel.Transport)">
+        <MappingFragment StoreEntitySet="Transport">
+          <ScalarProperty Name="IdTransport" ColumnName="IdTransport" />
+          <ScalarProperty Name="NameOfTransport" ColumnName="NameOfTransport" />
+          <ScalarProperty Name="NumberPlate" ColumnName="NumberPlate" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+  </EntityContainerMapping>
+</Mapping></edmx:Mappings>
+  </edmx:Runtime>
+  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <Connection>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
+      </DesignerInfoPropertySet>
+    </Connection>
+    <Options>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
+        <DesignerProperty Name="EnablePluralization" Value="false" />
+        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
+        <DesignerProperty Name="UseLegacyProvider" Value="False" />
+        <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
+      </DesignerInfoPropertySet>
+    </Options>
+    <!-- Diagram content (shape and connector positions) -->
+    <Diagrams></Diagrams>
+  </Designer>
+</edmx:Edmx>

+ 26 - 0
Kusach/EDM.edmx.diagram

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+ <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+      <Diagram DiagramId="dabec44b8a634331ae1f79524a76b8ac" Name="Diagram1" ZoomLevel="94">
+        <EntityTypeShape EntityType="gr692_gavModel.Dispatcher" Width="1.5" PointX="4.5" PointY="5.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.Drivers" Width="1.5" PointX="7.875" PointY="7.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.DriversList" Width="1.5" PointX="7.875" PointY="5.25" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.Points" Width="1.5" PointX="7.25" PointY="2.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.PointsList" Width="1.5" PointX="4.375" PointY="2" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.RouteList" Width="1.5" PointX="1.125" PointY="5.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.Routes" Width="1.5" PointX="1.25" PointY="2" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.Transport" Width="1.5" PointX="4.375" PointY="8.125" IsExpanded="true" />
+        <AssociationConnector Association="gr692_gavModel.FK__RouteList__IdRou__6383C8BA" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK__DriversLi__IdDri__0C85DE4D" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK_Drivers_Transport" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK__DriversLi__IdRou__68487DD7" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK__PointsLis__IdPoi__6477ECF3" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK__PointsLis__IdRou__66603565" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK__RouteList__IdRou__628FA481" ManuallyRouted="false" />
+      </Diagram>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 304 - 0
Kusach/EDM.edmx.sql

@@ -0,0 +1,304 @@
+
+-- --------------------------------------------------
+-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
+-- --------------------------------------------------
+-- Date Created: 12/28/2021 02:36:31
+-- Generated from EDMX file: G:\Kusach\KusachVER2\Kusach\EDM.edmx
+-- --------------------------------------------------
+
+SET QUOTED_IDENTIFIER OFF;
+GO
+USE [gr692_gav];
+GO
+IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
+GO
+
+-- --------------------------------------------------
+-- Dropping existing FOREIGN KEY constraints
+-- --------------------------------------------------
+
+IF OBJECT_ID(N'[dbo].[FK__DriversLi__IdDri__0C85DE4D]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[DriversList] DROP CONSTRAINT [FK__DriversLi__IdDri__0C85DE4D];
+GO
+IF OBJECT_ID(N'[dbo].[FK__DriversLi__IdRou__68487DD7]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[DriversList] DROP CONSTRAINT [FK__DriversLi__IdRou__68487DD7];
+GO
+IF OBJECT_ID(N'[dbo].[FK__PointsLis__IdPoi__6477ECF3]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[PointsList] DROP CONSTRAINT [FK__PointsLis__IdPoi__6477ECF3];
+GO
+IF OBJECT_ID(N'[dbo].[FK__PointsLis__IdRou__66603565]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[PointsList] DROP CONSTRAINT [FK__PointsLis__IdRou__66603565];
+GO
+IF OBJECT_ID(N'[dbo].[FK__RouteList__IdRou__628FA481]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[RouteList] DROP CONSTRAINT [FK__RouteList__IdRou__628FA481];
+GO
+IF OBJECT_ID(N'[dbo].[FK__RouteList__IdRou__6383C8BA]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[RouteList] DROP CONSTRAINT [FK__RouteList__IdRou__6383C8BA];
+GO
+IF OBJECT_ID(N'[dbo].[FK_Drivers_Transport]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Drivers] DROP CONSTRAINT [FK_Drivers_Transport];
+GO
+
+-- --------------------------------------------------
+-- Dropping existing tables
+-- --------------------------------------------------
+
+IF OBJECT_ID(N'[dbo].[Dispatcher]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Dispatcher];
+GO
+IF OBJECT_ID(N'[dbo].[Drivers]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Drivers];
+GO
+IF OBJECT_ID(N'[dbo].[DriversList]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[DriversList];
+GO
+IF OBJECT_ID(N'[dbo].[Points]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Points];
+GO
+IF OBJECT_ID(N'[dbo].[PointsList]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[PointsList];
+GO
+IF OBJECT_ID(N'[dbo].[RouteList]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[RouteList];
+GO
+IF OBJECT_ID(N'[dbo].[Routes]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Routes];
+GO
+IF OBJECT_ID(N'[dbo].[Transport]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Transport];
+GO
+
+-- --------------------------------------------------
+-- Creating all tables
+-- --------------------------------------------------
+
+-- Creating table 'Dispatcher'
+CREATE TABLE [dbo].[Dispatcher] (
+    [IdDispatcher] int  NOT NULL,
+    [Login] nvarchar(50)  NOT NULL,
+    [Password] nvarchar(50)  NOT NULL
+);
+GO
+
+-- Creating table 'Drivers'
+CREATE TABLE [dbo].[Drivers] (
+    [IdDriver] int  NOT NULL,
+    [IdTransport] int  NOT NULL,
+    [Surname] nvarchar(50)  NOT NULL,
+    [Name] nvarchar(50)  NOT NULL,
+    [Patronymic] nvarchar(50)  NOT NULL
+);
+GO
+
+-- Creating table 'DriversList'
+CREATE TABLE [dbo].[DriversList] (
+    [Id] int  NOT NULL,
+    [IdDriver] int  NOT NULL,
+    [IdRoute] int  NOT NULL
+);
+GO
+
+-- Creating table 'Points'
+CREATE TABLE [dbo].[Points] (
+    [IdPoint] int  NOT NULL,
+    [Name] nvarchar(50)  NOT NULL,
+    [location] nvarchar(150)  NOT NULL
+);
+GO
+
+-- Creating table 'PointsList'
+CREATE TABLE [dbo].[PointsList] (
+    [Id] int  NOT NULL,
+    [IdPoint] int  NOT NULL,
+    [IdRoute] int  NOT NULL
+);
+GO
+
+-- Creating table 'RouteList'
+CREATE TABLE [dbo].[RouteList] (
+    [Id] int  NOT NULL,
+    [IdRoute] int  NOT NULL,
+    [IdDispatcher] int  NOT NULL
+);
+GO
+
+-- Creating table 'Routes'
+CREATE TABLE [dbo].[Routes] (
+    [IdRoute] int  NOT NULL,
+    [IdDriver] int  NOT NULL,
+    [Name] nvarchar(50)  NOT NULL
+);
+GO
+
+-- Creating table 'Transport'
+CREATE TABLE [dbo].[Transport] (
+    [IdTransport] int  NOT NULL,
+    [NameOfTransport] nvarchar(50)  NOT NULL,
+    [NumberPlate] nvarchar(10)  NOT NULL
+);
+GO
+
+-- --------------------------------------------------
+-- Creating all PRIMARY KEY constraints
+-- --------------------------------------------------
+
+-- Creating primary key on [IdDispatcher] in table 'Dispatcher'
+ALTER TABLE [dbo].[Dispatcher]
+ADD CONSTRAINT [PK_Dispatcher]
+    PRIMARY KEY CLUSTERED ([IdDispatcher] ASC);
+GO
+
+-- Creating primary key on [IdDriver] in table 'Drivers'
+ALTER TABLE [dbo].[Drivers]
+ADD CONSTRAINT [PK_Drivers]
+    PRIMARY KEY CLUSTERED ([IdDriver] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'DriversList'
+ALTER TABLE [dbo].[DriversList]
+ADD CONSTRAINT [PK_DriversList]
+    PRIMARY KEY CLUSTERED ([Id] ASC);
+GO
+
+-- Creating primary key on [IdPoint] in table 'Points'
+ALTER TABLE [dbo].[Points]
+ADD CONSTRAINT [PK_Points]
+    PRIMARY KEY CLUSTERED ([IdPoint] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'PointsList'
+ALTER TABLE [dbo].[PointsList]
+ADD CONSTRAINT [PK_PointsList]
+    PRIMARY KEY CLUSTERED ([Id] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'RouteList'
+ALTER TABLE [dbo].[RouteList]
+ADD CONSTRAINT [PK_RouteList]
+    PRIMARY KEY CLUSTERED ([Id] ASC);
+GO
+
+-- Creating primary key on [IdRoute] in table 'Routes'
+ALTER TABLE [dbo].[Routes]
+ADD CONSTRAINT [PK_Routes]
+    PRIMARY KEY CLUSTERED ([IdRoute] ASC);
+GO
+
+-- Creating primary key on [IdTransport] in table 'Transport'
+ALTER TABLE [dbo].[Transport]
+ADD CONSTRAINT [PK_Transport]
+    PRIMARY KEY CLUSTERED ([IdTransport] ASC);
+GO
+
+-- --------------------------------------------------
+-- Creating all FOREIGN KEY constraints
+-- --------------------------------------------------
+
+-- Creating foreign key on [IdRoute] in table 'RouteList'
+ALTER TABLE [dbo].[RouteList]
+ADD CONSTRAINT [FK__RouteList__IdRou__6383C8BA]
+    FOREIGN KEY ([IdRoute])
+    REFERENCES [dbo].[Dispatcher]
+        ([IdDispatcher])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__RouteList__IdRou__6383C8BA'
+CREATE INDEX [IX_FK__RouteList__IdRou__6383C8BA]
+ON [dbo].[RouteList]
+    ([IdRoute]);
+GO
+
+-- Creating foreign key on [IdDriver] in table 'DriversList'
+ALTER TABLE [dbo].[DriversList]
+ADD CONSTRAINT [FK__DriversLi__IdDri__0C85DE4D]
+    FOREIGN KEY ([IdDriver])
+    REFERENCES [dbo].[Drivers]
+        ([IdDriver])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__DriversLi__IdDri__0C85DE4D'
+CREATE INDEX [IX_FK__DriversLi__IdDri__0C85DE4D]
+ON [dbo].[DriversList]
+    ([IdDriver]);
+GO
+
+-- Creating foreign key on [IdTransport] in table 'Drivers'
+ALTER TABLE [dbo].[Drivers]
+ADD CONSTRAINT [FK_Drivers_Transport]
+    FOREIGN KEY ([IdTransport])
+    REFERENCES [dbo].[Transport]
+        ([IdTransport])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK_Drivers_Transport'
+CREATE INDEX [IX_FK_Drivers_Transport]
+ON [dbo].[Drivers]
+    ([IdTransport]);
+GO
+
+-- Creating foreign key on [IdRoute] in table 'DriversList'
+ALTER TABLE [dbo].[DriversList]
+ADD CONSTRAINT [FK__DriversLi__IdRou__68487DD7]
+    FOREIGN KEY ([IdRoute])
+    REFERENCES [dbo].[Routes]
+        ([IdRoute])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__DriversLi__IdRou__68487DD7'
+CREATE INDEX [IX_FK__DriversLi__IdRou__68487DD7]
+ON [dbo].[DriversList]
+    ([IdRoute]);
+GO
+
+-- Creating foreign key on [IdPoint] in table 'PointsList'
+ALTER TABLE [dbo].[PointsList]
+ADD CONSTRAINT [FK__PointsLis__IdPoi__6477ECF3]
+    FOREIGN KEY ([IdPoint])
+    REFERENCES [dbo].[Points]
+        ([IdPoint])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__PointsLis__IdPoi__6477ECF3'
+CREATE INDEX [IX_FK__PointsLis__IdPoi__6477ECF3]
+ON [dbo].[PointsList]
+    ([IdPoint]);
+GO
+
+-- Creating foreign key on [IdRoute] in table 'PointsList'
+ALTER TABLE [dbo].[PointsList]
+ADD CONSTRAINT [FK__PointsLis__IdRou__66603565]
+    FOREIGN KEY ([IdRoute])
+    REFERENCES [dbo].[Routes]
+        ([IdRoute])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__PointsLis__IdRou__66603565'
+CREATE INDEX [IX_FK__PointsLis__IdRou__66603565]
+ON [dbo].[PointsList]
+    ([IdRoute]);
+GO
+
+-- Creating foreign key on [IdRoute] in table 'RouteList'
+ALTER TABLE [dbo].[RouteList]
+ADD CONSTRAINT [FK__RouteList__IdRou__628FA481]
+    FOREIGN KEY ([IdRoute])
+    REFERENCES [dbo].[Routes]
+        ([IdRoute])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK__RouteList__IdRou__628FA481'
+CREATE INDEX [IX_FK__RouteList__IdRou__628FA481]
+ON [dbo].[RouteList]
+    ([IdRoute]);
+GO
+
+-- --------------------------------------------------
+-- Script has ended
+-- --------------------------------------------------

+ 733 - 0
Kusach/EDM.tt

@@ -0,0 +1,733 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@ 
+ output extension=".cs"#><#
+
+const string inputFile = @"EDM.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var	fileManager = EntityFrameworkTemplateFileManager.Create(this);
+var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
+{
+    return string.Empty;
+}
+
+WriteHeader(codeStringGenerator, fileManager);
+
+foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
+{
+    fileManager.StartNewFile(entity.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
+<#=codeStringGenerator.EntityClassOpening(entity)#>
+{
+<#
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
+    var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
+    var complexProperties = typeMapper.GetComplexProperties(entity);
+
+    if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
+    {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+    public <#=code.Escape(entity)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var navigationProperty in collectionNavigationProperties)
+        {
+#>
+        this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(entity);
+    if (simpleProperties.Any())
+    {
+        foreach (var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var complexProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(complexProperty)#>
+<#
+        }
+    }
+
+    var navigationProperties = typeMapper.GetNavigationProperties(entity);
+    if (navigationProperties.Any())
+    {
+#>
+
+<#
+        foreach (var navigationProperty in navigationProperties)
+        {
+            if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
+            {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+<#
+            }
+#>
+    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
+{
+    fileManager.StartNewFile(complex.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
+{
+<#
+    var complexProperties = typeMapper.GetComplexProperties(complex);
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
+
+    if (propertiesWithDefaultValues.Any() || complexProperties.Any())
+    {
+#>
+    public <#=code.Escape(complex)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(complex);
+    if (simpleProperties.Any())
+    {
+        foreach(var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var edmProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
+{
+    fileManager.StartNewFile(enumType.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#
+    if (typeMapper.EnumIsFlags(enumType))
+    {
+#>
+[Flags]
+<#
+    }
+#>
+<#=codeStringGenerator.EnumOpening(enumType)#>
+{
+<#
+    var foundOne = false;
+    
+    foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
+    {
+        foundOne = true;
+#>
+    <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
+<#
+    }
+
+    if (foundOne)
+    {
+        this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+fileManager.Process();
+
+#>
+<#+
+
+public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
+{
+    fileManager.StartHeader();
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
+<#+
+    fileManager.EndBlock();
+}
+
+public void BeginNamespace(CodeGenerationTools code)
+{
+    var codeNamespace = code.VsNamespaceSuggestion();
+    if (!String.IsNullOrEmpty(codeNamespace))
+    {
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#+
+        PushIndent("    ");
+    }
+}
+
+public void EndNamespace(CodeGenerationTools code)
+{
+    if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
+    {
+        PopIndent();
+#>
+}
+<#+
+    }
+}
+
+public const string TemplateId = "CSharp_DbContext_Types_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 20 - 0
Kusach/Encrypt.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Kusach
+{
+    public class Encrypt
+    {
+        public static string GetHash(string password)
+        {
+            using (var hash = SHA1.Create())
+            {
+                return string.Concat(hash.ComputeHash(Encoding.UTF8.GetBytes(password)).Select(x => x.ToString("X2")));
+            }
+        }
+    }
+}

+ 238 - 0
Kusach/Kusach.csproj

@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
+  <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>{DC74454C-D8E7-43E9-B525-38E48BE898E7}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>Kusach</RootNamespace>
+    <AssemblyName>Kusach</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>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </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="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
+    <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="AddDriverWindow.xaml.cs">
+      <DependentUpon>AddDriverWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="AddPointWindow.xaml.cs">
+      <DependentUpon>AddPointWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="AddRouteWindow.xaml.cs">
+      <DependentUpon>AddRouteWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="AddTransportWindow.xaml.cs">
+      <DependentUpon>AddTransportWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="AddUserWindow.xaml.cs">
+      <DependentUpon>AddUserWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="cnt.cs" />
+    <Compile Include="DataWindow.xaml.cs">
+      <DependentUpon>DataWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DeleteUserWindow.xaml.cs">
+      <DependentUpon>DeleteUserWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Dispatcher.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Drivers.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="DriversList.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="EDM.Context.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>EDM.Context.tt</DependentUpon>
+    </Compile>
+    <Compile Include="EDM.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="EDM.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>EDM.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="Encrypt.cs" />
+    <Compile Include="LogWindow.xaml.cs">
+      <DependentUpon>LogWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Points.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="PointsList.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="RegWindow.xaml.cs">
+      <DependentUpon>RegWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="RouteList.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Routes.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Transport.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Page Include="AddDriverWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="AddPointWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="AddRouteWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="AddTransportWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="AddUserWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DataWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DeleteUserWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="LogWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="RegWindow.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>
+    <EntityDeploy Include="EDM.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>EDM.Designer.cs</LastGenOutput>
+    </EntityDeploy>
+    <None Include="EDM.edmx.diagram">
+      <DependentUpon>EDM.edmx</DependentUpon>
+    </None>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="EDM.Context.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>EDM.edmx</DependentUpon>
+      <LastGenOutput>EDM.Context.cs</LastGenOutput>
+    </Content>
+    <Content Include="EDM.edmx.sql" />
+    <Content Include="EDM.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>EDM.edmx</DependentUpon>
+      <LastGenOutput>EDM.cs</LastGenOutput>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
+    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
+  </Target>
+  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
+</Project>

+ 62 - 0
Kusach/LogWindow.xaml

@@ -0,0 +1,62 @@
+<Window x:Class="Kusach.LogWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        Loaded="OnLoad"
+        ResizeMode="NoResize"
+        Title="Окно входа" 
+        Height="350" Width="600" 
+        WindowStartupLocation="CenterScreen">
+    <Grid>
+        <Label 
+            Content="Логин:" 
+            HorizontalAlignment="Left" 
+            Margin="180,45,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <TextBox 
+            Name="logbox" 
+            HorizontalAlignment="Left" 
+            Margin="179,85,0,0" 
+            TextWrapping="Wrap" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <Label 
+            Content="Пароль:" 
+            HorizontalAlignment="Left" 
+            Margin="180,125,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <PasswordBox 
+            Name="passbox" 
+            HorizontalAlignment="Left" 
+            Margin="179,165,0,0"
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <Button 
+            x:Name="LogButton" 
+            Content="Вход" 
+            HorizontalAlignment="Left" 
+            Margin="324,228,0,0" 
+            VerticalAlignment="Top" 
+            Width="150" 
+            Click="LogButton_Click" 
+            IsDefault="True" Height="40"/>
+        <Button 
+            x:Name="RegButton" 
+            Content="Регистрация" 
+            HorizontalAlignment="Left"
+            Margin="123,228,0,0" 
+            VerticalAlignment="Top" 
+            Width="150" 
+            Click="RegButton_Click" 
+            Height="40"/>
+    </Grid>
+</Window>

+ 39 - 0
Kusach/LogWindow.xaml.cs

@@ -0,0 +1,39 @@
+using System.Linq;
+using System.Windows;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для LogWindow.xaml
+    /// </summary>
+    public partial class LogWindow : Window
+    {
+        public LogWindow()
+        {
+            InitializeComponent();
+        }
+        public void OnLoad(object sender, RoutedEventArgs e)
+        {
+            logbox.Focus();
+        }
+        private void LogButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (logbox.Text == "" || passbox.Password == "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else if (cnt.db.Dispatcher.Select(item => item.Login + item.Password).Contains(logbox.Text + Encrypt.GetHash(passbox.Password)))
+            {
+                DataWindow dw = new DataWindow();
+                dw.Show();
+                this.Close();
+            }
+            else
+                MessageBox.Show("Неверный логин или пароль");
+        }
+        private void RegButton_Click(object sender, RoutedEventArgs e)
+        {
+            RegWindow rw = new RegWindow();
+            rw.Show();
+            this.Close();
+        }
+    }
+}

+ 30 - 0
Kusach/Points.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Points
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Points()
+        {
+            this.PointsList = new HashSet<PointsList>();
+        }
+    
+        public int IdPoint { get; set; }
+        public string Name { get; set; }
+        public string location { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<PointsList> PointsList { get; set; }
+    }
+}

+ 24 - 0
Kusach/PointsList.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class PointsList
+    {
+        public int Id { get; set; }
+        public int IdPoint { get; set; }
+        public int IdRoute { get; set; }
+    
+        public virtual Points Points { get; set; }
+        public virtual Routes Routes { get; set; }
+    }
+}

+ 55 - 0
Kusach/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("Kusach")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Kusach")]
+[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
Kusach/Properties/Resources.Designer.cs

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

+ 59 - 0
Kusach/RegWindow.xaml

@@ -0,0 +1,59 @@
+<Window x:Class="Kusach.RegWindow"
+        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:Kusach"
+        mc:Ignorable="d"
+        ResizeMode="NoResize"
+        Title="Окно регистрации" Height="350" Width="600" WindowStartupLocation="CenterScreen">
+    <Grid>
+        <Label 
+            Content="Логин:" 
+            HorizontalAlignment="Left" 
+            Margin="180,45,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <TextBox 
+            x:Name="logbox" 
+            HorizontalAlignment="Left" 
+            Margin="179,85,0,0" 
+            TextWrapping="Wrap" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <Label 
+            Content="Пароль:" 
+            HorizontalAlignment="Left" 
+            Margin="180,125,0,0"
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <TextBox 
+            x:Name="passbox" 
+            HorizontalAlignment="Left" 
+            Margin="179,165,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="240"/>
+        <Button 
+            x:Name="RegButton" 
+            Content="Регистрация" 
+            HorizontalAlignment="Left"
+            Margin="317,238,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="150" 
+            Click="RegButton_Click"/>
+        <Button 
+            x:Name="BackButton" 
+            Content="Назад" 
+            HorizontalAlignment="Left" 
+            Margin="140,238,0,0" 
+            VerticalAlignment="Top" 
+            Height="40" 
+            Width="150" 
+            Click="BackButton_Click"/>
+    </Grid>
+</Window>

+ 46 - 0
Kusach/RegWindow.xaml.cs

@@ -0,0 +1,46 @@
+using System.Linq;
+using System.Windows;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для RegWindow.xaml
+    /// </summary>
+    public partial class RegWindow : Window
+    {
+        public RegWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void RegButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (logbox.Text == "" || passbox.Text== "")
+                MessageBox.Show("Поля не могут быть пустыми.");
+            else if (cnt.db.Dispatcher.Select(item => item.Login).Contains(logbox.Text))
+                MessageBox.Show("Данный логин уже занят");
+            else
+            {
+                Dispatcher newUser = new Dispatcher()
+                {
+                    IdDispatcher = cnt.db.Dispatcher.Count()+1,
+                    Login = logbox.Text,
+                    Password = Encrypt.GetHash(passbox.Text)
+                };
+                cnt.db.Dispatcher.Add(newUser);
+                cnt.db.SaveChanges();
+                MessageBox.Show("Вы успешно зарегистрировались");
+                DataWindow dw = new DataWindow();
+                dw.Show();
+                this.Close();
+            }
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            LogWindow lw = new LogWindow();
+            lw.Show();
+            this.Close();
+        }
+    }
+}

+ 24 - 0
Kusach/RouteList.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class RouteList
+    {
+        public int Id { get; set; }
+        public int IdRoute { get; set; }
+        public int IdDispatcher { get; set; }
+    
+        public virtual Dispatcher Dispatcher { get; set; }
+        public virtual Routes Routes { get; set; }
+    }
+}

+ 36 - 0
Kusach/Routes.cs

@@ -0,0 +1,36 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Routes
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Routes()
+        {
+            this.DriversList = new HashSet<DriversList>();
+            this.PointsList = new HashSet<PointsList>();
+            this.RouteList = new HashSet<RouteList>();
+        }
+    
+        public int IdRoute { get; set; }
+        public int IdDriver { get; set; }
+        public string Name { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<DriversList> DriversList { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<PointsList> PointsList { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<RouteList> RouteList { get; set; }
+    }
+}

+ 30 - 0
Kusach/Transport.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Kusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Transport
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Transport()
+        {
+            this.Drivers = new HashSet<Drivers>();
+        }
+    
+        public int IdTransport { get; set; }
+        public string NameOfTransport { get; set; }
+        public string NumberPlate { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Drivers> Drivers { get; set; }
+    }
+}

+ 7 - 0
Kusach/cnt.cs

@@ -0,0 +1,7 @@
+namespace Kusach
+{
+    class cnt
+    {
+        public static EDM db = new EDM();
+    }
+}

+ 5 - 0
Kusach/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.4.4" targetFramework="net472" />
+  <package id="EntityFramework.ru" version="6.2.0" targetFramework="net472" />
+</packages>

二进制
Kusach/placeholder.png