瀏覽代碼

Merge branch 'transport-polish'

Вадим Королёв 5 月之前
父節點
當前提交
3253cb4f4c

+ 7 - 7
src/SASDesktop/App.config

@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <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"/>
+    <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"/>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
   </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"/>
+    <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;application name=EntityFramework;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>
-        <parameter value="mssqllocaldb"/>
+        <parameter value="mssqllocaldb" />
       </parameters>
     </defaultConnectionFactory>
     <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
-</configuration>
+</configuration>

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

@@ -18,7 +18,6 @@ namespace SASDesktop.Models
         public Category()
         {
             this.LicenseCategories = new HashSet<LicenseCategory>();
-            this.Transports = new HashSet<Transport>();
         }
     
         public int ID { get; set; }
@@ -26,7 +25,5 @@ namespace SASDesktop.Models
     
         [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; }
     }
 }

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

@@ -36,6 +36,7 @@ namespace SASDesktop.Models
         public string CurrentAddress { get; set; }
         public string Comment { get; set; }
         public string Discription { get; set; }
+        public Nullable<System.DateTime> DateOfBirth { get; set; }
     
         public virtual File File { get; set; }
         public virtual Job Job1 { get; set; }

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

@@ -14,12 +14,6 @@ namespace SASDesktop.Models
     
     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; }
@@ -27,8 +21,5 @@ namespace SASDesktop.Models
         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; }
     }
 }

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

@@ -14,16 +14,7 @@ namespace SASDesktop.Models
     
     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; }
     }
 }

+ 26 - 0
src/SASDesktop/Models/EngineModel.cs

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

+ 5 - 5
src/SASDesktop/Models/EngineType.cs → src/SASDesktop/Models/FuelType.cs

@@ -12,19 +12,19 @@ namespace SASDesktop.Models
     using System;
     using System.Collections.Generic;
     
-    public partial class EngineType
+    public partial class FuelType
     {
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
-        public EngineType()
+        public FuelType()
         {
-            this.Transports = new HashSet<Transport>();
+            this.EngineModels = new HashSet<EngineModel>();
         }
     
         public int ID { get; set; }
-        public string NameRus { get; set; }
         public string NameEng { get; set; }
+        public string NameRus { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<Transport> Transports { get; set; }
+        public virtual ICollection<EngineModel> EngineModels { get; set; }
     }
 }

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

@@ -14,18 +14,10 @@ namespace SASDesktop.Models
     
     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; }
     }
 }

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

@@ -18,7 +18,6 @@ namespace SASDesktop.Models
         public Region()
         {
             this.RegionCodes = new HashSet<RegionCode>();
-            this.Transports = new HashSet<Transport>();
         }
     
         public int ID { get; set; }
@@ -30,7 +29,5 @@ namespace SASDesktop.Models
     
         [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; }
     }
 }

+ 3 - 1
src/SASDesktop/Models/SAS.Context.cs

@@ -33,9 +33,10 @@ namespace SASDesktop.Models
         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<EngineModel> EngineModels { get; set; }
         public virtual DbSet<Extension> Extensions { get; set; }
         public virtual DbSet<File> Files { get; set; }
+        public virtual DbSet<FuelType> FuelTypes { get; set; }
         public virtual DbSet<Job> Jobs { get; set; }
         public virtual DbSet<License> Licenses { get; set; }
         public virtual DbSet<LicenseCategory> LicenseCategories { get; set; }
@@ -49,5 +50,6 @@ namespace SASDesktop.Models
         public virtual DbSet<Transport> Transports { get; set; }
         public virtual DbSet<TransportOwnership> TransportOwnerships { get; set; }
         public virtual DbSet<TransportPhoto> TransportPhotoes { get; set; }
+        public virtual DbSet<TransportType> TransportTypes { get; set; }
     }
 }

+ 1 - 1
src/SASDesktop/Models/SAS.Designer.cs

@@ -1,4 +1,4 @@
-// Создание кода T4 для модели "C:\Users\klass\OneDrive\Рабочий стол\Тех\4ИС\Практика\ПМ 07\SAS\SAS\src\SASDesktop\Models\SAS.edmx" включено. 
+// Создание кода T4 для модели "C:\Users\user\source\SAS\src\SASDesktop\Models\SAS.edmx" включено. 
 // Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
 // на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
 // открыта в конструкторе.

File diff suppressed because it is too large
+ 292 - 411
src/SASDesktop/Models/SAS.edmx


+ 45 - 48
src/SASDesktop/Models/SAS.edmx.diagram

@@ -4,54 +4,51 @@
   <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 DiagramId="1f6f85ac8f334744839f5692e202b3a8" Name="Diagram1" ZoomLevel="74">
+        <EntityTypeShape EntityType="SASModel.Brand" Width="1.5" PointX="7.75" PointY="6.375" />
+        <EntityTypeShape EntityType="SASModel.Category" Width="1.5" PointX="7.5" PointY="16.25" />
+        <EntityTypeShape EntityType="SASModel.Citizen" Width="1.5" PointX="5.25" PointY="8.75" />
+        <EntityTypeShape EntityType="SASModel.Color" Width="1.5" PointX="0.75" PointY="13.125" />
+        <EntityTypeShape EntityType="SASModel.Company" Width="1.5" PointX="0.75" PointY="10.375" />
+        <EntityTypeShape EntityType="SASModel.DivisionGIBDD" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="SASModel.DriveType" Width="1.5" PointX="12.75" PointY="2.125" />
+        <EntityTypeShape EntityType="SASModel.Employee" Width="1.5" PointX="3" PointY="2.875" />
+        <EntityTypeShape EntityType="SASModel.EngineModel" Width="1.5" PointX="14" PointY="13.25" />
+        <EntityTypeShape EntityType="SASModel.Extension" Width="1.5" PointX="0.75" PointY="7.375" />
+        <EntityTypeShape EntityType="SASModel.File" Width="1.5" PointX="3" PointY="7" />
+        <EntityTypeShape EntityType="SASModel.FuelType" Width="1.5" PointX="11.75" PointY="13.625" />
+        <EntityTypeShape EntityType="SASModel.Job" Width="1.5" PointX="3" PointY="10.25" />
+        <EntityTypeShape EntityType="SASModel.License" Width="1.5" PointX="7.5" PointY="12.875" />
+        <EntityTypeShape EntityType="SASModel.LicenseCategory" Width="1.5" PointX="9.75" PointY="13.125" />
+        <EntityTypeShape EntityType="SASModel.LoginAttempt" Width="1.5" PointX="5.25" PointY="2.375" />
+        <EntityTypeShape EntityType="SASModel.LoginBlock" Width="1.5" PointX="5.25" PointY="4.875" />
+        <EntityTypeShape EntityType="SASModel.Model" Width="1.5" PointX="10" PointY="6.25" />
+        <EntityTypeShape EntityType="SASModel.Region" Width="1.5" PointX="7.75" PointY="2.25" />
+        <EntityTypeShape EntityType="SASModel.RegionCode" Width="1.5" PointX="10" PointY="2.625" />
+        <EntityTypeShape EntityType="SASModel.Role" Width="1.5" PointX="0.75" PointY="3.75" />
+        <EntityTypeShape EntityType="SASModel.sysdiagram" Width="1.5" PointX="12.75" PointY="5.125" />
+        <EntityTypeShape EntityType="SASModel.Transport" Width="1.5" PointX="5.25" PointY="15.125" />
+        <EntityTypeShape EntityType="SASModel.TransportOwnership" Width="1.5" PointX="7.5" PointY="9.125" />
+        <EntityTypeShape EntityType="SASModel.TransportPhoto" Width="1.5" PointX="10.5" PointY="10.125" />
+        <EntityTypeShape EntityType="SASModel.TransportType" Width="1.5" PointX="12.75" PointY="8.125" />
+        <AssociationConnector Association="SASModel.FK_Model_Brand" />
+        <AssociationConnector Association="SASModel.FK_LicenseCategory_Category" />
+        <AssociationConnector Association="SASModel.FK_Citizen_File" />
+        <AssociationConnector Association="SASModel.FK_Citizen_Job" />
+        <AssociationConnector Association="SASModel.FK_License_License" />
+        <AssociationConnector Association="SASModel.FK_TransportOwnership_Citizen" />
+        <AssociationConnector Association="SASModel.FK_Job_Company" />
+        <AssociationConnector Association="SASModel.FK_Employee_DivisionGIBDD" />
+        <AssociationConnector Association="SASModel.FK_Employee_Role" />
+        <AssociationConnector Association="SASModel.FK_LoginAttempt_Employee" />
+        <AssociationConnector Association="SASModel.FK_LoginBlock_Employee" />
+        <AssociationConnector Association="SASModel.FK_EngineType_FuelType" />
+        <AssociationConnector Association="SASModel.FK_File_Extension" />
+        <AssociationConnector Association="SASModel.FK_TransportPhoto_File" />
+        <AssociationConnector Association="SASModel.FK_LicenseCategory_License" />
+        <AssociationConnector Association="SASModel.FK_RegionCode_Region" />
+        <AssociationConnector Association="SASModel.FK_TransportOwnership_Transport" />
+        <AssociationConnector Association="SASModel.FK_TransportPhoto_Transport" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 8 - 10
src/SASDesktop/Models/Transport.cs

@@ -22,22 +22,20 @@ namespace SASDesktop.Models
         }
     
         public int ID { get; set; }
-        public int Region { get; set; }
+        public Nullable<int> Region { get; set; }
         public string VIN { get; set; }
-        public int Category { get; set; }
+        public Nullable<int> Category { get; set; }
         public int Color { get; set; }
-        public int EngineType { get; set; }
+        public int EngineModel { get; set; }
         public int Model { get; set; }
-        public System.DateTime RelaseYear { get; set; }
+        public int RelaseYear { get; set; }
         public int WeightKg { get; set; }
         public int DriveType { get; set; }
+        public Nullable<int> TransportType { get; set; }
+        public string Comment { get; set; }
+        public string EngineNumber { get; set; }
+        public Nullable<int> MaxLoadKg { 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")]

+ 21 - 0
src/SASDesktop/Models/TransportType.cs

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

+ 7 - 1
src/SASDesktop/SASDesktop.csproj

@@ -121,7 +121,7 @@
     <Compile Include="Models\Employee.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
-    <Compile Include="Models\EngineType.cs">
+    <Compile Include="Models\EngineModel.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
     <Compile Include="Models\Extension.cs">
@@ -130,6 +130,9 @@
     <Compile Include="Models\File.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
+    <Compile Include="Models\FuelType.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
     <Compile Include="Models\Job.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
@@ -185,6 +188,9 @@
     <Compile Include="Models\TransportPhoto.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
+    <Compile Include="Models\TransportType.cs">
+      <DependentUpon>SAS.tt</DependentUpon>
+    </Compile>
     <Compile Include="Navigation.cs" />
     <Compile Include="Popups.cs" />
     <Compile Include="ViewModels\Auth.cs" />

+ 125 - 6
src/SASDesktop/ViewModels/Transport/Create.cs

@@ -292,16 +292,83 @@ namespace SASDesktop.ViewModels.Transport
         public string MaxLoad { get; set; }
         #endregion
 
-        #region Тип двигателя
-        public Models.EngineType SelectedEngineType { get; set; }
-        public List<Models.EngineType> AllEngineTypes { get; set; }
+        #region Модель двигателя
+        // Выбранное значение
+        private Models.EngineModel _selectedEngineModel;
+        public Models.EngineModel SelectedEngineModel
+        {
+            get { return _selectedEngineModel; }
+            set
+            {
+                _selectedEngineModel = value;
+                RaisePropertyChanged(nameof(SelectedEngineModel));
+                RaisePropertyChanged(nameof(EngineModelIsSelected));
+            }
+        }
+        // Предлагаемые производители
+        private List<Models.EngineModel> _suggestedEngineModels;
+        public List<Models.EngineModel> SuggestedEngineModels
+        {
+            get { return _suggestedEngineModels; }
+            set { _suggestedEngineModels = value; RaisePropertyChanged(nameof(SuggestedEngineModels)); }
+        }
+        // Поиск производителя по имени
+        private string _engineModelSearch;
+        public string EngineModelSearch
+        {
+            get => _engineModelSearch;
+            set
+            {
+                _engineModelSearch = value;
+                // При наборе текста сбрасываем выбранное значение
+                SelectedEngineModel = null;
+                if (EngineModelSuggestionsVisible)
+                {
+                    UpdateEngineModelSuggestions();
+                }
+                RaisePropertyChanged(nameof(EngineModelSearch));
+            }
+        }
+        // Должны ли быть видны подсказки?
+        private bool _engineModelSuggestionsVisible;
+        public bool EngineModelSuggestionsVisible
+        {
+            get { return _engineModelSuggestionsVisible; }
+            set
+            {
+                _engineModelSuggestionsVisible = value;
+                if (value == true)
+                {
+                    UpdateEngineModelSuggestions();
+                }
+                RaisePropertyChanged(nameof(EngineModelSuggestionsVisible));
+            }
+        }
+        public bool EngineModelIsSelected
+        {
+            get
+            {
+                return _selectedEngineModel != null;
+            }
+            set { }
+        }
         #endregion
 
+
         #region Тип привода
         public Models.DriveType SelectedDrive { get; set; }
         public List<Models.DriveType> AllDriveTypes { get; set; }
         #endregion
 
+        #region Тип ТС
+        public Models.TransportType SelectedTransportType { get; set; }
+        public List<Models.TransportType> AllTransportTypes { get; set; }
+        #endregion
+
+        #region Комментарий
+        public string Comment { get; set; }
+        #endregion
+
         public DelegateCommand CancelCmd { get; set; }
         public DelegateCommand SubmitCmd { get; set; }
 
@@ -312,14 +379,15 @@ namespace SASDesktop.ViewModels.Transport
             _selectedBrand = null;
             _selectedModel = null;
             SelectedCategory = null;
-            SelectedEngineType = null;
+            SelectedEngineModel = null;
             SelectedDrive = null;
+            SelectedTransportType = null;
 
             _suggestedBrands = new List<Models.Brand>();
             _suggestedModels = new List<Models.Model>();
             AllCategories = new List<Models.Category>(db.Categories);
-            AllEngineTypes = new List<Models.EngineType>(db.EngineTypes);
             AllDriveTypes = new List<Models.DriveType>(db.DriveTypes);
+            AllTransportTypes = new List<Models.TransportType>(db.TransportTypes);
 
             CancelCmd = new DelegateCommand(CancelExecuted);
             SubmitCmd = new DelegateCommand(SubmitExecuted);
@@ -416,6 +484,26 @@ namespace SASDesktop.ViewModels.Transport
             }
         }
 
+        /// <summary>
+        /// Обновляет подсказки моделей двигателей
+        /// </summary>
+        private void UpdateEngineModelSuggestions()
+        {
+            var db = new Models.SASEntities();
+            const int maxResults = 30;
+
+            if (string.IsNullOrWhiteSpace(_engineModelSearch))
+            {
+                SuggestedEngineModels = new List<Models.EngineModel>(db.EngineModels.Take(maxResults));
+            }
+            else
+            {
+                SuggestedEngineModels = new List<Models.EngineModel>(
+                    db.EngineModels.Where(em => em.Name.ToLower().Contains(_engineModelSearch.ToLower())).Take(maxResults)
+                );
+            }
+        }
+
         private void CancelExecuted()
         {
             if (Popups.Confirm("отменить создание"))
@@ -426,7 +514,38 @@ namespace SASDesktop.ViewModels.Transport
 
         private void SubmitExecuted()
         {
-            return;
+            // TODO: валидации и проверки
+
+            var db = new Models.SASEntities();
+
+            // 1. Создать транспортное средство
+            Models.Transport transport = new Models.Transport();
+            transport.VIN = VIN;
+            transport.TransportType = SelectedTransportType.ID;
+            transport.Category = SelectedCategory.ID;
+            transport.Model = SelectedModel.ID;
+            transport.Color = SelectedColor.ID;
+            transport.RelaseYear = int.Parse(ReleaseYear);
+            transport.DriveType = SelectedDrive.ID;
+            transport.MaxLoadKg = int.Parse(MaxLoad);
+            transport.EngineNumber = EngineNumber;
+            transport.EngineModel = SelectedEngineModel.ID;
+            transport.WeightKg = int.Parse(Weight);
+            transport.Comment = Comment;
+            
+            db.Transports.Add(transport);
+            db.SaveChanges();
+
+            // 2. Создать запись владельца
+            Models.TransportOwnership ownership = new Models.TransportOwnership();
+            ownership.Transport = transport.ID;
+            ownership.Citizen = SelectedOwner.ID;
+            ownership.CreatedAt = DateTime.Now;
+
+            db.TransportOwnerships.Add(ownership);
+            db.SaveChanges();
+            
+            Navigation.ToPortal();
         }
     }
 }

+ 158 - 123
src/SASDesktop/Views/Transport/Create.xaml

@@ -6,7 +6,7 @@
       xmlns:local="clr-namespace:SASDesktop.Views.Transport" xmlns:transport="clr-namespace:SASDesktop.ViewModels.Transport" d:DataContext="{d:DesignInstance Type=transport:Create}"
       xmlns:conv="clr-namespace:SASDesktop.Converters"
       mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800"
+      d:DesignHeight="600" d:DesignWidth="800"
       Title="Create">
     <Page.Resources>
         <conv:BooleanToFormFilled x:Key="btff"/>
@@ -38,52 +38,106 @@
                         Text="{Binding VIN}"/>
                 </StackPanel>
 
-                <!--Владелец-->
-                <StackPanel Margin="4">
-                    <!--Надпись-->
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Владелец"/>
-                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                <!--Основное о ТС-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                    </Grid.RowDefinitions>
+
+                    <!--Тип ТС-->
+                    <StackPanel Grid.Column="0" Grid.Row="0" Margin="4">
+                        <!--Надпись-->
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Тип транспортного средства"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+                        <!--Выпадающий список-->
+                        <ComboBox
+                            SelectedItem="{Binding SelectedTransportType}"
+                            ItemsSource="{Binding AllTransportTypes}">
+                            <ComboBox.ItemTemplate>
+                                <DataTemplate>
+                                    <TextBlock Text="{Binding NameRus}"/>
+                                </DataTemplate>
+                            </ComboBox.ItemTemplate>
+                        </ComboBox>
                     </StackPanel>
-                    <!--Поле ввода и автодополнение-->
-                    <StackPanel>
-                        <TextBox
-                            x:Name="tbOwner"
-                            GotFocus="tbOwner_GotFocus"
-                            LostFocus="tbOwner_LostFocus"
-                            Text="{Binding OwnerSearch,UpdateSourceTrigger=PropertyChanged}"/>
-                        <Popup
-                            IsOpen="{Binding OwnerSuggestionsVisible}"
-                            Placement="Bottom"
-                            Width="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.ActualWidth}"
-                            PlacementTarget="{Binding ElementName=tbOwner}">
-                            <ListBox
-                                x:Name="lbOwners"
-                                ItemsSource="{Binding SuggestedOwners}"
-                                SelectionChanged="lbOwners_SelectionChanged">
-                                <ListBox.ItemTemplate>
-                                    <DataTemplate>
-                                        <TextBlock Text="{Binding NameAndBirthdate}"/>
-                                    </DataTemplate>
-                                </ListBox.ItemTemplate>
-                            </ListBox>
-                        </Popup>
-                        <TextBlock
-                            Text="{Binding OwnerIsSelected,Converter={StaticResource btff}}"
-                            Foreground="{Binding OwnerIsSelected,Converter={StaticResource btfc}}"/>
+
+                    <!--Владелец-->
+                    <StackPanel Grid.Column="1" Grid.Row="0" Margin="4">
+                        <!--Надпись-->
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Владелец"/>
+                        </StackPanel>
+                        <!--Поле ввода и автодополнение-->
+                        <StackPanel>
+                            <TextBox
+                                x:Name="tbOwner"
+                                GotFocus="tbOwner_GotFocus"
+                                LostFocus="tbOwner_LostFocus"
+                                Text="{Binding OwnerSearch,UpdateSourceTrigger=PropertyChanged}"/>
+                            <Popup
+                                IsOpen="{Binding OwnerSuggestionsVisible}"
+                                Placement="Bottom"
+                                Width="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.ActualWidth}"
+                                PlacementTarget="{Binding ElementName=tbOwner}">
+                                <ListBox
+                                    x:Name="lbOwners"
+                                    ItemsSource="{Binding SuggestedOwners}"
+                                    SelectionChanged="lbOwners_SelectionChanged">
+                                    <ListBox.ItemTemplate>
+                                        <DataTemplate>
+                                            <TextBlock Text="{Binding NameAndBirthdate}"/>
+                                        </DataTemplate>
+                                    </ListBox.ItemTemplate>
+                                </ListBox>
+                            </Popup>
+                            <TextBlock
+                                Text="{Binding OwnerIsSelected,Converter={StaticResource btff}}"
+                                Foreground="{Binding OwnerIsSelected,Converter={StaticResource btfc}}"/>
+                        </StackPanel>
                     </StackPanel>
-                </StackPanel>
 
-                <!--Основное-->
+                    <!--Категория-->
+                    <StackPanel Grid.Column="2" Grid.Row="0" Margin="4">
+                        <!--Надпись-->
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Категория"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+                        <!--Выпадающий список-->
+                        <ComboBox
+                            SelectedItem="{Binding SelectedCategory}"
+                            ItemsSource="{Binding AllCategories}">
+                            <ComboBox.ItemTemplate>
+                                <DataTemplate>
+                                    <TextBlock Text="{Binding Name}"/>
+                                </DataTemplate>
+                            </ComboBox.ItemTemplate>
+                        </ComboBox>
+                    </StackPanel>
+                    
+                </Grid>
+
+                <!--Детали производства-->
                 <Grid>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"/>
                         <ColumnDefinition Width="*"/>
                         <ColumnDefinition Width="*"/>
                     </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="Auto"/>
+                    </Grid.RowDefinitions>
 
                     <!--Производитель-->
-                    <StackPanel Grid.Column="0" Margin="4">
+                    <StackPanel Grid.Column="0" Grid.Row="0" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
                             <TextBlock Style="{StaticResource H5}" Text="Производитель"/>
@@ -118,7 +172,7 @@
                     </StackPanel>
 
                     <!--Модель-->
-                    <StackPanel Grid.Column="1" Margin="4">
+                    <StackPanel Grid.Column="1" Grid.Row="0" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
                             <TextBlock Style="{StaticResource H5}" Text="Модель"/>
@@ -154,7 +208,7 @@
                     </StackPanel>
 
                     <!--Цвет-->
-                    <StackPanel Grid.Column="2" Margin="4">
+                    <StackPanel Grid.Column="2" Grid.Row="0" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
                             <TextBlock Style="{StaticResource H5}" Text="Цвет"/>
@@ -188,42 +242,31 @@
                                 Foreground="{Binding ColorIsSelected,Converter={StaticResource btfc}}"/>
                         </StackPanel>
                     </StackPanel>
-                </Grid>
 
-                <!--Привод и категория-->
-                <Grid>
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                    </Grid.ColumnDefinitions>
-                    <!--Привод-->
-                    <StackPanel Grid.Column="0" Margin="4">
+                    <!--Год выпуска-->
+                    <StackPanel Grid.Column="0" Grid.Row="1" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Тип привода"/>
+                            <TextBlock Style="{StaticResource H5}" Text="Год выпуска"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
                         </StackPanel>
-                        <!--Выпадающий список-->
-                        <ComboBox
-                            SelectedItem="{Binding SelectedDrive}"
-                            ItemsSource="{Binding AllDriveTypes}">
-                            <ComboBox.ItemTemplate>
-                                <DataTemplate>
-                                    <TextBlock Text="{Binding Name}"/>
-                                </DataTemplate>
-                            </ComboBox.ItemTemplate>
-                        </ComboBox>
+                        <!--Поле ввода-->
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding ReleaseYear}"/>
                     </StackPanel>
-                    <!--Категория-->
-                    <StackPanel Grid.Column="1" Margin="4">
+
+                    <!--Привод-->
+                    <StackPanel Grid.Column="1" Grid.Row="1" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Категория"/>
-                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                            <TextBlock Style="{StaticResource H5}" Text="Тип привода"/>
                         </StackPanel>
                         <!--Выпадающий список-->
                         <ComboBox
-                            SelectedItem="{Binding SelectedCategory}"
-                            ItemsSource="{Binding AllCategories}">
+                            SelectedItem="{Binding SelectedDrive}"
+                            ItemsSource="{Binding AllDriveTypes}">
                             <ComboBox.ItemTemplate>
                                 <DataTemplate>
                                     <TextBlock Text="{Binding Name}"/>
@@ -231,26 +274,18 @@
                             </ComboBox.ItemTemplate>
                         </ComboBox>
                     </StackPanel>
-                </Grid>
 
-                <!--Год выпуска и что то-->
-                <Grid>
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                    </Grid.ColumnDefinitions>
-                    <!--Год выпуска-->
-                    <StackPanel Grid.Column="0" Margin="4">
+                    <!--Максимальная нагрузка-->
+                    <StackPanel Grid.Column="2" Grid.Row="1" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Год выпуска"/>
-                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                            <TextBlock Style="{StaticResource H5}" Text="Максимальная нагрузка (в кг.)"/>
                         </StackPanel>
                         <!--Поле ввода-->
                         <TextBox
                             Margin="0,4"
                             VerticalContentAlignment="Center"
-                            Text="{Binding ReleaseYear}"/>
+                            Text="{Binding MaxLoad}"/>
                     </StackPanel>
                 </Grid>
 
@@ -259,10 +294,9 @@
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"/>
                         <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
                     </Grid.ColumnDefinitions>
-                    <!--Номер-->
+
+                    <!--Номер двигателя-->
                     <StackPanel Grid.Column="0" Margin="4">
                         <!--Надпись-->
                         <StackPanel Orientation="Horizontal">
@@ -274,6 +308,7 @@
                             VerticalContentAlignment="Center"
                             Text="{Binding EngineNumber}"/>
                     </StackPanel>
+
                     <!--Модель-->
                     <StackPanel Grid.Column="1" Margin="4">
                         <!--Надпись-->
@@ -281,52 +316,48 @@
                             <TextBlock Style="{StaticResource H5}" Text="Модель двигателя"/>
                         </StackPanel>
                         <!--Поле ввода-->
-                        <TextBox
-                            Margin="0,4"
-                            VerticalContentAlignment="Center"/>
-                    </StackPanel>
-                    <!--Год-->
-                    <StackPanel Grid.Column="2" Margin="4">
-                        <!--Надпись-->
-                        <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Год двигателя"/>
-                        </StackPanel>
-                        <!--Поле ввода-->
-                        <TextBox
-                            Margin="0,4"
-                            VerticalContentAlignment="Center"/>
-                    </StackPanel>
-                    <!--Тип-->
-                    <StackPanel Grid.Column="3" Margin="4">
-                        <!--Надпись-->
-                        <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Тип двигателя"/>
-                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        <StackPanel>
+                            <TextBox
+                                x:Name="tbEngineModel"
+                                GotFocus="tbEngineModel_GotFocus"
+                                LostFocus="tbEngineModel_LostFocus"
+                                Text="{Binding EngineModelSearch,UpdateSourceTrigger=PropertyChanged}"/>
+                            <Popup
+                                IsOpen="{Binding EngineModelSuggestionsVisible}"
+                                Placement="Bottom"
+                                Width="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.ActualWidth}"
+                                PlacementTarget="{Binding ElementName=tbEngineModel}">
+                                <ListBox
+                                    x:Name="lbEngineModelSuggestions"
+                                    ItemsSource="{Binding SuggestedEngineModels}"
+                                    SelectionChanged="lbEngineModelSuggestions_SelectionChanged">
+                                    <ListBox.ItemTemplate>
+                                        <DataTemplate>
+                                            <TextBlock Text="{Binding Name}"/>
+                                        </DataTemplate>
+                                    </ListBox.ItemTemplate>
+                                </ListBox>
+                            </Popup>
+                            <TextBlock
+                                Text="{Binding EngineModelIsSelected,Converter={StaticResource btff}}"
+                                Foreground="{Binding EngineModelIsSelected,Converter={StaticResource btfc}}"/>
                         </StackPanel>
-                        <!--Выпадающий список-->
-                        <ComboBox
-                            SelectedItem="{Binding SelectedEngineType}"
-                            ItemsSource="{Binding AllEngineTypes}">
-                            <ComboBox.ItemTemplate>
-                                <DataTemplate>
-                                    <TextBlock Text="{Binding Name}"/>
-                                </DataTemplate>
-                            </ComboBox.ItemTemplate>
-                        </ComboBox>
                     </StackPanel>
                 </Grid>
 
-                <!--Вес и цвет-->
+                <!--Вес-->
                 <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
@@ -334,19 +365,23 @@
                             VerticalContentAlignment="Center"
                             Text="{Binding Weight}"/>
                     </StackPanel>
-                    <!--Макс. нагрузка-->
-                    <StackPanel Grid.Column="1" Margin="4">
-                        <!--Надпись-->
-                        <StackPanel Orientation="Horizontal">
-                            <TextBlock Style="{StaticResource H5}" Text="Максимальная нагрузка (в кг.)"/>
-                        </StackPanel>
-                        <!--Поле ввода-->
-                        <TextBox
-                            Margin="0,4"
-                            VerticalContentAlignment="Center"
-                            Text="{Binding MaxLoad}"/>
-                    </StackPanel>
                 </Grid>
+
+                <!--Комментарий-->
+                <StackPanel Margin="4">
+                    <!--Надпись-->
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Style="{StaticResource H5}" Text="Комментарий"/>
+                    </StackPanel>
+                    <!--Поле ввода-->
+                    <TextBox
+                        Margin="0,4"
+                        AcceptsReturn="True"
+                        Height="128"
+                        VerticalContentAlignment="Top"
+                        Text="{Binding Comment}"/>
+                </StackPanel>
+                
             </StackPanel>
 
             <!--Сохранить/отмена-->

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

@@ -146,5 +146,34 @@ namespace SASDesktop.Views.Transport
             }
         }
         #endregion
+
+        #region Подсказки моделей двигателей
+        private void tbEngineModel_GotFocus(object sender, RoutedEventArgs e)
+        {
+            GetTypedContext().EngineModelSuggestionsVisible = true;
+        }
+
+        private void tbEngineModel_LostFocus(object sender, RoutedEventArgs e)
+        {
+            GetTypedContext().EngineModelSuggestionsVisible = false;
+        }
+
+        private void lbEngineModelSuggestions_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if ((sender as ListBox).SelectedItem is Models.EngineModel)
+            {
+                var selectedEngineModel = (sender as ListBox).SelectedItem as Models.EngineModel;
+
+                // Скрываем подсказки
+                GetTypedContext().EngineModelSuggestionsVisible = false;
+
+                // Устанавливаем наименование в поле поиска
+                GetTypedContext().EngineModelSearch = selectedEngineModel.Name;
+
+                // Устанавливаем выбранное значение
+                GetTypedContext().SelectedEngineModel = selectedEngineModel;
+            }
+        }
+        #endregion
     }
 }

Some files were not shown because too many files changed in this diff