Imagara 3 年之前
父节点
当前提交
0bf4114839

+ 34 - 0
PartsWarehouse/Car.cs

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

+ 3 - 0
PartsWarehouse/EDM.Context.cs

@@ -25,7 +25,10 @@ namespace PartsWarehouse
             throw new UnintentionalCodeFirstException();
         }
     
+        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; }
     }
 }

+ 239 - 39
PartsWarehouse/EDM.edmx

@@ -4,88 +4,288 @@
   <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="Хранилище 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">
+        <EntityType Name="Car">
+          <Key>
+            <PropertyRef Name="IdCar" />
+          </Key>
+          <Property Name="IdCar" Type="int" Nullable="false" />
+          <Property Name="Company" Type="nvarchar" MaxLength="50" Nullable="false" />
+          <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
+          <Property Name="Generation" Type="int" Nullable="false" />
+        </EntityType>
         <EntityType Name="Parts">
           <Key>
-            <PropertyRef Name="Id" />
+            <PropertyRef Name="IdPart" />
           </Key>
-          <Property Name="Id" Type="int" Nullable="false" />
-          <Property Name="Type" Type="nvarchar" MaxLength="50" />
-          <Property Name="Name" Type="nvarchar" MaxLength="50" />
-          <Property Name="Vin" Type="int" />
+          <Property Name="IdPart" Type="int" Nullable="false" />
+          <Property Name="IdCar" 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="Image" Type="varbinary(max)" Nullable="false" />
+          <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)" />
         </EntityType>
         <EntityType Name="User">
           <Key>
+            <PropertyRef Name="IdUser" />
+          </Key>
+          <Property Name="IdUser" Type="int" Nullable="false" />
+          <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
+          <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="UserCar">
+          <Key>
             <PropertyRef Name="Id" />
           </Key>
           <Property Name="Id" Type="int" Nullable="false" />
-          <Property Name="Login" Type="nvarchar" MaxLength="30" Nullable="false" />
-          <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Email" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Birthday" Type="datetime" />
-          <Property Name="PhoneNumber" Type="nvarchar" MaxLength="10" />
-          <Property Name="ProfileImgSource" Type="varbinary(max)" />
+          <Property Name="IdUser" Type="int" Nullable="false" />
+          <Property Name="IdCar" Type="int" Nullable="false" />
+          <Property Name="Vin" Type="int" Nullable="false" />
         </EntityType>
+        <Association Name="FK_Parts_Car">
+          <End Role="Car" Type="Self.Car" Multiplicity="1" />
+          <End Role="Parts" Type="Self.Parts" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Car">
+              <PropertyRef Name="IdCar" />
+            </Principal>
+            <Dependent Role="Parts">
+              <PropertyRef Name="IdCar" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_UserCar_Car">
+          <End Role="Car" Type="Self.Car" Multiplicity="1" />
+          <End Role="UserCar" Type="Self.UserCar" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Car">
+              <PropertyRef Name="IdCar" />
+            </Principal>
+            <Dependent Role="UserCar">
+              <PropertyRef Name="IdCar" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_UserCar_User">
+          <End Role="User" Type="Self.User" Multiplicity="1" />
+          <End Role="UserCar" Type="Self.UserCar" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="User">
+              <PropertyRef Name="IdUser" />
+            </Principal>
+            <Dependent Role="UserCar">
+              <PropertyRef Name="IdUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <EntityContainer Name="Хранилище PartsWarehouseDataBaseModelContainer">
+          <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">
+            <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: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>
+        <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="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" />
+        </EntityType>
         <EntityType Name="Parts">
           <Key>
-            <PropertyRef Name="Id" />
+            <PropertyRef Name="IdPart" />
           </Key>
-          <Property Name="Id" Type="Int32" Nullable="false" />
-          <Property Name="Type" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Vin" Type="Int32" />
+          <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="Remain" Type="Int32" Nullable="false" />
+          <Property Name="Price" Type="Double" Nullable="false" />
+          <NavigationProperty Name="Car" Relationship="PartsWarehouseDataBaseModel.FK_Parts_Car" FromRole="Parts" ToRole="Car" />
+        </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" />
         </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" />
+        </EntityType>
+        <EntityType Name="UserCar">
+          <Key>
             <PropertyRef Name="Id" />
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" />
-          <Property Name="Login" Type="String" MaxLength="30" FixedLength="false" Unicode="true" Nullable="false" />
-          <Property Name="Password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
-          <Property Name="Email" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
-          <Property Name="Birthday" Type="DateTime" Precision="3" />
-          <Property Name="PhoneNumber" Type="String" MaxLength="10" FixedLength="false" Unicode="true" />
-          <Property Name="ProfileImgSource" Type="Binary" MaxLength="Max" FixedLength="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" />
         </EntityType>
-        <EntityContainer Name="PartsWarehouseDataBaseEntities" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Parts" EntityType="Self.Parts" />
-          <EntitySet Name="User" EntityType="Self.User" />
-        </EntityContainer>
-      </Schema>
+        <Association Name="FK_Parts_Car">
+          <End Type="PartsWarehouseDataBaseModel.Car" Role="Car" Multiplicity="1" />
+          <End Type="PartsWarehouseDataBaseModel.Parts" Role="Parts" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Car">
+              <PropertyRef Name="IdCar" />
+            </Principal>
+            <Dependent Role="Parts">
+              <PropertyRef Name="IdCar" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_UserCar_Car">
+          <End Type="PartsWarehouseDataBaseModel.Car" Role="Car" Multiplicity="1" />
+          <End Type="PartsWarehouseDataBaseModel.UserCar" Role="UserCar" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Car">
+              <PropertyRef Name="IdCar" />
+            </Principal>
+            <Dependent Role="UserCar">
+              <PropertyRef Name="IdCar" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_UserCar_User">
+          <End Type="PartsWarehouseDataBaseModel.User" Role="User" Multiplicity="1" />
+          <End Type="PartsWarehouseDataBaseModel.UserCar" Role="UserCar" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="User">
+              <PropertyRef Name="IdUser" />
+            </Principal>
+            <Dependent Role="UserCar">
+              <PropertyRef Name="IdUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        </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">
+          <EntitySetMapping Name="Car">
+            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.Car">
+              <MappingFragment StoreEntitySet="Car">
+                <ScalarProperty Name="Generation" ColumnName="Generation" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Company" ColumnName="Company" />
+                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
           <EntitySetMapping Name="Parts">
             <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.Parts">
               <MappingFragment StoreEntitySet="Parts">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="Type" ColumnName="Type" />
+                <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="Vin" ColumnName="Vin" />
+                <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" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="User">
             <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.User">
               <MappingFragment StoreEntitySet="User">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="Login" ColumnName="Login" />
                 <ScalarProperty Name="Password" ColumnName="Password" />
-                <ScalarProperty Name="Email" ColumnName="Email" />
-                <ScalarProperty Name="Birthday" ColumnName="Birthday" />
-                <ScalarProperty Name="PhoneNumber" ColumnName="PhoneNumber" />
-                <ScalarProperty Name="ProfileImgSource" ColumnName="ProfileImgSource" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="UserCar">
+            <EntityTypeMapping TypeName="PartsWarehouseDataBaseModel.UserCar">
+              <MappingFragment StoreEntitySet="UserCar">
+                <ScalarProperty Name="Vin" ColumnName="Vin" />
+                <ScalarProperty Name="IdCar" ColumnName="IdCar" />
+                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>

+ 9 - 3
PartsWarehouse/EDM.edmx.diagram

@@ -4,9 +4,15 @@
   <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="126">
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.Parts" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.User" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
+      <Diagram DiagramId="a983730c88db49b8acf871fd319e858a" Name="Diagram1" ZoomLevel="73">
+        <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>
     </edmx:Diagrams>
   </edmx:Designer>

+ 0 - 36
PartsWarehouse/Functions.cs

@@ -9,32 +9,6 @@ namespace PartsWarehouse
 {
     public class Functions
     {
-        // Валидация номера телефона
-        public static bool IsValidPhoneNumber(string phoneNumber)
-        {
-            foreach (char c in phoneNumber)
-                if (!char.IsDigit(c))
-                    return false;
-            if (phoneNumber.Length != 11)
-                return false;
-            return true;
-        }
-        // Валидация электронной почты
-        public static bool IsValidEmail(string email)
-        {
-            if (Regex.IsMatch(email, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"))
-                return true;
-            else
-                return false;
-        }
-        // Валидация дня рождения
-        public static bool IsValidDateOfBirthday(DateTime Date)
-        {
-            if (Date > DateTime.Now)
-                return false;
-            else
-                return true;
-        }
         // Валидация логина и пароля при входе
         public static bool IsValidLogAndPass(string login, string password)
         {
@@ -84,15 +58,5 @@ namespace PartsWarehouse
             //return cnt.db.Chat.Where(item => item.Name == chatName).Select(item => item.IdChat).FirstOrDefault();
             return 0;
         }
-        // Проверка на уникальность электронной почты
-        public static bool IsEmailAlreadyTaken(string Email)
-        {
-            return cnt.db.User.Select(item => item.Email).Contains(Email);
-        }
-        // Проверка на уникальность электронной почты
-        public static bool IsPhoneNumberAlreadyTaken(string Phone)
-        {
-            return cnt.db.User.Select(item => item.PhoneNumber).Contains(Phone);
-        }
     }
 }

+ 9 - 9
PartsWarehouse/ImagesManip.cs

@@ -45,14 +45,14 @@ namespace PartsWarehouse
         //    return image;
         //}
 
-        public static BitmapImage NewImage(User user)
-        {
-            MemoryStream ms = new MemoryStream(user.ProfileImgSource);
-            BitmapImage image = new BitmapImage();
-            image.BeginInit();
-            image.StreamSource = ms;
-            image.EndInit();
-            return image;
-        }
+        //public static BitmapImage NewImage(User user)
+        //{
+        //    MemoryStream ms = new MemoryStream(user.ProfileImgSource);
+        //    BitmapImage image = new BitmapImage();
+        //    image.BeginInit();
+        //    image.StreamSource = ms;
+        //    image.EndInit();
+        //    return image;
+        //}
     }
 }

+ 1 - 1
PartsWarehouse/LoginWindow.xaml.cs

@@ -27,7 +27,7 @@ namespace PartsWarehouse
                     new ErrorWindow("Неверный логин или пароль").Show();
                 else
                 {
-                    Profile.userId = cnt.db.User.Where(item => item.Login == LogBox.Text).Select(item => item.Id).FirstOrDefault();
+                    Session.userId = cnt.db.User.Where(item => item.Login == LogBox.Text).Select(item => item.IdUser).FirstOrDefault();
                     new MainWindow().Show();
                     this.Close();
                 }

+ 14 - 0
PartsWarehouse/PartInfoPage.xaml

@@ -0,0 +1,14 @@
+<Page x:Class="PartsWarehouse.PartInfoPage"
+      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:PartsWarehouse"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="PartInfoPage">
+
+    <Grid>
+        
+    </Grid>
+</Page>

+ 28 - 0
PartsWarehouse/PartInfoPage.xaml.cs

@@ -0,0 +1,28 @@
+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 PartsWarehouse
+{
+    /// <summary>
+    /// Логика взаимодействия для PartInfoPage.xaml
+    /// </summary>
+    public partial class PartInfoPage : Page
+    {
+        public PartInfoPage()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 10 - 2
PartsWarehouse/Parts.cs

@@ -14,9 +14,17 @@ namespace PartsWarehouse
     
     public partial class Parts
     {
-        public int Id { get; set; }
+        public int IdPart { get; set; }
+        public int IdCar { get; set; }
         public string Type { get; set; }
         public string Name { get; set; }
-        public Nullable<int> Vin { get; set; }
+        public string Model { get; set; }
+        public string Manufacturer { get; set; }
+        public string Description { get; set; }
+        public byte[] Image { get; set; }
+        public int Remain { get; set; }
+        public double Price { get; set; }
+    
+        public virtual Car Car { get; set; }
     }
 }

+ 24 - 1
PartsWarehouse/PartsWarehouse.csproj

@@ -64,6 +64,9 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="Car.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
     <Compile Include="cnt.cs" />
     <Compile Include="EDM.Context.cs">
       <AutoGen>True</AutoGen>
@@ -89,20 +92,32 @@
     <Compile Include="LoginWindow.xaml.cs">
       <DependentUpon>LoginWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PartInfoPage.xaml.cs">
+      <DependentUpon>PartInfoPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Parts.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
     <Compile Include="PartsPage.xaml.cs">
       <DependentUpon>PartsPage.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Profile.cs" />
+    <Compile Include="ProfilePage.xaml.cs">
+      <DependentUpon>ProfilePage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="RegisterWindow.xaml.cs">
       <DependentUpon>RegisterWindow.xaml</DependentUpon>
     </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>
+    <Compile Include="UserCar.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
     <Compile Include="СatalogPage.xaml.cs">
       <DependentUpon>СatalogPage.xaml</DependentUpon>
     </Compile>
@@ -126,10 +141,18 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="PartInfoPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="PartsPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="ProfilePage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="RegisterWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 82 - 0
PartsWarehouse/ProfilePage.xaml

@@ -0,0 +1,82 @@
+<Page x:Class="PartsWarehouse.ProfilePage"
+      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:PartsWarehouse"
+      mc:Ignorable="d" 
+      d:DesignHeight="421"
+      d:DesignWidth="634"
+      Title="ChatPage">
+
+    <Grid Background="#32353B">
+        <Grid Background="#2F3136"
+              Grid.RowSpan="2"
+              Margin="40">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="160*"/>
+                <RowDefinition Height="180*"/>
+            </Grid.RowDefinitions>
+
+
+            <Grid Grid.Row="0"
+                  Background="#FF44464D"
+                  Margin="20">
+                <StackPanel>
+
+                    <StackPanel Orientation="Horizontal"
+                                Height="40"
+                                VerticalAlignment="Top"
+                                Margin="7">
+                        <StackPanel Orientation="Vertical"
+                                    Width="420">
+                            <Label Content="Логин"
+                               Foreground="#FFC9C7C7"/>
+                            <TextBox x:Name="EmailBox"
+                                     Text="UserLogin"
+                                     Margin="3,-5,0,0"
+                                     Height="30"
+                                     Foreground="{StaticResource TextColor}" 
+                                     BorderBrush="{x:Null}"
+                                     SelectionBrush="{x:Null}"
+                                     Background="{x:Null}"/>
+                        </StackPanel>
+                        <Button Width="80"
+                            Content="Изменить"
+                            Margin="0,18,0,0"
+                            HorizontalAlignment="Right"
+                                Click="EmailButton_Click">
+                        </Button>
+                    </StackPanel>
+
+
+                    <StackPanel Orientation="Horizontal"
+                            Height="40"
+                            VerticalAlignment="Top"
+                            Margin="7">
+                        <StackPanel Orientation="Vertical"
+                                    Width="420">
+                            <Label Content="Пароль"
+                                   Foreground="#FFC9C7C7"/>
+                            <TextBox x:Name="BirthdayBox"
+                               Text="***********"
+                               Margin="3,-5,0,0"
+                               Height="30"
+                                     Foreground="{StaticResource TextColor}" 
+                             BorderBrush="{x:Null}"
+                             SelectionBrush="{x:Null}"
+                             Background="{x:Null}"/>
+                        </StackPanel>
+                        <Button Width="80"
+                            Content="Изменить"
+                            Margin="0,18,0,0"
+                            HorizontalAlignment="Right"
+                                Click="DateButton_Click">
+                        </Button>
+                    </StackPanel>
+
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Grid>
+</Page>

+ 28 - 0
PartsWarehouse/ProfilePage.xaml.cs

@@ -0,0 +1,28 @@
+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 PartsWarehouse
+{
+    /// <summary>
+    /// Логика взаимодействия для ProfilePage.xaml
+    /// </summary>
+    public partial class ProfilePage : Page
+    {
+        public ProfilePage()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 3 - 21
PartsWarehouse/RegisterWindow.xaml

@@ -6,11 +6,11 @@
         xmlns:local="clr-namespace:PartsWarehouse"
         mc:Ignorable="d"
         ResizeMode="NoResize"
-        WindowStyle="None"
         WindowStartupLocation="CenterScreen"
-        Height="450" 
+        Height="350" 
         Width="600"
-        Title="Окно регистрации">
+        Title="Окно входа"
+        WindowStyle="None">
 
     <Grid>
         <Grid.RowDefinitions>
@@ -73,24 +73,6 @@
             VerticalAlignment="Center"
             HorizontalAlignment="Center">
                     <Label 
-                Content="Email:" 
-                Foreground="{StaticResource TextColor}"
-                HorizontalAlignment="Left" 
-                VerticalAlignment="Top" 
-                Height="40" 
-                Width="240"
-                FontSize="20"/>
-                    <TextBox x:Name="EmailBox" 
-                             Background="#323338"
-                             Foreground="{StaticResource TextColor}"
-                             BorderBrush="Black"
-                HorizontalAlignment="Left" 
-                TextWrapping="Wrap" 
-                VerticalAlignment="Top" 
-                Height="40" 
-                Width="240"
-                FontSize="20"/>
-                    <Label 
                 Content="Логин:" 
                 Foreground="{StaticResource TextColor}"
                 HorizontalAlignment="Left" 

+ 2 - 7
PartsWarehouse/RegisterWindow.xaml.cs

@@ -25,11 +25,7 @@ namespace PartsWarehouse
         {
             try
             {
-                if (!Functions.IsValidEmail(EmailBox.Text))
-                    new ErrorWindow("Email введен неверно.").Show();
-                else if (Functions.IsEmailAlreadyTaken(EmailBox.Text))
-                    new ErrorWindow("Данный email уже используется.").Show();
-                else if (!Functions.IsValidLength(NickNameBox.Text.Trim()))
+                if (!Functions.IsValidLength(NickNameBox.Text.Trim()))
                     new ErrorWindow("Поле «Логин» должно содержать не менее 5 символов.").Show();
                 else if (!Functions.IsValidLength(PassBox.Password.Trim()))
                     new ErrorWindow("Поле «Пароль» должно содержать не менее 5 символов.").Show();
@@ -41,10 +37,9 @@ namespace PartsWarehouse
                 {
                     User newUser = new User()
                     {
-                        Id = cnt.db.User.Select(p => p.Id).DefaultIfEmpty(0).Max() + 1,
+                        IdUser = cnt.db.User.Select(p => p.IdUser).DefaultIfEmpty(0).Max() + 1,
                         Login = NickNameBox.Text,
                         Password = Encrypt.GetHash(PassBox.Password),
-                        Email = EmailBox.Text,
                     };
                     cnt.db.User.Add(newUser);
                     cnt.db.SaveChanges(); ;

+ 3 - 2
PartsWarehouse/Profile.cs

@@ -1,7 +1,8 @@
 namespace PartsWarehouse
 {
-    public class Profile
+    public class Session
     {
         public static int userId { get; set; }
+        public static int carId { get; set; }
     }
-}
+}

+ 10 - 5
PartsWarehouse/User.cs

@@ -14,12 +14,17 @@ namespace PartsWarehouse
     
     public partial class User
     {
-        public int Id { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public User()
+        {
+            this.UserCar = new HashSet<UserCar>();
+        }
+    
+        public int IdUser { get; set; }
         public string Login { get; set; }
         public string Password { get; set; }
-        public string Email { get; set; }
-        public Nullable<System.DateTime> Birthday { get; set; }
-        public string PhoneNumber { get; set; }
-        public byte[] ProfileImgSource { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<UserCar> UserCar { get; set; }
     }
 }

+ 25 - 0
PartsWarehouse/UserCar.cs

@@ -0,0 +1,25 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PartsWarehouse
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class UserCar
+    {
+        public int Id { get; set; }
+        public int IdUser { get; set; }
+        public int IdCar { get; set; }
+        public int Vin { get; set; }
+    
+        public virtual Car Car { get; set; }
+        public virtual User User { get; set; }
+    }
+}

+ 23 - 0
PartsWarehouse/sysdiagrams.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <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; }
+    }
+}

+ 87 - 4
PartsWarehouse/СatalogPage.xaml

@@ -9,13 +9,96 @@
       Title="СatalogPage">
 
     <Grid>
-        <ComboBox>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="4*"/>
+        </Grid.RowDefinitions>
+
+        <Border CornerRadius="15" Background="red" Margin="5">
+            <Grid Grid.Row="0">
+                <Grid.RowDefinitions>
+                    <RowDefinition/>
+                    <RowDefinition/>
+                </Grid.RowDefinitions>
+
+                <StackPanel Orientation="Horizontal"
+                        Grid.Row="0">
+                    <ComboBox Name="CarCompanyCombo"
+                              Margin="5"
+                              Width="120"
+                              Text="Марка">
+
+                    </ComboBox>
+
+                    <ComboBox Name="CarNameCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+                    
+                    <ComboBox Name="CarGenerationCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+
+                    <ComboBox Name="PartTypeCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+
+                    <ComboBox Name="PartManufacturerCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+                </StackPanel>
+
+                <StackPanel Orientation="Horizontal"
+                            Grid.Row="1">
+                    <ComboBox Name="NameCombo"
+                              Margin="5"
+                              Width="120"
+                              Text="Марка">
+
+                    </ComboBox>
+
+                    <ComboBox Name="ModelCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+
+                    <ComboBox Name="OriginalCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+
+                    <ComboBox Name="PartNumCombo"
+                      Margin="5"
+                      Width="120">
+
+                    </ComboBox>
+
+                </StackPanel>
+
+            </Grid>
+        </Border>
+
+        
+        <Grid Grid.Row="1">
+            
+        </Grid>
+
+        <!--<ComboBox Grid.RowSpan="2">
             <ComboBox.ItemsPanel>
                 <ItemsPanelTemplate>
                     <WrapPanel Orientation="Vertical" Height="100" />
                 </ItemsPanelTemplate>
             </ComboBox.ItemsPanel>
-            
+
             <ComboBoxItem Content="Value 1" />
             <ComboBoxItem Content="Value 2" />
             <ComboBoxItem Content="Value 3" />
@@ -31,7 +114,7 @@
             <ComboBoxItem Content="Value 13" />
             <ComboBoxItem Content="Value 14" />
             <ComboBoxItem Content="Value 15" />
-            
-        </ComboBox>
+
+        </ComboBox>-->
     </Grid>
 </Page>

+ 7 - 1
PartsWarehouse/СatalogPage.xaml.cs

@@ -20,9 +20,15 @@ namespace PartsWarehouse
     /// </summary>
     public partial class СatalogPage : Page
     {
-        public СatalogPage()
+        public СatalogPage(string carCompany = null, string carName = null, string carGeneration = null)
         {
             InitializeComponent();
+            if(carCompany != null && carName != null)
+            {
+                CarCompanyCombo.Text = carCompany;
+                CarNameCombo.Text = carName;
+                CarGenerationCombo.Text = carGeneration;
+            }
         }
     }
 }