Imagara 2 лет назад
Родитель
Сommit
ea145a2cde

+ 5 - 1
RaspisKusach/EDM.Context.cs

@@ -25,6 +25,10 @@ namespace RaspisKusach
             throw new UnintentionalCodeFirstException();
         }
     
-        public virtual DbSet<Table> Table { get; set; }
+        public virtual DbSet<Routes> Routes { get; set; }
+        public virtual DbSet<TestTable> TestTable { get; set; }
+        public virtual DbSet<Tickets> Tickets { get; set; }
+        public virtual DbSet<Trains> Trains { get; set; }
+        public virtual DbSet<TrainsCarriages> TrainsCarriages { get; set; }
     }
 }

+ 137 - 18
RaspisKusach/EDM.edmx

@@ -4,8 +4,19 @@
   <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">
-        <EntityType Name="Table">
+    <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">
+        <EntityType Name="Routes">
+          <Key>
+            <PropertyRef Name="IdRoute" />
+          </Key>
+          <Property Name="IdRoute" Type="int" Nullable="false" />
+          <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" />
+        </EntityType>
+        <EntityType Name="TestTable">
           <Key>
             <PropertyRef Name="IdRoute" />
           </Key>
@@ -16,43 +27,151 @@
           <Property Name="DepartureDate" Type="date" Nullable="false" />
           <Property Name="ArrivalDate" Type="date" Nullable="false" />
         </EntityType>
+        <EntityType Name="Tickets">
+          <Key>
+            <PropertyRef Name="IdTicket" />
+          </Key>
+          <Property Name="IdTicket" 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" />
+        </EntityType>
+        <EntityType Name="Trains">
+          <Key>
+            <PropertyRef Name="IdTrain" />
+          </Key>
+          <Property Name="IdTrain" Type="int" Nullable="false" />
+          <Property Name="NameOfTrain" Type="nvarchar" MaxLength="50" Nullable="false" />
+        </EntityType>
+        <EntityType Name="TrainsCarriages">
+          <Key>
+            <PropertyRef Name="IdCarriage" />
+          </Key>
+          <Property Name="IdCarriage" Type="int" Nullable="false" />
+          <Property Name="Count" Type="int" Nullable="false" />
+        </EntityType>
         <EntityContainer Name="Хранилище RouteScheduleDataBaseModelContainer">
-          <EntitySet Name="Table" EntityType="Self.Table" Schema="dbo" store:Type="Tables" />
+          <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" />
         </EntityContainer>
-      </Schema>
-    </edmx:StorageModels>
+      </Schema></edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="RouteScheduleDataBaseModel" 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="Table">
+        <EntityContainer Name="RouteScheduleDataBaseEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Routes" EntityType="RouteScheduleDataBaseModel.Routes" />
+          <EntitySet Name="TestTable" EntityType="RouteScheduleDataBaseModel.TestTable" />
+          <EntitySet Name="Tickets" EntityType="RouteScheduleDataBaseModel.Tickets" />
+          <EntitySet Name="Trains" EntityType="RouteScheduleDataBaseModel.Trains" />
+          <EntitySet Name="TrainsCarriages" EntityType="RouteScheduleDataBaseModel.TrainsCarriages" />
+        </EntityContainer>
+        <EntityType Name="Routes">
+          <Key>
+            <PropertyRef Name="IdRoute" />
+          </Key>
+          <Property Name="IdRoute" Type="Int32" Nullable="false" />
+          <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" />
+        </EntityType>
+        <EntityType Name="TestTable">
           <Key>
             <PropertyRef Name="IdRoute" />
           </Key>
           <Property Name="IdRoute" Type="Int32" Nullable="false" />
           <Property Name="IdTrain" Type="Int32" Nullable="false" />
-          <Property Name="Departure" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
-          <Property Name="Arrival" Type="String" MaxLength="50" FixedLength="false" Unicode="true" 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" />
         </EntityType>
-        <EntityContainer Name="RouteScheduleDataBaseEntities" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Table" EntityType="Self.Table" />
-        </EntityContainer>
+        <EntityType Name="Tickets">
+          <Key>
+            <PropertyRef Name="IdTicket" />
+          </Key>
+          <Property Name="IdTicket" 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" />
+        </EntityType>
+        <EntityType Name="Trains">
+          <Key>
+            <PropertyRef Name="IdTrain" />
+          </Key>
+          <Property Name="IdTrain" Type="Int32" Nullable="false" />
+          <Property Name="NameOfTrain" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="TrainsCarriages">
+          <Key>
+            <PropertyRef Name="IdCarriage" />
+          </Key>
+          <Property Name="IdCarriage" Type="Int32" Nullable="false" />
+          <Property Name="Count" Type="Int32" Nullable="false" />
+        </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">
-          <EntitySetMapping Name="Table">
-            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Table">
-              <MappingFragment StoreEntitySet="Table">
-                <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+          <EntitySetMapping Name="Routes">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Routes">
+              <MappingFragment StoreEntitySet="Routes">
+                <ScalarProperty Name="Arrival_Date" ColumnName="Arrival_Date" />
+                <ScalarProperty Name="Departure_Date" ColumnName="Departure_Date" />
+                <ScalarProperty Name="Arrival_Station" ColumnName="Arrival_Station" />
+                <ScalarProperty Name="Departure_Station" ColumnName="Departure_Station" />
                 <ScalarProperty Name="IdTrain" ColumnName="IdTrain" />
-                <ScalarProperty Name="Departure" ColumnName="Departure" />
-                <ScalarProperty Name="Arrival" ColumnName="Arrival" />
-                <ScalarProperty Name="DepartureDate" ColumnName="DepartureDate" />
+                <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="TestTable">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.TestTable">
+              <MappingFragment StoreEntitySet="TestTable">
                 <ScalarProperty Name="ArrivalDate" ColumnName="ArrivalDate" />
+                <ScalarProperty Name="DepartureDate" ColumnName="DepartureDate" />
+                <ScalarProperty Name="Arrival" ColumnName="Arrival" />
+                <ScalarProperty Name="Departure" ColumnName="Departure" />
+                <ScalarProperty Name="IdTrain" ColumnName="IdTrain" />
+                <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Tickets">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Tickets">
+              <MappingFragment StoreEntitySet="Tickets">
+                <ScalarProperty Name="BuyDate" ColumnName="BuyDate" />
+                <ScalarProperty Name="Category" ColumnName="Category" />
+                <ScalarProperty Name="PlaceNumber" ColumnName="PlaceNumber" />
+                <ScalarProperty Name="IdTrainCarriage" ColumnName="IdTrainCarriage" />
+                <ScalarProperty Name="IdRoute" ColumnName="IdRoute" />
+                <ScalarProperty Name="IdTicket" ColumnName="IdTicket" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Trains">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Trains">
+              <MappingFragment StoreEntitySet="Trains">
+                <ScalarProperty Name="NameOfTrain" ColumnName="NameOfTrain" />
+                <ScalarProperty Name="IdTrain" ColumnName="IdTrain" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="TrainsCarriages">
+            <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.TrainsCarriages">
+              <MappingFragment StoreEntitySet="TrainsCarriages">
+                <ScalarProperty Name="Count" ColumnName="Count" />
+                <ScalarProperty Name="IdCarriage" ColumnName="IdCarriage" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>

+ 5 - 1
RaspisKusach/EDM.edmx.diagram

@@ -5,7 +5,11 @@
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
       <Diagram DiagramId="cbfc4ddba6b5479eb5c52b1c4156acc9" Name="Diagram1">
-        <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Table" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Routes" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="RouteScheduleDataBaseModel.TestTable" Width="1.5" PointX="2.75" PointY="0.75" />
+        <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" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 3 - 2
RaspisKusach/MainWindow.xaml

@@ -22,9 +22,10 @@
                 MouseDown="Border_MouseDown">
             <Grid HorizontalAlignment="Stretch" Background="WhiteSmoke">
                 <StackPanel Orientation="Horizontal">
-                    <Image Source="/Resources/StandartProfile.png" 
+                    <Image Source="/Resources/Train.png"
+                           Margin="5,0,0,0"
                            Height="{Binding Path=ActualHeight, ElementName=Bar}"/>
-                    <Label Content="dfgdfgdfg"
+                    <Label Content="Поездочка"
                        Foreground="Gray"
                        FontWeight="SemiBold"/>
                 </StackPanel>

+ 14 - 1
RaspisKusach/RaspisKusach.csproj

@@ -91,9 +91,21 @@
     <Compile Include="Pages\RegisterPage.xaml.cs">
       <DependentUpon>RegisterPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Routes.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
     <Compile Include="Session.cs" />
     <Compile Include="Styles\Style.cs" />
-    <Compile Include="Table.cs">
+    <Compile Include="TestTable.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Tickets.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Trains.cs">
+      <DependentUpon>EDM.tt</DependentUpon>
+    </Compile>
+    <Compile Include="TrainsCarriages.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
     <Page Include="MainWindow.xaml">
@@ -173,6 +185,7 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.cs</LastGenOutput>
     </Content>
+    <Resource Include="Resources\Train.png" />
     <Resource Include="Resources\Background.jpg" />
   </ItemGroup>
   <ItemGroup>

BIN
RaspisKusach/Resources/Train.png


+ 24 - 0
RaspisKusach/Routes.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace RaspisKusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Routes
+    {
+        public int IdRoute { get; set; }
+        public int IdTrain { get; set; }
+        public string Departure_Station { get; set; }
+        public string Arrival_Station { get; set; }
+        public System.DateTime Departure_Date { get; set; }
+        public System.DateTime Arrival_Date { get; set; }
+    }
+}

+ 16 - 8
RaspisKusach/Styles/Style.cs

@@ -1,12 +1,20 @@
-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.Media;
+using System.Windows.Input;
 
-namespace RaspisKusach.Styles
+namespace RaspisKusach
 {
-    class Style
+    public partial class Style : ResourceDictionary
     {
+        private void MouseEnter(object sender, MouseEventArgs e)
+        {
+            ((Border)sender).BorderBrush = new SolidColorBrush(Color.FromRgb(0x8B, 0x00, 0xFF));
+        }//#8B00FF
+
+        private void MouseLeave(object sender, MouseEventArgs e)
+        {
+            ((Border)sender).BorderBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x00, 0x00));
+        }
     }
-}
+}

+ 4 - 2
RaspisKusach/Styles/Style.xaml

@@ -1,6 +1,6 @@
 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-                    x:Class="PaspisKusach.Style">
+                    x:Class="RaspisKusach.Style">
     
     
     <SolidColorBrush x:Key="TextColor" 
@@ -31,7 +31,9 @@
                             CornerRadius="10"
                             Background="DimGray"
                             BorderBrush="Black"
-                            BorderThickness="1">
+                            BorderThickness="1"
+                            MouseEnter="MouseEnter" 
+                            MouseLeave="MouseLeave">
                         <ContentPresenter HorizontalAlignment="Center" 
                                           VerticalAlignment="Center"/>
                     </Border>

+ 1 - 1
RaspisKusach/Table.cs

@@ -12,7 +12,7 @@ namespace RaspisKusach
     using System;
     using System.Collections.Generic;
     
-    public partial class Table
+    public partial class TestTable
     {
         public int IdRoute { get; set; }
         public int IdTrain { get; set; }

+ 24 - 0
RaspisKusach/Tickets.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace RaspisKusach
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Tickets
+    {
+        public int IdTicket { get; set; }
+        public int IdRoute { get; set; }
+        public int IdTrainCarriage { get; set; }
+        public int PlaceNumber { get; set; }
+        public int Category { get; set; }
+        public System.DateTime BuyDate { get; set; }
+    }
+}

+ 20 - 0
RaspisKusach/Trains.cs

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

+ 20 - 0
RaspisKusach/TrainsCarriages.cs

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