Browse Source

Создана страница создания водителя

user 7 months ago
parent
commit
cb26b8b6e4
49 changed files with 4429 additions and 44 deletions
  1. 1 1
      src/.gitignore
  2. 21 4
      src/SASDesktop/App.config
  3. 1 0
      src/SASDesktop/App.xaml
  4. 1 2
      src/SASDesktop/AuthState.cs
  5. 3 1
      src/SASDesktop/MainWindow.xaml
  6. 29 0
      src/SASDesktop/Models/Brand.cs
  7. 32 0
      src/SASDesktop/Models/Category.cs
  8. 47 0
      src/SASDesktop/Models/Citizen.cs
  9. 34 0
      src/SASDesktop/Models/Color.cs
  10. 29 0
      src/SASDesktop/Models/Company.cs
  11. 29 0
      src/SASDesktop/Models/DivisionGIBDD.cs
  12. 29 0
      src/SASDesktop/Models/DriveType.cs
  13. 40 0
      src/SASDesktop/Models/Employee.cs
  14. 30 0
      src/SASDesktop/Models/EngineType.cs
  15. 29 0
      src/SASDesktop/Models/Extension.cs
  16. 35 0
      src/SASDesktop/Models/File.cs
  17. 31 0
      src/SASDesktop/Models/Job.cs
  18. 34 0
      src/SASDesktop/Models/License.cs
  19. 24 0
      src/SASDesktop/Models/LicenseCategory.cs
  20. 23 0
      src/SASDesktop/Models/LoginAttempt.cs
  21. 23 0
      src/SASDesktop/Models/LoginBlock.cs
  22. 31 0
      src/SASDesktop/Models/Model.cs
  23. 36 0
      src/SASDesktop/Models/Region.cs
  24. 23 0
      src/SASDesktop/Models/RegionCode.cs
  25. 29 0
      src/SASDesktop/Models/Role.cs
  26. 53 0
      src/SASDesktop/Models/SAS.Context.cs
  27. 636 0
      src/SASDesktop/Models/SAS.Context.tt
  28. 10 0
      src/SASDesktop/Models/SAS.Designer.cs
  29. 9 0
      src/SASDesktop/Models/SAS.cs
  30. 1569 0
      src/SASDesktop/Models/SAS.edmx
  31. 58 0
      src/SASDesktop/Models/SAS.edmx.diagram
  32. 733 0
      src/SASDesktop/Models/SAS.tt
  33. 46 0
      src/SASDesktop/Models/Transport.cs
  34. 25 0
      src/SASDesktop/Models/TransportOwnership.cs
  35. 24 0
      src/SASDesktop/Models/TransportPhoto.cs
  36. 23 0
      src/SASDesktop/Models/sysdiagram.cs
  37. 4 3
      src/SASDesktop/Navigation.cs
  38. 140 0
      src/SASDesktop/SASDesktop.csproj
  39. 18 0
      src/SASDesktop/Styles/Cards.xaml
  40. 8 0
      src/SASDesktop/Styles/Typography.xaml
  41. 44 1
      src/SASDesktop/ViewModels/Auth.cs
  42. 35 0
      src/SASDesktop/ViewModels/Drivers/Create.cs
  43. 1 1
      src/SASDesktop/ViewModels/Portal.cs
  44. 8 4
      src/SASDesktop/Views/Auth.xaml
  45. 277 0
      src/SASDesktop/Views/Drivers/Create.xaml
  46. 29 0
      src/SASDesktop/Views/Drivers/Create.xaml.cs
  47. 31 27
      src/SASDesktop/Views/Portal.xaml
  48. 2 0
      src/SASDesktop/packages.config
  49. 2 0
      src/dataimport/.gitignore

+ 1 - 1
src/.gitignore

@@ -1,2 +1,2 @@
-packages
+packages/*
 .vs

+ 21 - 4
src/SASDesktop/App.config

@@ -1,6 +1,23 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
-    </startup>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
+  </startup>
+  <connectionStrings>
+    <add name="SASEntities" connectionString="metadata=res://*/Models.SAS.csdl|res://*/Models.SAS.ssdl|res://*/Models.SAS.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=srv-wsr\is4;initial catalog=SAS;user id=user12;password=is4-user12;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="mssqllocaldb" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
 </configuration>

+ 1 - 0
src/SASDesktop/App.xaml

@@ -8,6 +8,7 @@
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="Styles/Typography.xaml"/>
                 <ResourceDictionary Source="Styles/Forms.xaml"/>
+                <ResourceDictionary Source="Styles/Cards.xaml"/>
             </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
     </Application.Resources>

+ 1 - 2
src/SASDesktop/AuthState.cs

@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using SASDesktop.Models;
 
 namespace SASDesktop
 {
@@ -12,6 +11,6 @@ namespace SASDesktop
         /// <summary>
         /// Текущий пользователь
         /// </summary>
-        private static object? CurrentUser { get; set; } = null;
+        private static object CurrentUser { get; set; } = null;
     }
 }

+ 3 - 1
src/SASDesktop/MainWindow.xaml

@@ -5,7 +5,8 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:SASDesktop"
         mc:Ignorable="d"
-        Title="MainWindow" Height="600" Width="800">
+        Icon="Assets/logo.png"
+        Title="ГАС | ГосАвтоСистема" Height="600" Width="800">
     <Window.Resources>
         <local:Navigation x:Key="Navigator"/>
     </Window.Resources>
@@ -38,6 +39,7 @@
         <!--Контент-->
         <!--при загрузке приложения отображается страница авторизации-->
         <Frame 
+            NavigationUIVisibility="Hidden"
             Grid.Row="1"
             Source="/Views/Auth.xaml"
             x:Name="ContentBody"/>

+ 29 - 0
src/SASDesktop/Models/Brand.cs

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

+ 32 - 0
src/SASDesktop/Models/Category.cs

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

+ 47 - 0
src/SASDesktop/Models/Citizen.cs

@@ -0,0 +1,47 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Citizen
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Citizen()
+        {
+            this.Licenses = new HashSet<License>();
+            this.TransportOwnerships = new HashSet<TransportOwnership>();
+        }
+    
+        public int ID { get; set; }
+        public string Surname { get; set; }
+        public string Name { get; set; }
+        public string Patronymic { get; set; }
+        public Nullable<int> Job { get; set; }
+        public string Email { get; set; }
+        public string Phone { get; set; }
+        public string PassSeries { get; set; }
+        public string PassNumber { get; set; }
+        public string MailIndex { get; set; }
+        public string RegistrationAddress { get; set; }
+        public Nullable<int> Photo { get; set; }
+        public string CurrentAddress { get; set; }
+        public string Comment { get; set; }
+        public string Discription { get; set; }
+    
+        public virtual File File { get; set; }
+        public virtual Job Job1 { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<License> Licenses { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<TransportOwnership> TransportOwnerships { get; set; }
+    }
+}

+ 34 - 0
src/SASDesktop/Models/Color.cs

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

+ 29 - 0
src/SASDesktop/Models/Company.cs

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

+ 29 - 0
src/SASDesktop/Models/DivisionGIBDD.cs

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

+ 29 - 0
src/SASDesktop/Models/DriveType.cs

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

+ 40 - 0
src/SASDesktop/Models/Employee.cs

@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Employee
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Employee()
+        {
+            this.LoginAttempts = new HashSet<LoginAttempt>();
+            this.LoginBlocks = new HashSet<LoginBlock>();
+        }
+    
+        public int ID { get; set; }
+        public string Surname { get; set; }
+        public string Name { get; set; }
+        public string Patronymic { get; set; }
+        public int DivisionGIBDD { get; set; }
+        public int Role { get; set; }
+        public string Login { get; set; }
+        public string Password { get; set; }
+    
+        public virtual DivisionGIBDD DivisionGIBDD1 { get; set; }
+        public virtual Role Role1 { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<LoginAttempt> LoginAttempts { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<LoginBlock> LoginBlocks { get; set; }
+    }
+}

+ 30 - 0
src/SASDesktop/Models/EngineType.cs

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

+ 29 - 0
src/SASDesktop/Models/Extension.cs

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

+ 35 - 0
src/SASDesktop/Models/File.cs

@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class File
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public File()
+        {
+            this.Citizens = new HashSet<Citizen>();
+            this.TransportPhotoes = new HashSet<TransportPhoto>();
+        }
+    
+        public int ID { get; set; }
+        public Nullable<int> Extension { get; set; }
+        public byte[] BinaryData { get; set; }
+        public string Name { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Citizen> Citizens { get; set; }
+        public virtual Extension Extension1 { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<TransportPhoto> TransportPhotoes { get; set; }
+    }
+}

+ 31 - 0
src/SASDesktop/Models/Job.cs

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

+ 34 - 0
src/SASDesktop/Models/License.cs

@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class License
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public License()
+        {
+            this.LicenseCategories = new HashSet<LicenseCategory>();
+        }
+    
+        public int ID { get; set; }
+        public int Citizen { get; set; }
+        public System.DateTime DateStart { get; set; }
+        public System.DateTime DiateFinish { get; set; }
+        public string Series { get; set; }
+        public string Number { get; set; }
+    
+        public virtual Citizen Citizen1 { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<LicenseCategory> LicenseCategories { get; set; }
+    }
+}

+ 24 - 0
src/SASDesktop/Models/LicenseCategory.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class LicenseCategory
+    {
+        public int ID { get; set; }
+        public int Category { get; set; }
+        public int License { get; set; }
+    
+        public virtual Category Category1 { get; set; }
+        public virtual License License1 { get; set; }
+    }
+}

+ 23 - 0
src/SASDesktop/Models/LoginAttempt.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class LoginAttempt
+    {
+        public int ID { get; set; }
+        public int Employee { get; set; }
+        public System.DateTime CreatedAt { get; set; }
+    
+        public virtual Employee Employee1 { get; set; }
+    }
+}

+ 23 - 0
src/SASDesktop/Models/LoginBlock.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class LoginBlock
+    {
+        public int ID { get; set; }
+        public int Employee { get; set; }
+        public System.DateTime BlockedUntil { get; set; }
+    
+        public virtual Employee Employee1 { get; set; }
+    }
+}

+ 31 - 0
src/SASDesktop/Models/Model.cs

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

+ 36 - 0
src/SASDesktop/Models/Region.cs

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

+ 23 - 0
src/SASDesktop/Models/RegionCode.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class RegionCode
+    {
+        public int ID { get; set; }
+        public int Region { get; set; }
+        public string Code { get; set; }
+    
+        public virtual Region Region1 { get; set; }
+    }
+}

+ 29 - 0
src/SASDesktop/Models/Role.cs

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

+ 53 - 0
src/SASDesktop/Models/SAS.Context.cs

@@ -0,0 +1,53 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Data.Entity;
+    using System.Data.Entity.Infrastructure;
+    
+    public partial class SASEntities : DbContext
+    {
+        public SASEntities()
+            : base("name=SASEntities")
+        {
+        }
+    
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            throw new UnintentionalCodeFirstException();
+        }
+    
+        public virtual DbSet<Brand> Brands { get; set; }
+        public virtual DbSet<Category> Categories { get; set; }
+        public virtual DbSet<Citizen> Citizens { get; set; }
+        public virtual DbSet<Color> Colors { get; set; }
+        public virtual DbSet<Company> Companies { get; set; }
+        public virtual DbSet<DivisionGIBDD> DivisionGIBDDs { get; set; }
+        public virtual DbSet<DriveType> DriveTypes { get; set; }
+        public virtual DbSet<Employee> Employees { get; set; }
+        public virtual DbSet<EngineType> EngineTypes { get; set; }
+        public virtual DbSet<Extension> Extensions { get; set; }
+        public virtual DbSet<File> Files { get; set; }
+        public virtual DbSet<Job> Jobs { get; set; }
+        public virtual DbSet<License> Licenses { get; set; }
+        public virtual DbSet<LicenseCategory> LicenseCategories { get; set; }
+        public virtual DbSet<LoginAttempt> LoginAttempts { get; set; }
+        public virtual DbSet<LoginBlock> LoginBlocks { get; set; }
+        public virtual DbSet<Model> Models { get; set; }
+        public virtual DbSet<Region> Regions { get; set; }
+        public virtual DbSet<RegionCode> RegionCodes { get; set; }
+        public virtual DbSet<Role> Roles { get; set; }
+        public virtual DbSet<sysdiagram> sysdiagrams { get; set; }
+        public virtual DbSet<Transport> Transports { get; set; }
+        public virtual DbSet<TransportOwnership> TransportOwnerships { get; set; }
+        public virtual DbSet<TransportPhoto> TransportPhotoes { get; set; }
+    }
+}

+ 636 - 0
src/SASDesktop/Models/SAS.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 = @"SAS.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
src/SASDesktop/Models/SAS.Designer.cs

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

+ 9 - 0
src/SASDesktop/Models/SAS.cs

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

+ 1569 - 0
src/SASDesktop/Models/SAS.edmx

@@ -0,0 +1,1569 @@
+<?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="Хранилище SASModel" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+        <EntityType Name="Brand">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="35" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Category">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="3" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Citizen">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Surname" Type="varchar" MaxLength="30" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="25" Nullable="false" />
+          <Property Name="Patronymic" Type="varchar" MaxLength="30" />
+          <Property Name="Job" Type="int" />
+          <Property Name="Email" Type="varchar" MaxLength="50" />
+          <Property Name="Phone" Type="varchar" MaxLength="16" />
+          <Property Name="PassSeries" Type="varchar" MaxLength="4" Nullable="false" />
+          <Property Name="PassNumber" Type="varchar" MaxLength="6" Nullable="false" />
+          <Property Name="MailIndex" Type="varchar" MaxLength="6" />
+          <Property Name="RegistrationAddress" Type="varchar" MaxLength="150" />
+          <Property Name="Photo" Type="int" />
+          <Property Name="CurrentAddress" Type="varchar" MaxLength="150" Nullable="false" />
+          <Property Name="Comment" Type="varchar" MaxLength="300" />
+          <Property Name="Discription" Type="varchar" MaxLength="300" />
+        </EntityType>
+        <EntityType Name="Color">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="HEX" Type="nchar" MaxLength="7" Nullable="false" />
+          <Property Name="NameRus" Type="varchar" MaxLength="35" Nullable="false" />
+          <Property Name="DiscriptionRus" Type="varchar" MaxLength="35" Nullable="false" />
+          <Property Name="NameEng" Type="varchar" MaxLength="35" Nullable="false" />
+          <Property Name="DiscriptionEng" Type="varchar" MaxLength="35" Nullable="false" />
+          <Property Name="IsMetallic" Type="bit" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Company">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="DivisionGIBDD">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="DriveType">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="35" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Employee">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Surname" Type="varchar" MaxLength="30" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="25" Nullable="false" />
+          <Property Name="Patronymic" Type="varchar" MaxLength="30" />
+          <Property Name="DivisionGIBDD" Type="int" Nullable="false" />
+          <Property Name="Role" Type="int" Nullable="false" />
+          <Property Name="Login" Type="varchar" MaxLength="50" Nullable="false" />
+          <Property Name="Password" Type="varchar" MaxLength="256" Nullable="false" />
+        </EntityType>
+        <EntityType Name="EngineType">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="NameRus" Type="varchar" MaxLength="35" Nullable="false" />
+          <Property Name="NameEng" Type="varchar" MaxLength="35" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Extension">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="6" Nullable="false" />
+        </EntityType>
+        <EntityType Name="File">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Extension" Type="int" />
+          <Property Name="BinaryData" Type="varbinary(max)" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Job">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="50" Nullable="false" />
+          <Property Name="Company" Type="int" Nullable="false" />
+        </EntityType>
+        <EntityType Name="License">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Citizen" Type="int" Nullable="false" />
+          <Property Name="DateStart" Type="date" Nullable="false" />
+          <Property Name="DiateFinish" Type="date" Nullable="false" />
+          <Property Name="Series" Type="varchar" MaxLength="4" Nullable="false" />
+          <Property Name="Number" Type="varchar" MaxLength="6" Nullable="false" />
+        </EntityType>
+        <EntityType Name="LicenseCategory">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Category" Type="int" Nullable="false" />
+          <Property Name="License" Type="int" Nullable="false" />
+        </EntityType>
+        <EntityType Name="LoginAttempt">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Employee" Type="int" Nullable="false" />
+          <Property Name="CreatedAt" Type="datetime2" Precision="7" Nullable="false" />
+        </EntityType>
+        <EntityType Name="LoginBlock">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Employee" Type="int" Nullable="false" />
+          <Property Name="BlockedUntil" Type="datetime2" Precision="7" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Model">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Brand" Type="int" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="35" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Region">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="NameRus" Type="varchar" MaxLength="50" Nullable="false" />
+          <Property Name="NameEng" Type="varchar" MaxLength="50" />
+          <Property Name="Number" Type="varchar" MaxLength="3" Nullable="false" />
+          <Property Name="OKATO" Type="varchar" MaxLength="3" />
+          <Property Name="ISO3166_2" Type="varchar" MaxLength="7" />
+        </EntityType>
+        <EntityType Name="RegionCode">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Region" Type="int" Nullable="false" />
+          <Property Name="Code" Type="varchar" MaxLength="3" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Role">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Name" Type="varchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="sysdiagrams">
+          <Key>
+            <PropertyRef Name="diagram_id" />
+          </Key>
+          <Property Name="name" Type="nvarchar" MaxLength="128" Nullable="false" />
+          <Property Name="principal_id" Type="int" Nullable="false" />
+          <Property Name="diagram_id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="version" Type="int" />
+          <Property Name="definition" Type="varbinary(max)" />
+        </EntityType>
+        <EntityType Name="Transport">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Region" Type="int" Nullable="false" />
+          <Property Name="VIN" Type="varchar" MaxLength="17" Nullable="false" />
+          <Property Name="Category" Type="int" Nullable="false" />
+          <Property Name="Color" Type="int" Nullable="false" />
+          <Property Name="EngineType" Type="int" Nullable="false" />
+          <Property Name="Model" Type="int" Nullable="false" />
+          <Property Name="RelaseYear" Type="date" Nullable="false" />
+          <Property Name="WeightKg" Type="int" Nullable="false" />
+          <Property Name="DriveType" Type="int" Nullable="false" />
+        </EntityType>
+        <EntityType Name="TransportOwnership">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Citizen" Type="int" Nullable="false" />
+          <Property Name="Transport" Type="int" Nullable="false" />
+          <Property Name="CreatedAt" Type="date" Nullable="false" />
+        </EntityType>
+        <EntityType Name="TransportPhoto">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Transport" Type="int" Nullable="false" />
+          <Property Name="Photo" Type="int" Nullable="false" />
+        </EntityType>
+        <Association Name="FK_Citizen_File">
+          <End Role="File" Type="Self.File" Multiplicity="0..1" />
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="File">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Citizen">
+              <PropertyRef Name="Photo" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Citizen_Job">
+          <End Role="Job" Type="Self.Job" Multiplicity="0..1" />
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Job">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Citizen">
+              <PropertyRef Name="Job" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Employee_DivisionGIBDD">
+          <End Role="DivisionGIBDD" Type="Self.DivisionGIBDD" Multiplicity="1" />
+          <End Role="Employee" Type="Self.Employee" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="DivisionGIBDD">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Employee">
+              <PropertyRef Name="DivisionGIBDD" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Employee_Role">
+          <End Role="Role" Type="Self.Role" Multiplicity="1" />
+          <End Role="Employee" Type="Self.Employee" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Role">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Employee">
+              <PropertyRef Name="Role" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_File_Extension">
+          <End Role="Extension" Type="Self.Extension" Multiplicity="0..1" />
+          <End Role="File" Type="Self.File" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Extension">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="File">
+              <PropertyRef Name="Extension" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Job_Company">
+          <End Role="Company" Type="Self.Company" Multiplicity="1" />
+          <End Role="Job" Type="Self.Job" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Company">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Job">
+              <PropertyRef Name="Company" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_License_License">
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="1" />
+          <End Role="License" Type="Self.License" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Citizen">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="License">
+              <PropertyRef Name="Citizen" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LicenseCategory_Category">
+          <End Role="Category" Type="Self.Category" Multiplicity="1" />
+          <End Role="LicenseCategory" Type="Self.LicenseCategory" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Category">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LicenseCategory">
+              <PropertyRef Name="Category" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LicenseCategory_License">
+          <End Role="License" Type="Self.License" Multiplicity="1" />
+          <End Role="LicenseCategory" Type="Self.LicenseCategory" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="License">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LicenseCategory">
+              <PropertyRef Name="License" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LoginAttempt_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1" />
+          <End Role="LoginAttempt" Type="Self.LoginAttempt" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Employee">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LoginAttempt">
+              <PropertyRef Name="Employee" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LoginBlock_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1" />
+          <End Role="LoginBlock" Type="Self.LoginBlock" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Employee">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LoginBlock">
+              <PropertyRef Name="Employee" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Model_Brand">
+          <End Role="Brand" Type="Self.Brand" Multiplicity="1" />
+          <End Role="Model" Type="Self.Model" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Brand">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Model">
+              <PropertyRef Name="Brand" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RegionCode_Region">
+          <End Role="Region" Type="Self.Region" Multiplicity="1" />
+          <End Role="RegionCode" Type="Self.RegionCode" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Region">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="RegionCode">
+              <PropertyRef Name="Region" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Category">
+          <End Role="Category" Type="Self.Category" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Category">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Category" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Color">
+          <End Role="Color" Type="Self.Color" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Color">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Color" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_DriveType">
+          <End Role="DriveType" Type="Self.DriveType" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="DriveType">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="DriveType" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_EngineType">
+          <End Role="EngineType" Type="Self.EngineType" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="EngineType">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="EngineType" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Model">
+          <End Role="Model" Type="Self.Model" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Model">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Model" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Region">
+          <End Role="Region" Type="Self.Region" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Region">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Region" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportOwnership_Citizen">
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="1" />
+          <End Role="TransportOwnership" Type="Self.TransportOwnership" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Citizen">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportOwnership">
+              <PropertyRef Name="Citizen" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportOwnership_Transport">
+          <End Role="Transport" Type="Self.Transport" Multiplicity="1" />
+          <End Role="TransportOwnership" Type="Self.TransportOwnership" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Transport">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportOwnership">
+              <PropertyRef Name="Transport" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportPhoto_File">
+          <End Role="File" Type="Self.File" Multiplicity="1" />
+          <End Role="TransportPhoto" Type="Self.TransportPhoto" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="File">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportPhoto">
+              <PropertyRef Name="Photo" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportPhoto_Transport">
+          <End Role="Transport" Type="Self.Transport" Multiplicity="1" />
+          <End Role="TransportPhoto" Type="Self.TransportPhoto" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Transport">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportPhoto">
+              <PropertyRef Name="Transport" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityContainer Name="Хранилище SASModelContainer">
+          <EntitySet Name="Brand" EntityType="Self.Brand" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Category" EntityType="Self.Category" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Citizen" EntityType="Self.Citizen" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Color" EntityType="Self.Color" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Company" EntityType="Self.Company" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="DivisionGIBDD" EntityType="Self.DivisionGIBDD" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="DriveType" EntityType="Self.DriveType" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Employee" EntityType="Self.Employee" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="EngineType" EntityType="Self.EngineType" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Extension" EntityType="Self.Extension" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="File" EntityType="Self.File" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Job" EntityType="Self.Job" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="License" EntityType="Self.License" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="LicenseCategory" EntityType="Self.LicenseCategory" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="LoginAttempt" EntityType="Self.LoginAttempt" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="LoginBlock" EntityType="Self.LoginBlock" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Model" EntityType="Self.Model" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Region" EntityType="Self.Region" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="RegionCode" EntityType="Self.RegionCode" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Role" EntityType="Self.Role" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Transport" EntityType="Self.Transport" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="TransportOwnership" EntityType="Self.TransportOwnership" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="TransportPhoto" EntityType="Self.TransportPhoto" Schema="dbo" store:Type="Tables" />
+          <AssociationSet Name="FK_Citizen_File" Association="Self.FK_Citizen_File">
+            <End Role="File" EntitySet="File" />
+            <End Role="Citizen" EntitySet="Citizen" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Citizen_Job" Association="Self.FK_Citizen_Job">
+            <End Role="Job" EntitySet="Job" />
+            <End Role="Citizen" EntitySet="Citizen" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Employee_DivisionGIBDD" Association="Self.FK_Employee_DivisionGIBDD">
+            <End Role="DivisionGIBDD" EntitySet="DivisionGIBDD" />
+            <End Role="Employee" EntitySet="Employee" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Employee_Role" Association="Self.FK_Employee_Role">
+            <End Role="Role" EntitySet="Role" />
+            <End Role="Employee" EntitySet="Employee" />
+          </AssociationSet>
+          <AssociationSet Name="FK_File_Extension" Association="Self.FK_File_Extension">
+            <End Role="Extension" EntitySet="Extension" />
+            <End Role="File" EntitySet="File" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Job_Company" Association="Self.FK_Job_Company">
+            <End Role="Company" EntitySet="Company" />
+            <End Role="Job" EntitySet="Job" />
+          </AssociationSet>
+          <AssociationSet Name="FK_License_License" Association="Self.FK_License_License">
+            <End Role="Citizen" EntitySet="Citizen" />
+            <End Role="License" EntitySet="License" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LicenseCategory_Category" Association="Self.FK_LicenseCategory_Category">
+            <End Role="Category" EntitySet="Category" />
+            <End Role="LicenseCategory" EntitySet="LicenseCategory" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LicenseCategory_License" Association="Self.FK_LicenseCategory_License">
+            <End Role="License" EntitySet="License" />
+            <End Role="LicenseCategory" EntitySet="LicenseCategory" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LoginAttempt_Employee" Association="Self.FK_LoginAttempt_Employee">
+            <End Role="Employee" EntitySet="Employee" />
+            <End Role="LoginAttempt" EntitySet="LoginAttempt" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LoginBlock_Employee" Association="Self.FK_LoginBlock_Employee">
+            <End Role="Employee" EntitySet="Employee" />
+            <End Role="LoginBlock" EntitySet="LoginBlock" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Model_Brand" Association="Self.FK_Model_Brand">
+            <End Role="Brand" EntitySet="Brand" />
+            <End Role="Model" EntitySet="Model" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RegionCode_Region" Association="Self.FK_RegionCode_Region">
+            <End Role="Region" EntitySet="Region" />
+            <End Role="RegionCode" EntitySet="RegionCode" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Category" Association="Self.FK_Transport_Category">
+            <End Role="Category" EntitySet="Category" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Color" Association="Self.FK_Transport_Color">
+            <End Role="Color" EntitySet="Color" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_DriveType" Association="Self.FK_Transport_DriveType">
+            <End Role="DriveType" EntitySet="DriveType" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_EngineType" Association="Self.FK_Transport_EngineType">
+            <End Role="EngineType" EntitySet="EngineType" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Model" Association="Self.FK_Transport_Model">
+            <End Role="Model" EntitySet="Model" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Region" Association="Self.FK_Transport_Region">
+            <End Role="Region" EntitySet="Region" />
+            <End Role="Transport" EntitySet="Transport" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportOwnership_Citizen" Association="Self.FK_TransportOwnership_Citizen">
+            <End Role="Citizen" EntitySet="Citizen" />
+            <End Role="TransportOwnership" EntitySet="TransportOwnership" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportOwnership_Transport" Association="Self.FK_TransportOwnership_Transport">
+            <End Role="Transport" EntitySet="Transport" />
+            <End Role="TransportOwnership" EntitySet="TransportOwnership" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportPhoto_File" Association="Self.FK_TransportPhoto_File">
+            <End Role="File" EntitySet="File" />
+            <End Role="TransportPhoto" EntitySet="TransportPhoto" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportPhoto_Transport" Association="Self.FK_TransportPhoto_Transport">
+            <End Role="Transport" EntitySet="Transport" />
+            <End Role="TransportPhoto" EntitySet="TransportPhoto" />
+          </AssociationSet>
+        </EntityContainer>
+      </Schema>
+    </edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema Namespace="SASModel" 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="Brand">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Models" Relationship="Self.FK_Model_Brand" FromRole="Brand" ToRole="Model" />
+        </EntityType>
+        <EntityType Name="Category">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="3" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="LicenseCategories" Relationship="Self.FK_LicenseCategory_Category" FromRole="Category" ToRole="LicenseCategory" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_Category" FromRole="Category" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="Citizen">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Surname" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="25" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Patronymic" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
+          <Property Name="Job" Type="Int32" />
+          <Property Name="Email" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
+          <Property Name="Phone" Type="String" MaxLength="16" FixedLength="false" Unicode="false" />
+          <Property Name="PassSeries" Type="String" MaxLength="4" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="PassNumber" Type="String" MaxLength="6" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="MailIndex" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
+          <Property Name="RegistrationAddress" Type="String" MaxLength="150" FixedLength="false" Unicode="false" />
+          <Property Name="Photo" Type="Int32" />
+          <Property Name="CurrentAddress" Type="String" MaxLength="150" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Comment" Type="String" MaxLength="300" FixedLength="false" Unicode="false" />
+          <Property Name="Discription" Type="String" MaxLength="300" FixedLength="false" Unicode="false" />
+          <NavigationProperty Name="File" Relationship="Self.FK_Citizen_File" FromRole="Citizen" ToRole="File" />
+          <NavigationProperty Name="Job1" Relationship="Self.FK_Citizen_Job" FromRole="Citizen" ToRole="Job" />
+          <NavigationProperty Name="Licenses" Relationship="Self.FK_License_License" FromRole="Citizen" ToRole="License" />
+          <NavigationProperty Name="TransportOwnerships" Relationship="Self.FK_TransportOwnership_Citizen" FromRole="Citizen" ToRole="TransportOwnership" />
+        </EntityType>
+        <EntityType Name="Color">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="HEX" Type="String" MaxLength="7" FixedLength="true" Unicode="true" Nullable="false" />
+          <Property Name="NameRus" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="DiscriptionRus" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="NameEng" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="DiscriptionEng" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="IsMetallic" Type="Boolean" Nullable="false" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_Color" FromRole="Color" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="Company">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Jobs" Relationship="Self.FK_Job_Company" FromRole="Company" ToRole="Job" />
+        </EntityType>
+        <EntityType Name="DivisionGIBDD">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Employees" Relationship="Self.FK_Employee_DivisionGIBDD" FromRole="DivisionGIBDD" ToRole="Employee" />
+        </EntityType>
+        <EntityType Name="DriveType">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_DriveType" FromRole="DriveType" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="Employee">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Surname" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="25" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Patronymic" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
+          <Property Name="DivisionGIBDD" Type="Int32" Nullable="false" />
+          <Property Name="Role" Type="Int32" Nullable="false" />
+          <Property Name="Login" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Password" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="DivisionGIBDD1" Relationship="Self.FK_Employee_DivisionGIBDD" FromRole="Employee" ToRole="DivisionGIBDD" />
+          <NavigationProperty Name="Role1" Relationship="Self.FK_Employee_Role" FromRole="Employee" ToRole="Role" />
+          <NavigationProperty Name="LoginAttempts" Relationship="Self.FK_LoginAttempt_Employee" FromRole="Employee" ToRole="LoginAttempt" />
+          <NavigationProperty Name="LoginBlocks" Relationship="Self.FK_LoginBlock_Employee" FromRole="Employee" ToRole="LoginBlock" />
+        </EntityType>
+        <EntityType Name="EngineType">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="NameRus" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="NameEng" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_EngineType" FromRole="EngineType" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="Extension">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="6" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Files" Relationship="Self.FK_File_Extension" FromRole="Extension" ToRole="File" />
+        </EntityType>
+        <EntityType Name="File">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Extension" Type="Int32" />
+          <Property Name="BinaryData" Type="Binary" MaxLength="Max" FixedLength="false" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Citizens" Relationship="Self.FK_Citizen_File" FromRole="File" ToRole="Citizen" />
+          <NavigationProperty Name="Extension1" Relationship="Self.FK_File_Extension" FromRole="File" ToRole="Extension" />
+          <NavigationProperty Name="TransportPhotoes" Relationship="Self.FK_TransportPhoto_File" FromRole="File" ToRole="TransportPhoto" />
+        </EntityType>
+        <EntityType Name="Job">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Company" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Citizens" Relationship="Self.FK_Citizen_Job" FromRole="Job" ToRole="Citizen" />
+          <NavigationProperty Name="Company1" Relationship="Self.FK_Job_Company" FromRole="Job" ToRole="Company" />
+        </EntityType>
+        <EntityType Name="License">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Citizen" Type="Int32" Nullable="false" />
+          <Property Name="DateStart" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="DiateFinish" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="Series" Type="String" MaxLength="4" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Number" Type="String" MaxLength="6" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Citizen1" Relationship="Self.FK_License_License" FromRole="License" ToRole="Citizen" />
+          <NavigationProperty Name="LicenseCategories" Relationship="Self.FK_LicenseCategory_License" FromRole="License" ToRole="LicenseCategory" />
+        </EntityType>
+        <EntityType Name="LicenseCategory">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Category" Type="Int32" Nullable="false" />
+          <Property Name="License" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Category1" Relationship="Self.FK_LicenseCategory_Category" FromRole="LicenseCategory" ToRole="Category" />
+          <NavigationProperty Name="License1" Relationship="Self.FK_LicenseCategory_License" FromRole="LicenseCategory" ToRole="License" />
+        </EntityType>
+        <EntityType Name="LoginAttempt">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Employee" Type="Int32" Nullable="false" />
+          <Property Name="CreatedAt" Type="DateTime" Nullable="false" Precision="7" />
+          <NavigationProperty Name="Employee1" Relationship="Self.FK_LoginAttempt_Employee" FromRole="LoginAttempt" ToRole="Employee" />
+        </EntityType>
+        <EntityType Name="LoginBlock">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Employee" Type="Int32" Nullable="false" />
+          <Property Name="BlockedUntil" Type="DateTime" Nullable="false" Precision="7" />
+          <NavigationProperty Name="Employee1" Relationship="Self.FK_LoginBlock_Employee" FromRole="LoginBlock" ToRole="Employee" />
+        </EntityType>
+        <EntityType Name="Model">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Brand" Type="Int32" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="35" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Brand1" Relationship="Self.FK_Model_Brand" FromRole="Model" ToRole="Brand" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_Model" FromRole="Model" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="Region">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="NameRus" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="NameEng" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
+          <Property Name="Number" Type="String" MaxLength="3" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="OKATO" Type="String" MaxLength="3" FixedLength="false" Unicode="false" />
+          <Property Name="ISO3166_2" Type="String" MaxLength="7" FixedLength="false" Unicode="false" />
+          <NavigationProperty Name="RegionCodes" Relationship="Self.FK_RegionCode_Region" FromRole="Region" ToRole="RegionCode" />
+          <NavigationProperty Name="Transports" Relationship="Self.FK_Transport_Region" FromRole="Region" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="RegionCode">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Region" Type="Int32" Nullable="false" />
+          <Property Name="Code" Type="String" MaxLength="3" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Region1" Relationship="Self.FK_RegionCode_Region" FromRole="RegionCode" ToRole="Region" />
+        </EntityType>
+        <EntityType Name="Role">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
+          <NavigationProperty Name="Employees" Relationship="Self.FK_Employee_Role" FromRole="Role" ToRole="Employee" />
+        </EntityType>
+        <EntityType Name="sysdiagram">
+          <Key>
+            <PropertyRef Name="diagram_id" />
+          </Key>
+          <Property Name="name" Type="String" MaxLength="128" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="principal_id" Type="Int32" Nullable="false" />
+          <Property Name="diagram_id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="version" Type="Int32" />
+          <Property Name="definition" Type="Binary" MaxLength="Max" FixedLength="false" />
+        </EntityType>
+        <EntityType Name="Transport">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Region" Type="Int32" Nullable="false" />
+          <Property Name="VIN" Type="String" MaxLength="17" FixedLength="false" Unicode="false" Nullable="false" />
+          <Property Name="Category" Type="Int32" Nullable="false" />
+          <Property Name="Color" Type="Int32" Nullable="false" />
+          <Property Name="EngineType" Type="Int32" Nullable="false" />
+          <Property Name="Model" Type="Int32" Nullable="false" />
+          <Property Name="RelaseYear" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="WeightKg" Type="Int32" Nullable="false" />
+          <Property Name="DriveType" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Category1" Relationship="Self.FK_Transport_Category" FromRole="Transport" ToRole="Category" />
+          <NavigationProperty Name="Color1" Relationship="Self.FK_Transport_Color" FromRole="Transport" ToRole="Color" />
+          <NavigationProperty Name="DriveType1" Relationship="Self.FK_Transport_DriveType" FromRole="Transport" ToRole="DriveType" />
+          <NavigationProperty Name="EngineType1" Relationship="Self.FK_Transport_EngineType" FromRole="Transport" ToRole="EngineType" />
+          <NavigationProperty Name="Model1" Relationship="Self.FK_Transport_Model" FromRole="Transport" ToRole="Model" />
+          <NavigationProperty Name="Region1" Relationship="Self.FK_Transport_Region" FromRole="Transport" ToRole="Region" />
+          <NavigationProperty Name="TransportOwnerships" Relationship="Self.FK_TransportOwnership_Transport" FromRole="Transport" ToRole="TransportOwnership" />
+          <NavigationProperty Name="TransportPhotoes" Relationship="Self.FK_TransportPhoto_Transport" FromRole="Transport" ToRole="TransportPhoto" />
+        </EntityType>
+        <EntityType Name="TransportOwnership">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Citizen" Type="Int32" Nullable="false" />
+          <Property Name="Transport" Type="Int32" Nullable="false" />
+          <Property Name="CreatedAt" Type="DateTime" Nullable="false" Precision="0" />
+          <NavigationProperty Name="Citizen1" Relationship="Self.FK_TransportOwnership_Citizen" FromRole="TransportOwnership" ToRole="Citizen" />
+          <NavigationProperty Name="Transport1" Relationship="Self.FK_TransportOwnership_Transport" FromRole="TransportOwnership" ToRole="Transport" />
+        </EntityType>
+        <EntityType Name="TransportPhoto">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Transport" Type="Int32" Nullable="false" />
+          <Property Name="Photo" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="File" Relationship="Self.FK_TransportPhoto_File" FromRole="TransportPhoto" ToRole="File" />
+          <NavigationProperty Name="Transport1" Relationship="Self.FK_TransportPhoto_Transport" FromRole="TransportPhoto" ToRole="Transport" />
+        </EntityType>
+        <Association Name="FK_Model_Brand">
+          <End Role="Brand" Type="Self.Brand" Multiplicity="1" />
+          <End Role="Model" Type="Self.Model" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Brand">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Model">
+              <PropertyRef Name="Brand" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LicenseCategory_Category">
+          <End Role="Category" Type="Self.Category" Multiplicity="1" />
+          <End Role="LicenseCategory" Type="Self.LicenseCategory" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Category">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LicenseCategory">
+              <PropertyRef Name="Category" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Category">
+          <End Role="Category" Type="Self.Category" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Category">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Category" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Citizen_File">
+          <End Role="File" Type="Self.File" Multiplicity="0..1" />
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="File">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Citizen">
+              <PropertyRef Name="Photo" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Citizen_Job">
+          <End Role="Job" Type="Self.Job" Multiplicity="0..1" />
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Job">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Citizen">
+              <PropertyRef Name="Job" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_License_License">
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="1" />
+          <End Role="License" Type="Self.License" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Citizen">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="License">
+              <PropertyRef Name="Citizen" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportOwnership_Citizen">
+          <End Role="Citizen" Type="Self.Citizen" Multiplicity="1" />
+          <End Role="TransportOwnership" Type="Self.TransportOwnership" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Citizen">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportOwnership">
+              <PropertyRef Name="Citizen" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Color">
+          <End Role="Color" Type="Self.Color" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Color">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Color" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Job_Company">
+          <End Role="Company" Type="Self.Company" Multiplicity="1" />
+          <End Role="Job" Type="Self.Job" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Company">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Job">
+              <PropertyRef Name="Company" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Employee_DivisionGIBDD">
+          <End Role="DivisionGIBDD" Type="Self.DivisionGIBDD" Multiplicity="1" />
+          <End Role="Employee" Type="Self.Employee" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="DivisionGIBDD">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Employee">
+              <PropertyRef Name="DivisionGIBDD" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_DriveType">
+          <End Role="DriveType" Type="Self.DriveType" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="DriveType">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="DriveType" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Employee_Role">
+          <End Role="Role" Type="Self.Role" Multiplicity="1" />
+          <End Role="Employee" Type="Self.Employee" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Role">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Employee">
+              <PropertyRef Name="Role" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LoginAttempt_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1" />
+          <End Role="LoginAttempt" Type="Self.LoginAttempt" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Employee">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LoginAttempt">
+              <PropertyRef Name="Employee" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LoginBlock_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1" />
+          <End Role="LoginBlock" Type="Self.LoginBlock" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Employee">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LoginBlock">
+              <PropertyRef Name="Employee" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_EngineType">
+          <End Role="EngineType" Type="Self.EngineType" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="EngineType">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="EngineType" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_File_Extension">
+          <End Role="Extension" Type="Self.Extension" Multiplicity="0..1" />
+          <End Role="File" Type="Self.File" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Extension">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="File">
+              <PropertyRef Name="Extension" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportPhoto_File">
+          <End Role="File" Type="Self.File" Multiplicity="1" />
+          <End Role="TransportPhoto" Type="Self.TransportPhoto" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="File">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportPhoto">
+              <PropertyRef Name="Photo" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_LicenseCategory_License">
+          <End Role="License" Type="Self.License" Multiplicity="1" />
+          <End Role="LicenseCategory" Type="Self.LicenseCategory" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="License">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="LicenseCategory">
+              <PropertyRef Name="License" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Model">
+          <End Role="Model" Type="Self.Model" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Model">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Model" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RegionCode_Region">
+          <End Role="Region" Type="Self.Region" Multiplicity="1" />
+          <End Role="RegionCode" Type="Self.RegionCode" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Region">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="RegionCode">
+              <PropertyRef Name="Region" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Transport_Region">
+          <End Role="Region" Type="Self.Region" Multiplicity="1" />
+          <End Role="Transport" Type="Self.Transport" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Region">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Transport">
+              <PropertyRef Name="Region" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportOwnership_Transport">
+          <End Role="Transport" Type="Self.Transport" Multiplicity="1" />
+          <End Role="TransportOwnership" Type="Self.TransportOwnership" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Transport">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportOwnership">
+              <PropertyRef Name="Transport" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_TransportPhoto_Transport">
+          <End Role="Transport" Type="Self.Transport" Multiplicity="1" />
+          <End Role="TransportPhoto" Type="Self.TransportPhoto" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Transport">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="TransportPhoto">
+              <PropertyRef Name="Transport" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityContainer Name="SASEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Brands" EntityType="Self.Brand" />
+          <EntitySet Name="Categories" EntityType="Self.Category" />
+          <EntitySet Name="Citizens" EntityType="Self.Citizen" />
+          <EntitySet Name="Colors" EntityType="Self.Color" />
+          <EntitySet Name="Companies" EntityType="Self.Company" />
+          <EntitySet Name="DivisionGIBDDs" EntityType="Self.DivisionGIBDD" />
+          <EntitySet Name="DriveTypes" EntityType="Self.DriveType" />
+          <EntitySet Name="Employees" EntityType="Self.Employee" />
+          <EntitySet Name="EngineTypes" EntityType="Self.EngineType" />
+          <EntitySet Name="Extensions" EntityType="Self.Extension" />
+          <EntitySet Name="Files" EntityType="Self.File" />
+          <EntitySet Name="Jobs" EntityType="Self.Job" />
+          <EntitySet Name="Licenses" EntityType="Self.License" />
+          <EntitySet Name="LicenseCategories" EntityType="Self.LicenseCategory" />
+          <EntitySet Name="LoginAttempts" EntityType="Self.LoginAttempt" />
+          <EntitySet Name="LoginBlocks" EntityType="Self.LoginBlock" />
+          <EntitySet Name="Models" EntityType="Self.Model" />
+          <EntitySet Name="Regions" EntityType="Self.Region" />
+          <EntitySet Name="RegionCodes" EntityType="Self.RegionCode" />
+          <EntitySet Name="Roles" EntityType="Self.Role" />
+          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagram" />
+          <EntitySet Name="Transports" EntityType="Self.Transport" />
+          <EntitySet Name="TransportOwnerships" EntityType="Self.TransportOwnership" />
+          <EntitySet Name="TransportPhotoes" EntityType="Self.TransportPhoto" />
+          <AssociationSet Name="FK_Model_Brand" Association="Self.FK_Model_Brand">
+            <End Role="Brand" EntitySet="Brands" />
+            <End Role="Model" EntitySet="Models" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LicenseCategory_Category" Association="Self.FK_LicenseCategory_Category">
+            <End Role="Category" EntitySet="Categories" />
+            <End Role="LicenseCategory" EntitySet="LicenseCategories" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Category" Association="Self.FK_Transport_Category">
+            <End Role="Category" EntitySet="Categories" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Citizen_File" Association="Self.FK_Citizen_File">
+            <End Role="File" EntitySet="Files" />
+            <End Role="Citizen" EntitySet="Citizens" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Citizen_Job" Association="Self.FK_Citizen_Job">
+            <End Role="Job" EntitySet="Jobs" />
+            <End Role="Citizen" EntitySet="Citizens" />
+          </AssociationSet>
+          <AssociationSet Name="FK_License_License" Association="Self.FK_License_License">
+            <End Role="Citizen" EntitySet="Citizens" />
+            <End Role="License" EntitySet="Licenses" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportOwnership_Citizen" Association="Self.FK_TransportOwnership_Citizen">
+            <End Role="Citizen" EntitySet="Citizens" />
+            <End Role="TransportOwnership" EntitySet="TransportOwnerships" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Color" Association="Self.FK_Transport_Color">
+            <End Role="Color" EntitySet="Colors" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Job_Company" Association="Self.FK_Job_Company">
+            <End Role="Company" EntitySet="Companies" />
+            <End Role="Job" EntitySet="Jobs" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Employee_DivisionGIBDD" Association="Self.FK_Employee_DivisionGIBDD">
+            <End Role="DivisionGIBDD" EntitySet="DivisionGIBDDs" />
+            <End Role="Employee" EntitySet="Employees" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_DriveType" Association="Self.FK_Transport_DriveType">
+            <End Role="DriveType" EntitySet="DriveTypes" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Employee_Role" Association="Self.FK_Employee_Role">
+            <End Role="Role" EntitySet="Roles" />
+            <End Role="Employee" EntitySet="Employees" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LoginAttempt_Employee" Association="Self.FK_LoginAttempt_Employee">
+            <End Role="Employee" EntitySet="Employees" />
+            <End Role="LoginAttempt" EntitySet="LoginAttempts" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LoginBlock_Employee" Association="Self.FK_LoginBlock_Employee">
+            <End Role="Employee" EntitySet="Employees" />
+            <End Role="LoginBlock" EntitySet="LoginBlocks" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_EngineType" Association="Self.FK_Transport_EngineType">
+            <End Role="EngineType" EntitySet="EngineTypes" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_File_Extension" Association="Self.FK_File_Extension">
+            <End Role="Extension" EntitySet="Extensions" />
+            <End Role="File" EntitySet="Files" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportPhoto_File" Association="Self.FK_TransportPhoto_File">
+            <End Role="File" EntitySet="Files" />
+            <End Role="TransportPhoto" EntitySet="TransportPhotoes" />
+          </AssociationSet>
+          <AssociationSet Name="FK_LicenseCategory_License" Association="Self.FK_LicenseCategory_License">
+            <End Role="License" EntitySet="Licenses" />
+            <End Role="LicenseCategory" EntitySet="LicenseCategories" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Model" Association="Self.FK_Transport_Model">
+            <End Role="Model" EntitySet="Models" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RegionCode_Region" Association="Self.FK_RegionCode_Region">
+            <End Role="Region" EntitySet="Regions" />
+            <End Role="RegionCode" EntitySet="RegionCodes" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Transport_Region" Association="Self.FK_Transport_Region">
+            <End Role="Region" EntitySet="Regions" />
+            <End Role="Transport" EntitySet="Transports" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportOwnership_Transport" Association="Self.FK_TransportOwnership_Transport">
+            <End Role="Transport" EntitySet="Transports" />
+            <End Role="TransportOwnership" EntitySet="TransportOwnerships" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TransportPhoto_Transport" Association="Self.FK_TransportPhoto_Transport">
+            <End Role="Transport" EntitySet="Transports" />
+            <End Role="TransportPhoto" EntitySet="TransportPhotoes" />
+          </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="Хранилище SASModelContainer" CdmEntityContainer="SASEntities">
+          <EntitySetMapping Name="Brands">
+            <EntityTypeMapping TypeName="SASModel.Brand">
+              <MappingFragment StoreEntitySet="Brand">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Categories">
+            <EntityTypeMapping TypeName="SASModel.Category">
+              <MappingFragment StoreEntitySet="Category">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Citizens">
+            <EntityTypeMapping TypeName="SASModel.Citizen">
+              <MappingFragment StoreEntitySet="Citizen">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Surname" ColumnName="Surname" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
+                <ScalarProperty Name="Job" ColumnName="Job" />
+                <ScalarProperty Name="Email" ColumnName="Email" />
+                <ScalarProperty Name="Phone" ColumnName="Phone" />
+                <ScalarProperty Name="PassSeries" ColumnName="PassSeries" />
+                <ScalarProperty Name="PassNumber" ColumnName="PassNumber" />
+                <ScalarProperty Name="MailIndex" ColumnName="MailIndex" />
+                <ScalarProperty Name="RegistrationAddress" ColumnName="RegistrationAddress" />
+                <ScalarProperty Name="Photo" ColumnName="Photo" />
+                <ScalarProperty Name="CurrentAddress" ColumnName="CurrentAddress" />
+                <ScalarProperty Name="Comment" ColumnName="Comment" />
+                <ScalarProperty Name="Discription" ColumnName="Discription" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Colors">
+            <EntityTypeMapping TypeName="SASModel.Color">
+              <MappingFragment StoreEntitySet="Color">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="HEX" ColumnName="HEX" />
+                <ScalarProperty Name="NameRus" ColumnName="NameRus" />
+                <ScalarProperty Name="DiscriptionRus" ColumnName="DiscriptionRus" />
+                <ScalarProperty Name="NameEng" ColumnName="NameEng" />
+                <ScalarProperty Name="DiscriptionEng" ColumnName="DiscriptionEng" />
+                <ScalarProperty Name="IsMetallic" ColumnName="IsMetallic" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Companies">
+            <EntityTypeMapping TypeName="SASModel.Company">
+              <MappingFragment StoreEntitySet="Company">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="DivisionGIBDDs">
+            <EntityTypeMapping TypeName="SASModel.DivisionGIBDD">
+              <MappingFragment StoreEntitySet="DivisionGIBDD">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="DriveTypes">
+            <EntityTypeMapping TypeName="SASModel.DriveType">
+              <MappingFragment StoreEntitySet="DriveType">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Employees">
+            <EntityTypeMapping TypeName="SASModel.Employee">
+              <MappingFragment StoreEntitySet="Employee">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Surname" ColumnName="Surname" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
+                <ScalarProperty Name="DivisionGIBDD" ColumnName="DivisionGIBDD" />
+                <ScalarProperty Name="Role" ColumnName="Role" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="Password" ColumnName="Password" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="EngineTypes">
+            <EntityTypeMapping TypeName="SASModel.EngineType">
+              <MappingFragment StoreEntitySet="EngineType">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="NameRus" ColumnName="NameRus" />
+                <ScalarProperty Name="NameEng" ColumnName="NameEng" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Extensions">
+            <EntityTypeMapping TypeName="SASModel.Extension">
+              <MappingFragment StoreEntitySet="Extension">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Files">
+            <EntityTypeMapping TypeName="SASModel.File">
+              <MappingFragment StoreEntitySet="File">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Extension" ColumnName="Extension" />
+                <ScalarProperty Name="BinaryData" ColumnName="BinaryData" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Jobs">
+            <EntityTypeMapping TypeName="SASModel.Job">
+              <MappingFragment StoreEntitySet="Job">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Company" ColumnName="Company" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Licenses">
+            <EntityTypeMapping TypeName="SASModel.License">
+              <MappingFragment StoreEntitySet="License">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Citizen" ColumnName="Citizen" />
+                <ScalarProperty Name="DateStart" ColumnName="DateStart" />
+                <ScalarProperty Name="DiateFinish" ColumnName="DiateFinish" />
+                <ScalarProperty Name="Series" ColumnName="Series" />
+                <ScalarProperty Name="Number" ColumnName="Number" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="LicenseCategories">
+            <EntityTypeMapping TypeName="SASModel.LicenseCategory">
+              <MappingFragment StoreEntitySet="LicenseCategory">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Category" ColumnName="Category" />
+                <ScalarProperty Name="License" ColumnName="License" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="LoginAttempts">
+            <EntityTypeMapping TypeName="SASModel.LoginAttempt">
+              <MappingFragment StoreEntitySet="LoginAttempt">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Employee" ColumnName="Employee" />
+                <ScalarProperty Name="CreatedAt" ColumnName="CreatedAt" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="LoginBlocks">
+            <EntityTypeMapping TypeName="SASModel.LoginBlock">
+              <MappingFragment StoreEntitySet="LoginBlock">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Employee" ColumnName="Employee" />
+                <ScalarProperty Name="BlockedUntil" ColumnName="BlockedUntil" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Models">
+            <EntityTypeMapping TypeName="SASModel.Model">
+              <MappingFragment StoreEntitySet="Model">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Brand" ColumnName="Brand" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Regions">
+            <EntityTypeMapping TypeName="SASModel.Region">
+              <MappingFragment StoreEntitySet="Region">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="NameRus" ColumnName="NameRus" />
+                <ScalarProperty Name="NameEng" ColumnName="NameEng" />
+                <ScalarProperty Name="Number" ColumnName="Number" />
+                <ScalarProperty Name="OKATO" ColumnName="OKATO" />
+                <ScalarProperty Name="ISO3166_2" ColumnName="ISO3166_2" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="RegionCodes">
+            <EntityTypeMapping TypeName="SASModel.RegionCode">
+              <MappingFragment StoreEntitySet="RegionCode">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Region" ColumnName="Region" />
+                <ScalarProperty Name="Code" ColumnName="Code" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Roles">
+            <EntityTypeMapping TypeName="SASModel.Role">
+              <MappingFragment StoreEntitySet="Role">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="sysdiagrams">
+            <EntityTypeMapping TypeName="SASModel.sysdiagram">
+              <MappingFragment StoreEntitySet="sysdiagrams">
+                <ScalarProperty Name="name" ColumnName="name" />
+                <ScalarProperty Name="principal_id" ColumnName="principal_id" />
+                <ScalarProperty Name="diagram_id" ColumnName="diagram_id" />
+                <ScalarProperty Name="version" ColumnName="version" />
+                <ScalarProperty Name="definition" ColumnName="definition" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Transports">
+            <EntityTypeMapping TypeName="SASModel.Transport">
+              <MappingFragment StoreEntitySet="Transport">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Region" ColumnName="Region" />
+                <ScalarProperty Name="VIN" ColumnName="VIN" />
+                <ScalarProperty Name="Category" ColumnName="Category" />
+                <ScalarProperty Name="Color" ColumnName="Color" />
+                <ScalarProperty Name="EngineType" ColumnName="EngineType" />
+                <ScalarProperty Name="Model" ColumnName="Model" />
+                <ScalarProperty Name="RelaseYear" ColumnName="RelaseYear" />
+                <ScalarProperty Name="WeightKg" ColumnName="WeightKg" />
+                <ScalarProperty Name="DriveType" ColumnName="DriveType" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="TransportOwnerships">
+            <EntityTypeMapping TypeName="SASModel.TransportOwnership">
+              <MappingFragment StoreEntitySet="TransportOwnership">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Citizen" ColumnName="Citizen" />
+                <ScalarProperty Name="Transport" ColumnName="Transport" />
+                <ScalarProperty Name="CreatedAt" ColumnName="CreatedAt" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="TransportPhotoes">
+            <EntityTypeMapping TypeName="SASModel.TransportPhoto">
+              <MappingFragment StoreEntitySet="TransportPhoto">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Transport" ColumnName="Transport" />
+                <ScalarProperty Name="Photo" ColumnName="Photo" />
+              </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="true" />
+        <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>

+ 58 - 0
src/SASDesktop/Models/SAS.edmx.diagram

@@ -0,0 +1,58 @@
+<?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="1f6f85ac8f334744839f5692e202b3a8" Name="Diagram1">
+        <EntityTypeShape EntityType="SASModel.Brand" Width="1.5" PointX="1.5" PointY="27.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Category" Width="1.5" PointX="0.75" PointY="6.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Citizen" Width="1.5" PointX="1.5" PointY="9.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Color" Width="1.5" PointX="3.75" PointY="10.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Company" Width="1.5" PointX="1.5" PointY="24.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.DivisionGIBDD" Width="1.5" PointX="5.75" PointY="12.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.DriveType" Width="1.5" PointX="3.75" PointY="13.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Employee" Width="1.5" PointX="8" PointY="11.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.EngineType" Width="1.5" PointX="3.75" PointY="16" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Extension" Width="1.5" PointX="1.5" PointY="18.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.File" Width="1.5" PointX="1.5" PointY="15.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Job" Width="1.5" PointX="1.5" PointY="21.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.License" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.LicenseCategory" Width="1.5" PointX="3" PointY="6" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.LoginAttempt" Width="1.5" PointX="10.25" PointY="11" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.LoginBlock" Width="1.5" PointX="10.25" PointY="13.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Model" Width="1.5" PointX="3.75" PointY="27.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Region" Width="1.5" PointX="3.75" PointY="21.25" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.RegionCode" Width="1.5" PointX="6" PointY="21.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Role" Width="1.5" PointX="5.75" PointY="2.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.sysdiagram" Width="1.5" PointX="2.75" PointY="2.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.Transport" Width="1.5" PointX="6" PointY="4.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.TransportOwnership" Width="1.5" PointX="8.25" PointY="6" IsExpanded="true" />
+        <EntityTypeShape EntityType="SASModel.TransportPhoto" Width="1.5" PointX="8.25" PointY="3" IsExpanded="true" />
+        <AssociationConnector Association="SASModel.FK_Model_Brand" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_LicenseCategory_Category" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_Category" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Citizen_File" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Citizen_Job" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_License_License" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_TransportOwnership_Citizen" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_Color" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Job_Company" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Employee_DivisionGIBDD" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_DriveType" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Employee_Role" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_LoginAttempt_Employee" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_LoginBlock_Employee" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_EngineType" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_File_Extension" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_TransportPhoto_File" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_LicenseCategory_License" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_Model" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_RegionCode_Region" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_Transport_Region" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_TransportOwnership_Transport" ManuallyRouted="false" />
+        <AssociationConnector Association="SASModel.FK_TransportPhoto_Transport" ManuallyRouted="false" />
+      </Diagram>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 733 - 0
src/SASDesktop/Models/SAS.tt

@@ -0,0 +1,733 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@ 
+ output extension=".cs"#><#
+
+const string inputFile = @"SAS.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);
+    }
+}
+#>

+ 46 - 0
src/SASDesktop/Models/Transport.cs

@@ -0,0 +1,46 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Transport
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Transport()
+        {
+            this.TransportOwnerships = new HashSet<TransportOwnership>();
+            this.TransportPhotoes = new HashSet<TransportPhoto>();
+        }
+    
+        public int ID { get; set; }
+        public int Region { get; set; }
+        public string VIN { get; set; }
+        public int Category { get; set; }
+        public int Color { get; set; }
+        public int EngineType { get; set; }
+        public int Model { get; set; }
+        public System.DateTime RelaseYear { get; set; }
+        public int WeightKg { get; set; }
+        public int DriveType { get; set; }
+    
+        public virtual Category Category1 { get; set; }
+        public virtual Color Color1 { get; set; }
+        public virtual DriveType DriveType1 { get; set; }
+        public virtual EngineType EngineType1 { get; set; }
+        public virtual Model Model1 { get; set; }
+        public virtual Region Region1 { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<TransportOwnership> TransportOwnerships { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<TransportPhoto> TransportPhotoes { get; set; }
+    }
+}

+ 25 - 0
src/SASDesktop/Models/TransportOwnership.cs

@@ -0,0 +1,25 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class TransportOwnership
+    {
+        public int ID { get; set; }
+        public int Citizen { get; set; }
+        public int Transport { get; set; }
+        public System.DateTime CreatedAt { get; set; }
+    
+        public virtual Citizen Citizen1 { get; set; }
+        public virtual Transport Transport1 { get; set; }
+    }
+}

+ 24 - 0
src/SASDesktop/Models/TransportPhoto.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class TransportPhoto
+    {
+        public int ID { get; set; }
+        public int Transport { get; set; }
+        public int Photo { get; set; }
+    
+        public virtual File File { get; set; }
+        public virtual Transport Transport1 { get; set; }
+    }
+}

+ 23 - 0
src/SASDesktop/Models/sysdiagram.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SASDesktop.Models
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class sysdiagram
+    {
+        public string name { get; set; }
+        public int principal_id { get; set; }
+        public int diagram_id { get; set; }
+        public Nullable<int> version { get; set; }
+        public byte[] definition { get; set; }
+    }
+}

+ 4 - 3
src/SASDesktop/Navigation.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Controls;
 using Prism.Commands;
 
 namespace SASDesktop
@@ -30,9 +31,9 @@ namespace SASDesktop
         /// <summary>
         /// Переводит на главную страницу приложения
         /// </summary>
-        public static void ToWelcome()
+        public static void ToPortal()
         {
-            throw new NotImplementedException();
+            GetMainFrame().Navigate(new Views.Portal());
         }
         
         /// <summary>
@@ -40,7 +41,7 @@ namespace SASDesktop
         /// </summary>
         public static void ToDriverCreateExecuted()
         {
-            throw new NotImplementedException();
+            GetMainFrame().Navigate(new Views.Drivers.Create());
         }
         
         /// <summary>

+ 140 - 0
src/SASDesktop/SASDesktop.csproj

@@ -35,6 +35,12 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\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.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
     <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
     </Reference>
@@ -57,11 +63,14 @@
       <HintPath>..\packages\Prism.Wpf.9.0.537\lib\net47\Prism.Wpf.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Data" />
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
     <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
     </Reference>
@@ -83,11 +92,105 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="AuthState.cs" />
+    <Compile Include="Models\Brand.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Category.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Citizen.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Color.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Company.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\DivisionGIBDD.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\DriveType.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Employee.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\EngineType.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Extension.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\File.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Job.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\License.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\LicenseCategory.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\LoginAttempt.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\LoginBlock.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Model.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Region.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\RegionCode.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Role.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\SAS.Context.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>SAS.Context.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\SAS.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\SAS.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>SAS.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="Models\sysdiagram.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\Transport.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\TransportOwnership.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Models\TransportPhoto.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
     <Compile Include="Navigation.cs" />
     <Compile Include="ViewModels\Auth.cs" />
+    <Compile Include="ViewModels\Drivers\Create.cs" />
+    <Compile Include="ViewModels\Portal.cs" />
     <Compile Include="Views\Auth.xaml.cs">
       <DependentUpon>Auth.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Drivers\Create.xaml.cs">
+      <DependentUpon>Create.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Portal.cs" />
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -100,6 +203,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Styles\Cards.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\Forms.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -112,6 +219,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Drivers\Create.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Portal.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">
@@ -131,6 +246,13 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EntityDeploy Include="Models\SAS.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>SAS.Designer.cs</LastGenOutput>
+    </EntityDeploy>
+    <None Include="Models\SAS.edmx.diagram">
+      <DependentUpon>SAS.edmx</DependentUpon>
+    </None>
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
@@ -143,5 +265,23 @@
   <ItemGroup>
     <Resource Include="Assets\logo.png" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="Models\SAS.Context.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>SAS.Context.cs</LastGenOutput>
+      <DependentUpon>SAS.edmx</DependentUpon>
+    </Content>
+    <Content Include="Models\SAS.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>SAS.edmx</DependentUpon>
+      <LastGenOutput>SAS.cs</LastGenOutput>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Views\Transport\" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 18 - 0
src/SASDesktop/Styles/Cards.xaml

@@ -0,0 +1,18 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    
+    <Style x:Key="Card" TargetType="Border">
+        <Setter Property="Margin" Value="8"/>
+        <Setter Property="BorderBrush" Value="Black"/>
+        <Setter Property="BorderThickness" Value="1"/>
+    </Style>
+
+    <Style x:Key="CardInner" TargetType="StackPanel">
+        <Setter Property="Orientation" Value="Vertical"/>
+        <Setter Property="Margin" Value="8"/>
+    </Style>
+
+    <Style x:Key="CardButton" TargetType="Button">
+        <Setter Property="Margin" Value="0,4"/>
+    </Style>
+</ResourceDictionary>

+ 8 - 0
src/SASDesktop/Styles/Typography.xaml

@@ -18,4 +18,12 @@
     <Style x:Key="H6" TargetType="TextBlock">
         <Setter Property="FontSize" Value="12"/>
     </Style>
+
+    <Style x:Key="RequiredMark" TargetType="Label">
+        <Setter Property="Content" Value="* Обязательно"/>
+        <Setter Property="FontStyle" Value="Italic"/>
+        <Setter Property="FontSize" Value="8"/>
+        <Setter Property="Foreground" Value="Red"/>
+        <Setter Property="Padding" Value="0"/>
+    </Style>
 </ResourceDictionary>

+ 44 - 1
src/SASDesktop/ViewModels/Auth.cs

@@ -5,6 +5,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Prism.Mvvm;
 using Prism.Commands;
+using System.Windows;
 
 namespace SASDesktop.ViewModels
 {
@@ -17,6 +18,36 @@ namespace SASDesktop.ViewModels
         public DelegateCommand LoginCmd { get; set; }
         #endregion
 
+        #region Свойства
+        private string _login;
+        private string _password;
+
+        /// <summary>
+        /// Логин
+        /// </summary>
+        public string Login
+        {
+            get { return _login; }
+            set 
+            { 
+                _login = value;
+                RaisePropertyChanged(nameof(Login)); 
+            }
+        }
+        /// <summary>
+        /// Пароль
+        /// </summary>
+        public string Password
+        {
+            get { return _password; }
+            set 
+            { 
+                _password = value;
+                RaisePropertyChanged(nameof(Password));
+            }
+        }
+        #endregion
+
         public Auth()
         {
             LoginCmd = new DelegateCommand(LoginExecuted);
@@ -24,7 +55,19 @@ namespace SASDesktop.ViewModels
 
         private void LoginExecuted()
         {
-            throw new NotImplementedException();
+            // Пытаемся войти в приложение
+            var db = new Models.SASEntities();
+            var result = db.Employees.FirstOrDefault(e => e.Login == _login && e.Password == _password);
+            /* Раскомментировать, когда данные будут импортированы
+            if (result == null)
+            {
+                MessageBox.Show("Логин или пароль не совпадают");
+                Login = "";
+                Password = "";
+                return;
+            }
+            */
+            Navigation.ToPortal();
         }
     }
 }

+ 35 - 0
src/SASDesktop/ViewModels/Drivers/Create.cs

@@ -0,0 +1,35 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SASDesktop.ViewModels.Drivers
+{
+    class Create : BindableBase
+    {
+        #region Свойства
+        public string Name { get; set; }
+        public string Surname { get; set; }
+        public string Patron { get; set; }
+        public string PassSeries { get; set; }
+        public string PassNumber { get; set; }
+        public string AddrRegistration { get; set; }
+        public string AddrLiving { get; set; }
+        public string Company { get; set; }
+        public string JobPosition { get; set; }
+        public string Phone { get; set; }
+        public string EmailAddr { get; set; }
+        public DelegateCommand ChoosePhotoCmd { get; set; }
+        public DelegateCommand CancelCmd { get; set; }
+        public DelegateCommand SubmitCmd { get; set; }
+        #endregion
+
+        public Create()
+        {
+
+        }
+    }
+}

+ 1 - 1
src/SASDesktop/ViewModels/Portal.cs

@@ -13,7 +13,7 @@ namespace SASDesktop.ViewModels
         #region Команды
         #endregion
 
-        public Auth()
+        public Portal()
         {
         }
     }

+ 8 - 4
src/SASDesktop/Views/Auth.xaml

@@ -3,7 +3,7 @@
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-      xmlns:local="clr-namespace:SASDesktop.Views"
+      xmlns:local="clr-namespace:SASDesktop.Views" xmlns:viewmodels="clr-namespace:SASDesktop.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:Auth}"
       mc:Ignorable="d" 
       d:DesignHeight="600" d:DesignWidth="800"
       Title="Auth">
@@ -35,26 +35,30 @@
             <TextBlock
                 Grid.Row="0"
                 Grid.Column="1"
-                Style="{StaticResource H3}"
+                Style="{StaticResource H4}"
                 Text="Логин"/>
             <TextBox
                 Margin="0,4"
                 Grid.Column="1"
+                VerticalContentAlignment="Center"
+                Text="{Binding Login}"
                 Grid.Row="1"/>
 
             <TextBlock
                 Grid.Row="2"
                 Grid.Column="1"
-                Style="{StaticResource H3}"
+                Style="{StaticResource H4}"
                 Text="Пароль"/>
             <TextBox
                 Margin="0,4"
                 Grid.Column="1"
+                VerticalContentAlignment="Center"
+                Text="{Binding Password}"
                 Grid.Row="3"/>
 
             <Button
                 Margin="0,4"
-                Grid.ColumnSpan="2"
+                Grid.Column="1"
                 Grid.Row="4"
                 Content="Вход"
                 Command="{Binding LoginCmd}"/>

+ 277 - 0
src/SASDesktop/Views/Drivers/Create.xaml

@@ -0,0 +1,277 @@
+<Page x:Class="SASDesktop.Views.Drivers.Create"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:SASDesktop.Views.Drivers" xmlns:drivers="clr-namespace:SASDesktop.ViewModels.Drivers" d:DataContext="{d:DesignInstance Type=drivers:Create}"
+      mc:Ignorable="d" 
+      d:DesignHeight="600" d:DesignWidth="800"
+      Title="Create">
+    <!--Страница создания водителя-->
+    <ScrollViewer>
+    <StackPanel
+        CanVerticallyScroll="True"
+        Style="{StaticResource FormContainer}">
+        <TextBlock 
+            HorizontalAlignment="Center"
+            Style="{StaticResource H2}"
+            Text="Создание водителя"/>
+        <StackPanel Orientation="Vertical">
+
+            <!--ФИО-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+
+                <!--Фамилия-->
+                <StackPanel 
+                    Grid.Column="0"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Фамилия"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding Surname}"/>
+                </StackPanel>
+
+                <!--Имя-->
+                <StackPanel 
+                    Grid.Column="1"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Имя"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding Name}"/>
+                </StackPanel>
+
+                <!--Отчество-->
+                <StackPanel 
+                    Grid.Column="2"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Отчество"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding Patron}"/>
+                </StackPanel>
+            </Grid>
+
+            <!--Паспорт-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+
+                <!--Серия-->
+                <StackPanel 
+                    Grid.Column="0"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Серия паспорта"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding PassSeries}"/>
+                </StackPanel>
+
+                <!--Номер-->
+                <StackPanel 
+                    Grid.Column="1"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Номер паспорта"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding PassNumber}"/>
+                </StackPanel>
+            </Grid>
+
+            <!--Адреса-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+
+                <!--Адрес регистрации-->
+                <StackPanel 
+                    Grid.Column="0"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Адрес регистрации"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding AddrRegistration}"/>
+                </StackPanel>
+
+                <!--Адрес проживания-->
+                <StackPanel 
+                    Grid.Column="1"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Адрес проживания"/>
+                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding AddrLiving}"/>
+                </StackPanel>
+            </Grid>
+
+            <!--Работа-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+
+                <!--Место работы-->
+                <StackPanel 
+                    Grid.Column="0"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Место работы"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding Company}"/>
+                </StackPanel>
+
+                <!--Должность-->
+                <StackPanel 
+                    Grid.Column="1"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Должность"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding JobPosition}"/>
+                </StackPanel>
+            </Grid>
+
+            <!--Контакты-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+
+                <!--Телефон-->
+                <StackPanel 
+                    Grid.Column="0"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Телефон"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding Phone}"/>
+                </StackPanel>
+
+                <!--Адрес email-->
+                <StackPanel 
+                    Grid.Column="1"
+                    Margin="4">
+
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Адрес email"/>
+                    </StackPanel>
+
+                    <TextBox
+                        Margin="0,4"
+                        VerticalContentAlignment="Center"
+                        Text="{Binding EmailAddr}"/>
+                </StackPanel>
+            </Grid>
+
+            <!--Фотография-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="200"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="230"/>
+                    <RowDefinition Height="32"/>
+                </Grid.RowDefinitions>
+
+                <Border
+                    BorderBrush="Black"
+                    Grid.Column="0" 
+                    Margin="0,4"
+                    BorderThickness="1">
+                    <Image/>
+                </Border>
+                <Button 
+                    Content="Загрузить фото (3 на 4)" 
+                    Grid.Column="0" 
+                    Command="{Binding ChoosePhotoCmd}"
+                    Grid.Row="1"/>
+            </Grid>
+            
+            <!--Сохранить/отмена-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="128"/>
+                        <ColumnDefinition Width="128"/>
+                    </Grid.ColumnDefinitions>
+                    <Button 
+                        Grid.Column="1"
+                        Command="{Binding CancelCmd}"
+                        Margin="4">Отмена</Button>
+                    <Button 
+                        Grid.Column="2"
+                        Command="{Binding SubmitCmd}"
+                        Margin="4">Сохранить</Button>
+                </Grid>
+            </StackPanel>
+    </StackPanel>
+    </ScrollViewer>
+</Page>

+ 29 - 0
src/SASDesktop/Views/Drivers/Create.xaml.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace SASDesktop.Views.Drivers
+{
+    /// <summary>
+    /// Логика взаимодействия для Create.xaml
+    /// </summary>
+    public partial class Create : Page
+    {
+        public Create()
+        {
+            InitializeComponent();
+            DataContext = new ViewModels.Drivers.Create();
+        }
+    }
+}

+ 31 - 27
src/SASDesktop/Views/Portal.xaml

@@ -6,7 +6,7 @@
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:local="clr-namespace:SASDesktop.Views"
       mc:Ignorable="d" 
-      d:DesignHeight="600" d:DesignWidth="800"
+      d:DesignHeight="600" d:DesignWidth="791"
       Title="Portal">
     <!--Страница портала функциональности-->
     <StackPanel Style="{StaticResource FormContainer}">
@@ -21,34 +21,38 @@
             Orientation="Horizontal">
 
             <!--Водители-->
-            <StackPanel Orientation="Vertical">
-                <TextBlock
-                    Style="{StaticResource H3}"
-                    Text="Водители"/>
-                <Button
-                    Content="Создать"
-                    Command="{Binding Source={x:Static root:Navigation.ToDriverCreate}}"
-                    Margin="0,4"/>
-                <Button
-                    Content="Просмотр списка"
-                    Command="{Binding Source={x:Static root:Navigation.ToDriverList}}"
-                    Margin="0,4"/>
-            </StackPanel>
+            <Border Style="{StaticResource Card}">
+                <StackPanel Style="{StaticResource CardInner}">
+                    <TextBlock
+                        Style="{StaticResource H3}"
+                        Text="Водители"/>
+                    <Button
+                        Content="Создать"
+                        Style="{StaticResource CardButton}"
+                        Command="{Binding Source={x:Static root:Navigation.ToDriverCreate}}"/>
+                    <Button
+                        Content="Просмотр списка"
+                        Style="{StaticResource CardButton}"
+                        Command="{Binding Source={x:Static root:Navigation.ToDriverList}}"/>
+                </StackPanel>
+            </Border>
             
             <!--Транспортные средства-->
-            <StackPanel Orientation="Vertical">
-                <TextBlock
-                    Style="{StaticResource H3}"
-                    Text="Транспортные средства"/>
-                <Button
-                    Content="Создать"
-                    Command="{Binding Source={x:Static root:Navigation.ToTransportCreate}}"
-                    Margin="0,4"/>
-                <Button
-                    Content="Просмотр списка"
-                    Command="{Binding Source={x:Static root:Navigation.ToTransportList}}"
-                    Margin="0,4"/>
-            </StackPanel>
+            <Border Style="{StaticResource Card}">
+                <StackPanel Style="{StaticResource CardInner}">
+                    <TextBlock
+                        Style="{StaticResource H3}"
+                        Text="Транспортные средства"/>
+                    <Button
+                        Content="Создать"
+                        Command="{Binding Source={x:Static root:Navigation.ToTransportCreate}}"
+                        Margin="0,4"/>
+                    <Button
+                        Content="Просмотр списка"
+                        Command="{Binding Source={x:Static root:Navigation.ToTransportList}}"
+                        Margin="0,4"/>
+                </StackPanel>
+            </Border>
             
         </WrapPanel>
     </StackPanel>

+ 2 - 0
src/SASDesktop/packages.config

@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="EntityFramework" version="6.2.0" targetFramework="net481" />
+  <package id="EntityFramework.ru" version="6.2.0" targetFramework="net481" />
   <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net481" />
   <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.1" targetFramework="net481" />
   <package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.122" targetFramework="net481" />

+ 2 - 0
src/dataimport/.gitignore

@@ -0,0 +1,2 @@
+bin/*
+obj/*