Imagine 3 лет назад
Родитель
Сommit
6e20d4558f

+ 4 - 1
PartsWarehouse/App.config

@@ -13,4 +13,7 @@
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
-<connectionStrings><add name="PartsWarehouseDataBaseEntities" connectionString="metadata=res://*/EDM.csdl|res://*/EDM.ssdl|res://*/EDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\MSSQLLocalDB;initial catalog=PartsWarehouseDataBase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings></configuration>
+<connectionStrings>
+  
+<add name="EDMEntities" connectionString="metadata=res://*/EDM.csdl|res://*/EDM.ssdl|res://*/EDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=mssql;initial catalog=gr692_gav;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
+</configuration>

+ 3 - 4
PartsWarehouse/EDM.Context.cs

@@ -13,10 +13,10 @@ namespace PartsWarehouse
     using System.Data.Entity;
     using System.Data.Entity.Infrastructure;
     
-    public partial class PartsWarehouseDataBaseEntities : DbContext
+    public partial class EDMEntities : DbContext
     {
-        public PartsWarehouseDataBaseEntities()
-            : base("name=PartsWarehouseDataBaseEntities")
+        public EDMEntities()
+            : base("name=EDMEntities")
         {
         }
     
@@ -27,7 +27,6 @@ namespace PartsWarehouse
     
         public virtual DbSet<Car> Car { get; set; }
         public virtual DbSet<Parts> Parts { get; set; }
-        public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
         public virtual DbSet<User> User { get; set; }
         public virtual DbSet<UserCar> UserCar { get; set; }
     }

+ 1 - 1
PartsWarehouse/EDM.Designer.cs

@@ -1,4 +1,4 @@
-// Создание кода T4 для модели "C:\Users\milic\source\repos\PartsWarehouse\PartsWarehouse\EDM.edmx" включено. 
+// Создание кода T4 для модели "C:\Users\gr692_gav\source\repos\PartsWarehouse\PartsWarehouse\EDM.edmx" включено. 
 // Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
 // на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
 // открыта в конструкторе.

+ 74 - 109
PartsWarehouse/EDM.edmx

@@ -4,7 +4,7 @@
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-    <Schema Namespace="Хранилище PartsWarehouseDataBaseModel" 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">
+      <Schema Namespace="Хранилище gr692_gavModel" 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="Car">
           <Key>
             <PropertyRef Name="IdCar" />
@@ -20,26 +20,15 @@
           </Key>
           <Property Name="IdPart" Type="int" Nullable="false" />
           <Property Name="IdCar" Type="int" Nullable="false" />
-          <Property Name="PartNum" Type="int" Nullable="false" />
           <Property Name="Type" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Model" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Manufacturer" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Description" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Original" Type="nvarchar" MaxLength="15" Nullable="false" />
-          <Property Name="Image" Type="varbinary(max)" Nullable="false" />
+          <Property Name="Image" Type="varbinary(max)" />
           <Property Name="Remain" Type="int" Nullable="false" />
           <Property Name="Price" Type="float" 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)" />
+          <Property Name="PartNum" Type="int" Nullable="false" />
+          <Property Name="Original" Type="nvarchar" MaxLength="15" Nullable="false" />
         </EntityType>
         <EntityType Name="User">
           <Key>
@@ -56,7 +45,7 @@
           <Property Name="Id" Type="int" Nullable="false" />
           <Property Name="IdUser" Type="int" Nullable="false" />
           <Property Name="IdCar" Type="int" Nullable="false" />
-          <Property Name="Vin" Type="int" Nullable="false" />
+          <Property Name="Vin" Type="nvarchar" MaxLength="50" Nullable="false" />
         </EntityType>
         <Association Name="FK_Parts_Car">
           <End Role="Car" Type="Self.Car" Multiplicity="1" />
@@ -94,10 +83,9 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <EntityContainer Name="Хранилище PartsWarehouseDataBaseModelContainer">
+        <EntityContainer Name="Хранилище gr692_gavModelContainer">
           <EntitySet Name="Car" EntityType="Self.Car" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Parts" EntityType="Self.Parts" Schema="dbo" store:Type="Tables" />
-          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="User" EntityType="Self.User" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="UserCar" EntityType="Self.UserCar" Schema="dbo" store:Type="Tables" />
           <AssociationSet Name="FK_Parts_Car" Association="Self.FK_Parts_Car">
@@ -113,39 +101,21 @@
             <End Role="UserCar" EntitySet="UserCar" />
           </AssociationSet>
         </EntityContainer>
-      </Schema></edmx:StorageModels>
+      </Schema>
+    </edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
-      <Schema Namespace="PartsWarehouseDataBaseModel" 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">
-        <EntityContainer Name="PartsWarehouseDataBaseEntities" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Car" EntityType="PartsWarehouseDataBaseModel.Car" />
-          <EntitySet Name="Parts" EntityType="PartsWarehouseDataBaseModel.Parts" />
-          <EntitySet Name="sysdiagrams" EntityType="PartsWarehouseDataBaseModel.sysdiagrams" />
-          <EntitySet Name="User" EntityType="PartsWarehouseDataBaseModel.User" />
-          <EntitySet Name="UserCar" EntityType="PartsWarehouseDataBaseModel.UserCar" />
-          <AssociationSet Name="FK_Parts_Car" Association="PartsWarehouseDataBaseModel.FK_Parts_Car">
-            <End Role="Car" EntitySet="Car" />
-            <End Role="Parts" EntitySet="Parts" />
-          </AssociationSet>
-          <AssociationSet Name="FK_UserCar_Car" Association="PartsWarehouseDataBaseModel.FK_UserCar_Car">
-            <End Role="Car" EntitySet="Car" />
-            <End Role="UserCar" EntitySet="UserCar" />
-          </AssociationSet>
-          <AssociationSet Name="FK_UserCar_User" Association="PartsWarehouseDataBaseModel.FK_UserCar_User">
-            <End Role="User" EntitySet="User" />
-            <End Role="UserCar" EntitySet="UserCar" />
-          </AssociationSet>
-        </EntityContainer>
+      <Schema Namespace="gr692_gavModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
         <EntityType Name="Car">
           <Key>
             <PropertyRef Name="IdCar" />
           </Key>
           <Property Name="IdCar" Type="Int32" Nullable="false" />
-          <Property Name="Company" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Name" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="Company" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="Generation" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Parts" Relationship="PartsWarehouseDataBaseModel.FK_Parts_Car" FromRole="Car" ToRole="Parts" />
-          <NavigationProperty Name="UserCar" Relationship="PartsWarehouseDataBaseModel.FK_UserCar_Car" FromRole="Car" ToRole="UserCar" />
+          <NavigationProperty Name="Parts" Relationship="Self.FK_Parts_Car" FromRole="Car" ToRole="Parts" />
+          <NavigationProperty Name="UserCar" Relationship="Self.FK_UserCar_Car" FromRole="Car" ToRole="UserCar" />
         </EntityType>
         <EntityType Name="Parts">
           <Key>
@@ -153,36 +123,25 @@
           </Key>
           <Property Name="IdPart" Type="Int32" Nullable="false" />
           <Property Name="IdCar" Type="Int32" Nullable="false" />
-          <Property Name="Type" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Name" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Model" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Manufacturer" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Description" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Image" Type="Binary" Nullable="false" MaxLength="Max" FixedLength="false" />
+          <Property Name="Type" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Manufacturer" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Description" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Image" Type="Binary" MaxLength="Max" FixedLength="false" />
           <Property Name="Remain" Type="Int32" Nullable="false" />
           <Property Name="Price" Type="Double" Nullable="false" />
-          <NavigationProperty Name="Car" Relationship="PartsWarehouseDataBaseModel.FK_Parts_Car" FromRole="Parts" ToRole="Car" />
           <Property Name="PartNum" Type="Int32" Nullable="false" />
-          <Property Name="Original" Type="String" Nullable="false" MaxLength="15" FixedLength="false" Unicode="true" />
-        </EntityType>
-        <EntityType Name="sysdiagrams">
-          <Key>
-            <PropertyRef Name="diagram_id" />
-          </Key>
-          <Property Name="name" Type="String" Nullable="false" MaxLength="128" FixedLength="false" Unicode="true" />
-          <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" />
+          <Property Name="Original" Type="String" MaxLength="15" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Car" Relationship="Self.FK_Parts_Car" FromRole="Parts" ToRole="Car" />
         </EntityType>
         <EntityType Name="User">
           <Key>
             <PropertyRef Name="IdUser" />
           </Key>
           <Property Name="IdUser" Type="Int32" Nullable="false" />
-          <Property Name="Login" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Password" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <NavigationProperty Name="UserCar" Relationship="PartsWarehouseDataBaseModel.FK_UserCar_User" FromRole="User" ToRole="UserCar" />
+          <Property Name="Login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="UserCar" Relationship="Self.FK_UserCar_User" FromRole="User" ToRole="UserCar" />
         </EntityType>
         <EntityType Name="UserCar">
           <Key>
@@ -191,13 +150,13 @@
           <Property Name="Id" Type="Int32" Nullable="false" />
           <Property Name="IdUser" Type="Int32" Nullable="false" />
           <Property Name="IdCar" Type="Int32" Nullable="false" />
-          <Property Name="Vin" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Car" Relationship="PartsWarehouseDataBaseModel.FK_UserCar_Car" FromRole="UserCar" ToRole="Car" />
-          <NavigationProperty Name="User" Relationship="PartsWarehouseDataBaseModel.FK_UserCar_User" FromRole="UserCar" ToRole="User" />
+          <Property Name="Vin" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Car" Relationship="Self.FK_UserCar_Car" FromRole="UserCar" ToRole="Car" />
+          <NavigationProperty Name="User" Relationship="Self.FK_UserCar_User" FromRole="UserCar" ToRole="User" />
         </EntityType>
         <Association Name="FK_Parts_Car">
-          <End Type="PartsWarehouseDataBaseModel.Car" Role="Car" Multiplicity="1" />
-          <End Type="PartsWarehouseDataBaseModel.Parts" Role="Parts" Multiplicity="*" />
+          <End Role="Car" Type="Self.Car" Multiplicity="1" />
+          <End Role="Parts" Type="Self.Parts" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Car">
               <PropertyRef Name="IdCar" />
@@ -208,8 +167,8 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_UserCar_Car">
-          <End Type="PartsWarehouseDataBaseModel.Car" Role="Car" Multiplicity="1" />
-          <End Type="PartsWarehouseDataBaseModel.UserCar" Role="UserCar" Multiplicity="*" />
+          <End Role="Car" Type="Self.Car" Multiplicity="1" />
+          <End Role="UserCar" Type="Self.UserCar" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Car">
               <PropertyRef Name="IdCar" />
@@ -220,8 +179,8 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_UserCar_User">
-          <End Type="PartsWarehouseDataBaseModel.User" Role="User" Multiplicity="1" />
-          <End Type="PartsWarehouseDataBaseModel.UserCar" Role="UserCar" Multiplicity="*" />
+          <End Role="User" Type="Self.User" Multiplicity="1" />
+          <End Role="UserCar" Type="Self.UserCar" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="User">
               <PropertyRef Name="IdUser" />
@@ -231,67 +190,73 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        </Schema>
+        <EntityContainer Name="EDMEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Car" EntityType="Self.Car" />
+          <EntitySet Name="Parts" EntityType="Self.Parts" />
+          <EntitySet Name="User" EntityType="Self.User" />
+          <EntitySet Name="UserCar" EntityType="Self.UserCar" />
+          <AssociationSet Name="FK_Parts_Car" Association="Self.FK_Parts_Car">
+            <End Role="Car" EntitySet="Car" />
+            <End Role="Parts" EntitySet="Parts" />
+          </AssociationSet>
+          <AssociationSet Name="FK_UserCar_Car" Association="Self.FK_UserCar_Car">
+            <End Role="Car" EntitySet="Car" />
+            <End Role="UserCar" EntitySet="UserCar" />
+          </AssociationSet>
+          <AssociationSet Name="FK_UserCar_User" Association="Self.FK_UserCar_User">
+            <End Role="User" EntitySet="User" />
+            <End Role="UserCar" EntitySet="UserCar" />
+          </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="Хранилище PartsWarehouseDataBaseModelContainer" CdmEntityContainer="PartsWarehouseDataBaseEntities">
+        <EntityContainerMapping StorageEntityContainer="Хранилище gr692_gavModelContainer" CdmEntityContainer="EDMEntities">
           <EntitySetMapping Name="Car">
-            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.Car">
+            <EntityTypeMapping TypeName="gr692_gavModel.Car">
               <MappingFragment StoreEntitySet="Car">
-                <ScalarProperty Name="Generation" ColumnName="Generation" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
-                <ScalarProperty Name="Company" ColumnName="Company" />
                 <ScalarProperty Name="IdCar" ColumnName="IdCar" />
+                <ScalarProperty Name="Company" ColumnName="Company" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Generation" ColumnName="Generation" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Parts">
-            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.Parts">
+            <EntityTypeMapping TypeName="gr692_gavModel.Parts">
               <MappingFragment StoreEntitySet="Parts">
-                <ScalarProperty Name="Original" ColumnName="Original" />
-                <ScalarProperty Name="PartNum" ColumnName="PartNum" />
-                <ScalarProperty Name="Price" ColumnName="Price" />
-                <ScalarProperty Name="Remain" ColumnName="Remain" />
-                <ScalarProperty Name="Image" ColumnName="Image" />
-                <ScalarProperty Name="Description" ColumnName="Description" />
-                <ScalarProperty Name="Manufacturer" ColumnName="Manufacturer" />
-                <ScalarProperty Name="Model" ColumnName="Model" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
-                <ScalarProperty Name="Type" ColumnName="Type" />
-                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
                 <ScalarProperty Name="IdPart" ColumnName="IdPart" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
-          <EntitySetMapping Name="sysdiagrams">
-            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.sysdiagrams">
-              <MappingFragment StoreEntitySet="sysdiagrams">
-                <ScalarProperty Name="definition" ColumnName="definition" />
-                <ScalarProperty Name="version" ColumnName="version" />
-                <ScalarProperty Name="diagram_id" ColumnName="diagram_id" />
-                <ScalarProperty Name="principal_id" ColumnName="principal_id" />
-                <ScalarProperty Name="name" ColumnName="name" />
+                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
+                <ScalarProperty Name="Type" ColumnName="Type" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Manufacturer" ColumnName="Manufacturer" />
+                <ScalarProperty Name="Description" ColumnName="Description" />
+                <ScalarProperty Name="Image" ColumnName="Image" />
+                <ScalarProperty Name="Remain" ColumnName="Remain" />
+                <ScalarProperty Name="Price" ColumnName="Price" />
+                <ScalarProperty Name="PartNum" ColumnName="PartNum" />
+                <ScalarProperty Name="Original" ColumnName="Original" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="User">
-            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.User">
+            <EntityTypeMapping TypeName="gr692_gavModel.User">
               <MappingFragment StoreEntitySet="User">
-                <ScalarProperty Name="Password" ColumnName="Password" />
-                <ScalarProperty Name="Login" ColumnName="Login" />
                 <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="Password" ColumnName="Password" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="UserCar">
-            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.UserCar">
+            <EntityTypeMapping TypeName="gr692_gavModel.UserCar">
               <MappingFragment StoreEntitySet="UserCar">
-                <ScalarProperty Name="Vin" ColumnName="Vin" />
-                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
-                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
                 <ScalarProperty Name="Id" ColumnName="Id" />
+                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
+                <ScalarProperty Name="Vin" ColumnName="Vin" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>

+ 8 - 9
PartsWarehouse/EDM.edmx.diagram

@@ -4,15 +4,14 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="a983730c88db49b8acf871fd319e858a" Name="Diagram1" ZoomLevel="104">
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.Car" Width="1.5" PointX="0.75" PointY="3.5" />
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.Parts" Width="1.5" PointX="2.75" PointY="5.125" />
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.sysdiagrams" Width="1.5" PointX="5.75" PointY="1.25" />
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.User" Width="1.5" PointX="0.75" PointY="1" />
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.UserCar" Width="1.5" PointX="3" PointY="2.5" />
-        <AssociationConnector Association="PartsWarehouseDataBaseModel.FK_Parts_Car" />
-        <AssociationConnector Association="PartsWarehouseDataBaseModel.FK_UserCar_Car" />
-        <AssociationConnector Association="PartsWarehouseDataBaseModel.FK_UserCar_User" />
+      <Diagram DiagramId="3e84710fb915458c9ceb6f55a728192a" Name="Diagram1">
+        <EntityTypeShape EntityType="gr692_gavModel.Car" Width="1.5" PointX="0.75" PointY="4.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.Parts" Width="1.5" PointX="3" PointY="4" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.User" Width="1.5" PointX="3.75" PointY="0.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr692_gavModel.UserCar" Width="1.5" PointX="6" PointY="4.5" IsExpanded="true" />
+        <AssociationConnector Association="gr692_gavModel.FK_Parts_Car" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK_UserCar_Car" ManuallyRouted="false" />
+        <AssociationConnector Association="gr692_gavModel.FK_UserCar_User" ManuallyRouted="false" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 3 - 1
PartsWarehouse/MainWindow.xaml

@@ -94,7 +94,9 @@
             <Grid Grid.Column="1">
                 <Frame Name="MainFrame"
                    NavigationUIVisibility="Hidden"
-                   Background="#36393F"/>
+                   Background="#36393F"
+                       Foreground="#36393F"
+                       BorderBrush="#36393F"/>
             </Grid>
         </Grid>
     </Grid>

+ 2 - 3
PartsWarehouse/MainWindow.xaml.cs

@@ -61,10 +61,9 @@ namespace PartsWarehouse
         {
             try
             {
-                if (cnt.db.UserCar.Select(item => item.Vin).Contains(Convert.ToInt32(VinBox.Text)))
+                if (cnt.db.UserCar.Select(item => item.Vin).Contains(VinBox.Text))
                 {
-                    int vin = Convert.ToInt32(VinBox.Text);
-                    Car car = cnt.db.Car.Where(item => item.IdCar == cnt.db.UserCar.Where(uc => uc.Vin == vin).Select(uc => uc.IdCar).FirstOrDefault()).FirstOrDefault();
+                    Car car = cnt.db.Car.Where(item => item.IdCar == cnt.db.UserCar.Where(uc => uc.Vin == VinBox.Text).Select(uc => uc.IdCar).FirstOrDefault()).FirstOrDefault();
                     MainFrame.Content = new СatalogPage(car.Company, car.Name, car.Generation);
                     new ErrorWindow((car.Company, car.Name, car.Generation).ToString()).ShowDialog();
                 }

+ 0 - 1
PartsWarehouse/Parts.cs

@@ -18,7 +18,6 @@ namespace PartsWarehouse
         public int IdCar { get; set; }
         public string Type { get; set; }
         public string Name { get; set; }
-        public string Model { get; set; }
         public string Manufacturer { get; set; }
         public string Description { get; set; }
         public byte[] Image { get; set; }

+ 7 - 9
PartsWarehouse/PartsWarehouse.csproj

@@ -106,9 +106,6 @@
     </Compile>
     <Compile Include="Session.cs" />
     <Compile Include="Styles\Style.cs" />
-    <Compile Include="sysdiagrams.cs">
-      <DependentUpon>EDM.tt</DependentUpon>
-    </Compile>
     <Compile Include="User.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
@@ -194,21 +191,22 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
+    <Resource Include="Resources\NotFound.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <ItemGroup>
     <Content Include="EDM.Context.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
-      <LastGenOutput>EDM.Context.cs</LastGenOutput>
       <DependentUpon>EDM.edmx</DependentUpon>
+      <LastGenOutput>EDM.Context.cs</LastGenOutput>
     </Content>
     <Content Include="EDM.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.cs</LastGenOutput>
     </Content>
-    <Resource Include="Resources\NotFound.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 1 - 1
PartsWarehouse/ProfilePage.xaml.cs

@@ -66,7 +66,7 @@ namespace PartsWarehouse
         {
 
         }
-        private void AddCar(string company, string name, int generation, int vin)
+        private void AddCar(string company, string name, int generation, string vin)
         {
             Grid messageGrid = new Grid();
             messageGrid.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x44, 0x46, 0x4D));

+ 1 - 1
PartsWarehouse/UserCar.cs

@@ -17,7 +17,7 @@ namespace PartsWarehouse
         public int Id { get; set; }
         public int IdUser { get; set; }
         public int IdCar { get; set; }
-        public int Vin { get; set; }
+        public string Vin { get; set; }
     
         public virtual Car Car { get; set; }
         public virtual User User { get; set; }

+ 1 - 1
PartsWarehouse/cnt.cs

@@ -2,6 +2,6 @@
 {
     public class cnt
     {
-        public static PartsWarehouseDataBaseEntities db = new PartsWarehouseDataBaseEntities();
+        public static EDMEntities db = new EDMEntities();
     }
 }

+ 0 - 23
PartsWarehouse/sysdiagrams.cs

@@ -1,23 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     Этот код создан по шаблону.
-//
-//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
-//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace PartsWarehouse
-{
-    using System;
-    using System.Collections.Generic;
-    
-    public partial class sysdiagrams
-    {
-        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; }
-    }
-}

+ 9 - 9
PartsWarehouse/СatalogPage.xaml

@@ -30,7 +30,7 @@
                              Margin="5"
                              Width="120"
                              Text="Марка"
-                             PreviewMouseLeftButtonUp="CarCompanyBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="CarCompanyBox_PreviewMouseLeftButtonUp"
                              LostFocus="CarCompanyBox_LostFocus">
                     </TextBox>
 
@@ -38,7 +38,7 @@
                              Margin="5"
                              Width="120"
                              Text="Название"
-                             PreviewMouseLeftButtonUp="CarNameBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="CarNameBox_PreviewMouseLeftButtonUp"
                              LostFocus="CarNameBox_LostFocus">
                     </TextBox>
 
@@ -46,7 +46,7 @@
                              Margin="5"
                              Width="120"
                              Text="Поколение"
-                             PreviewMouseLeftButtonUp="CarGenerationBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="CarGenerationBox_PreviewMouseLeftButtonUp"
                              LostFocus="CarGenerationBox_LostFocus">
 
                     </TextBox>
@@ -55,7 +55,7 @@
                              Margin="5"
                              Width="120"
                              Text="Тип запчасти"
-                             PreviewMouseLeftButtonUp="PartTypeBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="PartTypeBox_PreviewMouseLeftButtonUp"
                              LostFocus="PartTypeBox_LostFocus">
 
                     </TextBox>
@@ -68,7 +68,7 @@
                               Margin="5"
                               Width="120"
                               Text="Название запчасти"
-                             PreviewMouseLeftButtonUp="NameBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="NameBox_PreviewMouseLeftButtonUp"
                              LostFocus="NameBox_LostFocus">
 
                     </TextBox>
@@ -77,7 +77,7 @@
                              Margin="5"
                              Width="120"
                              Text="Модель"
-                             PreviewMouseLeftButtonUp="ModelBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="ModelBox_PreviewMouseLeftButtonUp"
                              LostFocus="ModelBox_LostFocus">
                     </TextBox>
 
@@ -85,7 +85,7 @@
                              Margin="5"
                              Width="120"
                              Text="Оригинал: Не важно"
-                             PreviewMouseLeftButtonUp="OriginalBox_PreviewMouseLeftButtonUp"
+                             PreviewMouseDown="OriginalBox_PreviewMouseLeftButtonUp"
                              LostFocus="OriginalBox_LostFocus">
                     </TextBox>
 
@@ -104,9 +104,9 @@
 
         <ListBox Name="PartsListBox"
                  Grid.Row="1" 
-                 Background="#2F3136">
+                 Background="#2F3136"
+                 BorderBrush="{Binding PartsListBox}">
             <ScrollViewer VerticalScrollBarVisibility="Visible"/>
-
         </ListBox>
 
         <!--<TextBox Grid.RowSpan="2">

+ 45 - 15
PartsWarehouse/СatalogPage.xaml.cs

@@ -38,7 +38,8 @@ namespace PartsWarehouse
 
         private void CarCompanyBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            CarCompanyBox.Text = "Марка";
+            if (CarCompanyBox.Text == "")
+                CarCompanyBox.Text = "Марка";
         }
 
         private void CarNameBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -48,7 +49,8 @@ namespace PartsWarehouse
 
         private void CarNameBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            CarNameBox.Text = "Название";
+            if (CarNameBox.Text == "")
+                CarNameBox.Text = "Название";
         }
 
         private void CarGenerationBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -58,7 +60,8 @@ namespace PartsWarehouse
 
         private void CarGenerationBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            CarGenerationBox.Text = "Поколение";
+            if (CarGenerationBox.Text == "")
+                CarGenerationBox.Text = "Поколение";
         }
 
         private void PartTypeBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -68,7 +71,8 @@ namespace PartsWarehouse
 
         private void PartTypeBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            PartTypeBox.Text = "Тип запчасти";
+            if (PartTypeBox.Text == "")
+                PartTypeBox.Text = "Тип запчасти";
         }
 
         private void NameBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -78,7 +82,8 @@ namespace PartsWarehouse
 
         private void NameBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            NameBox.Text = "Название запчасти";
+            if (NameBox.Text == "")
+                NameBox.Text = "Название запчасти";
         }
 
         private void ModelBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -88,7 +93,8 @@ namespace PartsWarehouse
 
         private void ModelBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            ModelBox.Text = "Модель";
+            if (ModelBox.Text == "")
+                ModelBox.Text = "Модель";
         }
 
         private void OriginalBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -98,7 +104,8 @@ namespace PartsWarehouse
 
         private void OriginalBox_LostFocus(object sender, RoutedEventArgs e)
         {
-            OriginalBox.Text = "Оригинал: Не важно";
+            if (OriginalBox.Text == "")
+                OriginalBox.Text = "Оригинал: Не важно";
         }
 
         private void FindPartButton_Click(object sender, RoutedEventArgs e)
@@ -107,16 +114,39 @@ namespace PartsWarehouse
         }
         private void PartsUpdate()
         {
-            PartsListBox.Items.Clear();
-            foreach (Parts part in cnt.db.Parts.Where(item => item.Car.Company == CarCompanyBox.Text && item.Car.Name == CarNameBox.Text).ToList())
+            try
             {
-                BitmapImage img = new BitmapImage();
-                if (part.Image != null)
-                    img = new BitmapImage(new Uri("../Resources/NotFound.png", UriKind.RelativeOrAbsolute));
-                //else
-                //    img = ImagesManip.NewImage(cnt.db.User.Where(item => item.Id == idAuthor).FirstOrDefault());
-                AddPart(part.Name, part.Description, part.PartNum, img);
+                PartsListBox.Items.Clear();
+                var list = cnt.db.Parts.ToList();
+                if (CarCompanyBox.Text != "Марка")
+                    list = list.Where(item => item.Car.Company == CarCompanyBox.Text).ToList();
+                if (CarNameBox.Text != "Название")
+                    list = list.Where(item => item.Car.Name == CarNameBox.Text).ToList();
+                if (CarGenerationBox.Text != "Поколение")
+                    list = list.Where(item => item.Car.Generation == Convert.ToInt32(CarGenerationBox.Text)).ToList();
+                if (PartTypeBox.Text != "Тип запчасти")
+                    list = list.Where(item => item.Type == PartTypeBox.Text).ToList();
+                if (NameBox.Text != "Название запчасти")
+                    list = list.Where(item => item.Name == NameBox.Text).ToList();
+                if (ModelBox.Text != "Модель")
+                    list = list.Where(item => item.PartNum == Convert.ToInt32(ModelBox.Text)).ToList();
+                if (OriginalBox.Text != "Оригинал: Не важно")
+                    list = list.Where(item => item.Original == OriginalBox.Text).ToList();
+                foreach (Parts part in list)
+                {
+                    BitmapImage img = new BitmapImage();
+                    if (part.Image != null)
+                        img = new BitmapImage(new Uri("../Resources/NotFound.png", UriKind.RelativeOrAbsolute));
+                    //else
+                    //    img = ImagesManip.NewImage(cnt.db.User.Where(item => item.Id == idAuthor).FirstOrDefault());
+                    AddPart(part.Name, part.Description, part.PartNum, img);
+                }
             }
+            catch
+            {
+                new ErrorWindow("биба").ShowDialog();
+            }
+
         }
         private void AddPart(string name, string desc, int partNum, BitmapImage imageSource)
         {