Imagara 2 vuotta sitten
vanhempi
commit
52c355cfc4

+ 1 - 0
RaspisKusach/EDM.Context.cs

@@ -30,5 +30,6 @@ namespace RaspisKusach
         public virtual DbSet<Tickets> Tickets { get; set; }
         public virtual DbSet<Trains> Trains { get; set; }
         public virtual DbSet<TrainsCarriages> TrainsCarriages { get; set; }
+        public virtual DbSet<Users> Users { get; set; }
     }
 }

+ 1 - 1
RaspisKusach/EDM.Designer.cs

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

+ 58 - 17
RaspisKusach/EDM.edmx

@@ -4,7 +4,7 @@
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-    <Schema Namespace="Хранилище RouteScheduleDataBaseModel" 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="RouteScheduleDataBaseModel.Store" 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="Routes">
           <Key>
             <PropertyRef Name="IdRoute" />
@@ -13,8 +13,8 @@
           <Property Name="IdTrain" Type="int" Nullable="false" />
           <Property Name="Departure_Station" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Arrival_Station" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Departure_Date" Type="date" Nullable="false" />
-          <Property Name="Arrival_Date" Type="date" Nullable="false" />
+          <Property Name="Departure_Date" Type="datetime" Nullable="false" />
+          <Property Name="Arrival_Date" Type="datetime" Nullable="false" />
         </EntityType>
         <EntityType Name="TestTable">
           <Key>
@@ -24,19 +24,20 @@
           <Property Name="IdTrain" Type="int" Nullable="false" />
           <Property Name="Departure" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Arrival" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="DepartureDate" Type="date" Nullable="false" />
-          <Property Name="ArrivalDate" Type="date" Nullable="false" />
+          <Property Name="DepartureDate" Type="datetime" Nullable="false" />
+          <Property Name="ArrivalDate" Type="datetime" Nullable="false" />
         </EntityType>
         <EntityType Name="Tickets">
           <Key>
             <PropertyRef Name="IdTicket" />
           </Key>
           <Property Name="IdTicket" Type="int" Nullable="false" />
+          <Property Name="IdUser" Type="int" Nullable="false" />
           <Property Name="IdRoute" Type="int" Nullable="false" />
           <Property Name="IdTrainCarriage" Type="int" Nullable="false" />
           <Property Name="PlaceNumber" Type="int" Nullable="false" />
           <Property Name="Category" Type="int" Nullable="false" />
-          <Property Name="BuyDate" Type="date" Nullable="false" />
+          <Property Name="BuyDate" Type="datetime" Nullable="false" />
         </EntityType>
         <EntityType Name="Trains">
           <Key>
@@ -52,12 +53,25 @@
           <Property Name="IdCarriage" Type="int" Nullable="false" />
           <Property Name="Count" Type="int" Nullable="false" />
         </EntityType>
-        <EntityContainer Name="Хранилище RouteScheduleDataBaseModelContainer">
+        <EntityType Name="Users">
+          <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" />
+          <Property Name="Passport" Type="nvarchar" MaxLength="10" />
+          <Property Name="Surname" Type="nvarchar" MaxLength="50" />
+          <Property Name="Name" Type="nvarchar" MaxLength="50" />
+          <Property Name="Patronymic" Type="nvarchar" MaxLength="50" />
+        </EntityType>
+        <EntityContainer Name="RouteScheduleDataBaseModelStoreContainer">
           <EntitySet Name="Routes" EntityType="Self.Routes" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="TestTable" EntityType="Self.TestTable" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Tickets" EntityType="Self.Tickets" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Trains" EntityType="Self.Trains" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="TrainsCarriages" EntityType="Self.TrainsCarriages" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
         </EntityContainer>
       </Schema></edmx:StorageModels>
     <!-- CSDL content -->
@@ -69,6 +83,7 @@
           <EntitySet Name="Tickets" EntityType="RouteScheduleDataBaseModel.Tickets" />
           <EntitySet Name="Trains" EntityType="RouteScheduleDataBaseModel.Trains" />
           <EntitySet Name="TrainsCarriages" EntityType="RouteScheduleDataBaseModel.TrainsCarriages" />
+          <EntitySet Name="Users" EntityType="RouteScheduleDataBaseModel.Users" />
         </EntityContainer>
         <EntityType Name="Routes">
           <Key>
@@ -78,8 +93,8 @@
           <Property Name="IdTrain" Type="Int32" Nullable="false" />
           <Property Name="Departure_Station" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
           <Property Name="Arrival_Station" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Departure_Date" Type="DateTime" Nullable="false" Precision="0" />
-          <Property Name="Arrival_Date" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="Departure_Date" Type="DateTime" Nullable="false" Precision="3" />
+          <Property Name="Arrival_Date" Type="DateTime" Nullable="false" Precision="3" />
         </EntityType>
         <EntityType Name="TestTable">
           <Key>
@@ -89,19 +104,20 @@
           <Property Name="IdTrain" Type="Int32" Nullable="false" />
           <Property Name="Departure" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
           <Property Name="Arrival" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="DepartureDate" Type="DateTime" Nullable="false" Precision="0" />
-          <Property Name="ArrivalDate" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="DepartureDate" Type="DateTime" Nullable="false" Precision="3" />
+          <Property Name="ArrivalDate" Type="DateTime" Nullable="false" Precision="3" />
         </EntityType>
         <EntityType Name="Tickets">
           <Key>
             <PropertyRef Name="IdTicket" />
           </Key>
           <Property Name="IdTicket" Type="Int32" Nullable="false" />
+          <Property Name="IdUser" Type="Int32" Nullable="false" />
           <Property Name="IdRoute" Type="Int32" Nullable="false" />
           <Property Name="IdTrainCarriage" Type="Int32" Nullable="false" />
           <Property Name="PlaceNumber" Type="Int32" Nullable="false" />
           <Property Name="Category" Type="Int32" Nullable="false" />
-          <Property Name="BuyDate" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="BuyDate" Type="DateTime" Nullable="false" Precision="3" />
         </EntityType>
         <EntityType Name="Trains">
           <Key>
@@ -117,12 +133,24 @@
           <Property Name="IdCarriage" Type="Int32" Nullable="false" />
           <Property Name="Count" Type="Int32" Nullable="false" />
         </EntityType>
+        <EntityType Name="Users">
+          <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" />
+          <Property Name="Passport" Type="String" MaxLength="10" FixedLength="false" Unicode="true" />
+          <Property Name="Surname" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="Patronymic" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
+        </EntityType>
       </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="Хранилище RouteScheduleDataBaseModelContainer" CdmEntityContainer="RouteScheduleDataBaseEntities">
+    <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
+  <EntityContainerMapping StorageEntityContainer="RouteScheduleDataBaseModelStoreContainer" CdmEntityContainer="RouteScheduleDataBaseEntities">
           <EntitySetMapping Name="Routes">
             <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Routes">
               <MappingFragment StoreEntitySet="Routes">
@@ -155,6 +183,7 @@
                 <ScalarProperty Name="PlaceNumber" ColumnName="PlaceNumber" />
                 <ScalarProperty Name="IdTrainCarriage" ColumnName="IdTrainCarriage" />
                 <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
                 <ScalarProperty Name="IdTicket" ColumnName="IdTicket" />
               </MappingFragment>
             </EntityTypeMapping>
@@ -175,9 +204,21 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <EntitySetMapping Name="Users">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Users">
+              <MappingFragment StoreEntitySet="Users">
+                <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Surname" ColumnName="Surname" />
+                <ScalarProperty Name="Passport" ColumnName="Passport" />
+                <ScalarProperty Name="Password" ColumnName="Password" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
         </EntityContainerMapping>
-      </Mapping>
-    </edmx:Mappings>
+</Mapping></edmx:Mappings>
   </edmx:Runtime>
   <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
   <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
@@ -191,7 +232,7 @@
         <DesignerProperty Name="ValidateOnBuild" Value="true" />
         <DesignerProperty Name="EnablePluralization" Value="false" />
         <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
-        <DesignerProperty Name="UseLegacyProvider" Value="false" />
+        <DesignerProperty Name="UseLegacyProvider" Value="False" />
         <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
       </DesignerInfoPropertySet>
     </Options>

+ 1 - 0
RaspisKusach/EDM.edmx.diagram

@@ -10,6 +10,7 @@
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Tickets" Width="1.5" PointX="0.75" PointY="3.75" />
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Trains" Width="1.5" PointX="2.75" PointY="3.75" />
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.TrainsCarriages" Width="1.5" PointX="4.75" PointY="0.75" />
+        <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Users" Width="1.5" PointX="4.75" PointY="3.75" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 132 - 0
RaspisKusach/EDM.edmx.sql

@@ -0,0 +1,132 @@
+
+-- --------------------------------------------------
+-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
+-- --------------------------------------------------
+-- Date Created: 07/22/2022 23:57:11
+-- Generated from EDMX file: C:\Users\pc\source\repos\RaspisKusach\RaspisKusach\EDM.edmx
+-- --------------------------------------------------
+
+SET QUOTED_IDENTIFIER OFF;
+GO
+USE [RouteScheduleDataBase];
+GO
+IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
+GO
+
+-- --------------------------------------------------
+-- Dropping existing FOREIGN KEY constraints
+-- --------------------------------------------------
+
+
+-- --------------------------------------------------
+-- Dropping existing tables
+-- --------------------------------------------------
+
+IF OBJECT_ID(N'[dbo].[Routes]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Routes];
+GO
+IF OBJECT_ID(N'[dbo].[TestTable]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[TestTable];
+GO
+IF OBJECT_ID(N'[dbo].[Tickets]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Tickets];
+GO
+IF OBJECT_ID(N'[dbo].[Trains]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Trains];
+GO
+IF OBJECT_ID(N'[dbo].[TrainsCarriages]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[TrainsCarriages];
+GO
+
+-- --------------------------------------------------
+-- Creating all tables
+-- --------------------------------------------------
+
+-- Creating table 'Routes'
+CREATE TABLE [dbo].[Routes] (
+    [IdRoute] int  NOT NULL,
+    [IdTrain] int  NOT NULL,
+    [Departure_Station] nvarchar(50)  NOT NULL,
+    [Arrival_Station] nvarchar(50)  NOT NULL,
+    [Departure_Date] datetime  NOT NULL,
+    [Arrival_Date] datetime  NOT NULL
+);
+GO
+
+-- Creating table 'TestTable'
+CREATE TABLE [dbo].[TestTable] (
+    [IdRoute] int  NOT NULL,
+    [IdTrain] int  NOT NULL,
+    [Departure] nvarchar(50)  NOT NULL,
+    [Arrival] nvarchar(50)  NOT NULL,
+    [DepartureDate] datetime  NOT NULL,
+    [ArrivalDate] datetime  NOT NULL
+);
+GO
+
+-- Creating table 'Tickets'
+CREATE TABLE [dbo].[Tickets] (
+    [IdTicket] int  NOT NULL,
+    [IdRoute] int  NOT NULL,
+    [IdTrainCarriage] int  NOT NULL,
+    [PlaceNumber] int  NOT NULL,
+    [Category] int  NOT NULL,
+    [BuyDate] datetime  NOT NULL
+);
+GO
+
+-- Creating table 'Trains'
+CREATE TABLE [dbo].[Trains] (
+    [IdTrain] int  NOT NULL,
+    [NameOfTrain] nvarchar(50)  NOT NULL
+);
+GO
+
+-- Creating table 'TrainsCarriages'
+CREATE TABLE [dbo].[TrainsCarriages] (
+    [IdCarriage] int  NOT NULL,
+    [Count] int  NOT NULL
+);
+GO
+
+-- --------------------------------------------------
+-- Creating all PRIMARY KEY constraints
+-- --------------------------------------------------
+
+-- Creating primary key on [IdRoute] in table 'Routes'
+ALTER TABLE [dbo].[Routes]
+ADD CONSTRAINT [PK_Routes]
+    PRIMARY KEY CLUSTERED ([IdRoute] ASC);
+GO
+
+-- Creating primary key on [IdRoute] in table 'TestTable'
+ALTER TABLE [dbo].[TestTable]
+ADD CONSTRAINT [PK_TestTable]
+    PRIMARY KEY CLUSTERED ([IdRoute] ASC);
+GO
+
+-- Creating primary key on [IdTicket] in table 'Tickets'
+ALTER TABLE [dbo].[Tickets]
+ADD CONSTRAINT [PK_Tickets]
+    PRIMARY KEY CLUSTERED ([IdTicket] ASC);
+GO
+
+-- Creating primary key on [IdTrain] in table 'Trains'
+ALTER TABLE [dbo].[Trains]
+ADD CONSTRAINT [PK_Trains]
+    PRIMARY KEY CLUSTERED ([IdTrain] ASC);
+GO
+
+-- Creating primary key on [IdCarriage] in table 'TrainsCarriages'
+ALTER TABLE [dbo].[TrainsCarriages]
+ADD CONSTRAINT [PK_TrainsCarriages]
+    PRIMARY KEY CLUSTERED ([IdCarriage] ASC);
+GO
+
+-- --------------------------------------------------
+-- Creating all FOREIGN KEY constraints
+-- --------------------------------------------------
+
+-- --------------------------------------------------
+-- Script has ended
+-- --------------------------------------------------

+ 4 - 0
RaspisKusach/RaspisKusach.csproj

@@ -108,6 +108,9 @@
     <Compile Include="TrainsCarriages.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
+    <Compile Include="Users.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -180,6 +183,7 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.Context.cs</LastGenOutput>
     </Content>
+    <Content Include="EDM.edmx.sql" />
     <Content Include="EDM.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <DependentUpon>EDM.edmx</DependentUpon>

+ 1 - 0
RaspisKusach/Tickets.cs

@@ -15,6 +15,7 @@ namespace RaspisKusach
     public partial class Tickets
     {
         public int IdTicket { get; set; }
+        public int IdUser { get; set; }
         public int IdRoute { get; set; }
         public int IdTrainCarriage { get; set; }
         public int PlaceNumber { get; set; }

+ 25 - 0
RaspisKusach/Users.cs

@@ -0,0 +1,25 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace RaspisKusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Users
+    {
+        public int IdUser { get; set; }
+        public string Login { get; set; }
+        public string Password { get; set; }
+        public string Passport { get; set; }
+        public string Surname { get; set; }
+        public string Name { get; set; }
+        public string Patronymic { get; set; }
+    }
+}