Фельдбейн Артур Станиславович 3 gadi atpakaļ
vecāks
revīzija
f7e89f9900

BIN
DB.vsdx


BIN
Kafe/.vs/Kafe/v17/.suo


+ 1 - 1
Kafe/Kafe/App.config

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

+ 29 - 0
Kafe/Kafe/CookStatus.cs

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

+ 2 - 2
Kafe/Kafe/Dishes.cs

@@ -17,7 +17,7 @@ namespace Kafe
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Dishes()
         {
-            this.OrderDishes = new HashSet<OrderDishes>();
+            this.Order = new HashSet<Order>();
         }
     
         public int ID { get; set; }
@@ -26,6 +26,6 @@ namespace Kafe
         public int CookTime { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<OrderDishes> OrderDishes { get; set; }
+        public virtual ICollection<Order> Order { get; set; }
     }
 }

+ 3 - 0
Kafe/Kafe/Employee.cs

@@ -18,6 +18,7 @@ namespace Kafe
         public Employee()
         {
             this.Order = new HashSet<Order>();
+            this.Shift = new HashSet<Shift>();
         }
     
         public int ID { get; set; }
@@ -33,5 +34,7 @@ namespace Kafe
         public virtual Status Status { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<Order> Order { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Shift> Shift { get; set; }
     }
 }

+ 19 - 0
Kafe/Kafe/Helper.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Kafe
+{
+    public class Helper
+    {
+        private static KafeDBEntities s_context;
+        public static KafeDBEntities GetContext()
+        {
+            if (s_context == null)
+                s_context = new KafeDBEntities();
+            return s_context;
+        }
+    }
+}

+ 1 - 52
Kafe/Kafe/Kafe.csproj

@@ -64,29 +64,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Compile Include="Dishes.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Employee.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Model.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Order.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="OrderDishes.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Position.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Status.cs">
-      <DependentUpon>Model.tt</DependentUpon>
-    </Compile>
+    <Compile Include="Helper.cs" />
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -101,16 +79,6 @@
     </Compile>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Model.Context.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Model.Context.tt</DependentUpon>
-    </Compile>
-    <Compile Include="Model.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Model.edmx</DependentUpon>
-    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -128,13 +96,6 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
-    <EntityDeploy Include="Model.edmx">
-      <Generator>EntityModelCodeGenerator</Generator>
-      <LastGenOutput>Model.Designer.cs</LastGenOutput>
-    </EntityDeploy>
-    <None Include="Model.edmx.diagram">
-      <DependentUpon>Model.edmx</DependentUpon>
-    </None>
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
@@ -147,17 +108,5 @@
   <ItemGroup>
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
-  <ItemGroup>
-    <Content Include="Model.Context.tt">
-      <Generator>TextTemplatingFileGenerator</Generator>
-      <DependentUpon>Model.edmx</DependentUpon>
-      <LastGenOutput>Model.Context.cs</LastGenOutput>
-    </Content>
-    <Content Include="Model.tt">
-      <Generator>TextTemplatingFileGenerator</Generator>
-      <DependentUpon>Model.edmx</DependentUpon>
-      <LastGenOutput>Model.cs</LastGenOutput>
-    </Content>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 3 - 1
Kafe/Kafe/Model.Context.cs

@@ -25,11 +25,13 @@ namespace Kafe
             throw new UnintentionalCodeFirstException();
         }
     
+        public virtual DbSet<CookStatus> CookStatus { get; set; }
         public virtual DbSet<Dishes> Dishes { get; set; }
         public virtual DbSet<Employee> Employee { get; set; }
         public virtual DbSet<Order> Order { get; set; }
-        public virtual DbSet<OrderDishes> OrderDishes { get; set; }
+        public virtual DbSet<PayStatus> PayStatus { get; set; }
         public virtual DbSet<Position> Position { get; set; }
+        public virtual DbSet<Shift> Shift { get; set; }
         public virtual DbSet<Status> Status { get; set; }
     }
 }

+ 187 - 35
Kafe/Kafe/Model.edmx

@@ -5,6 +5,13 @@
     <!-- SSDL content -->
     <edmx:StorageModels>
       <Schema Namespace="Хранилище KafeDBModel" 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="CookStatus">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
+        </EntityType>
         <EntityType Name="Dishes">
           <Key>
             <PropertyRef Name="ID" />
@@ -35,6 +42,8 @@
           <Property Name="TableNumber" Type="int" Nullable="false" />
           <Property Name="ClientCount" Type="int" Nullable="false" />
           <Property Name="EmployeeID" Type="int" Nullable="false" />
+          <Property Name="PayStatusID" Type="int" Nullable="false" />
+          <Property Name="CookStatusID" Type="int" Nullable="false" />
         </EntityType>
         <EntityType Name="OrderDishes">
           <Key>
@@ -43,7 +52,13 @@
           </Key>
           <Property Name="OrderID" Type="int" Nullable="false" />
           <Property Name="DishID" Type="int" Nullable="false" />
-          <Property Name="Price" Type="int" />
+        </EntityType>
+        <EntityType Name="PayStatus">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
         </EntityType>
         <EntityType Name="Position">
           <Key>
@@ -52,6 +67,14 @@
           <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
           <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
         </EntityType>
+        <EntityType Name="Shift">
+          <Key>
+            <PropertyRef Name="EmployeeID" />
+            <PropertyRef Name="DateShift" />
+          </Key>
+          <Property Name="EmployeeID" Type="int" Nullable="false" />
+          <Property Name="DateShift" Type="date" Nullable="false" />
+        </EntityType>
         <EntityType Name="Status">
           <Key>
             <PropertyRef Name="ID" />
@@ -87,6 +110,20 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <Association Name="FK_Order_CookStatus">
+          <End Role="CookStatus" Type="Self.CookStatus" Multiplicity="1">
+            <OnDelete Action="Cascade" />
+          </End>
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="CookStatus">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Order">
+              <PropertyRef Name="CookStatusID" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <Association Name="FK_Order_Employee">
           <End Role="Employee" Type="Self.Employee" Multiplicity="1" />
           <End Role="Order" Type="Self.Order" Multiplicity="*" />
@@ -99,6 +136,20 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <Association Name="FK_Order_PayStatus">
+          <End Role="PayStatus" Type="Self.PayStatus" Multiplicity="1">
+            <OnDelete Action="Cascade" />
+          </End>
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="PayStatus">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Order">
+              <PropertyRef Name="PayStatusID" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <Association Name="FK_OrderDishes_Dishes">
           <End Role="Dishes" Type="Self.Dishes" Multiplicity="1">
             <OnDelete Action="Cascade" />
@@ -127,12 +178,29 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <Association Name="FK_Shift_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1">
+            <OnDelete Action="Cascade" />
+          </End>
+          <End Role="Shift" Type="Self.Shift" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Employee">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Shift">
+              <PropertyRef Name="EmployeeID" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <EntityContainer Name="Хранилище KafeDBModelContainer">
+          <EntitySet Name="CookStatus" EntityType="Self.CookStatus" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Dishes" EntityType="Self.Dishes" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Employee" EntityType="Self.Employee" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Order" EntityType="Self.Order" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="OrderDishes" EntityType="Self.OrderDishes" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="PayStatus" EntityType="Self.PayStatus" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Position" EntityType="Self.Position" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Shift" EntityType="Self.Shift" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Status" EntityType="Self.Status" Schema="dbo" store:Type="Tables" />
           <AssociationSet Name="FK_Employee_Position" Association="Self.FK_Employee_Position">
             <End Role="Position" EntitySet="Position" />
@@ -142,10 +210,18 @@
             <End Role="Status" EntitySet="Status" />
             <End Role="Employee" EntitySet="Employee" />
           </AssociationSet>
+          <AssociationSet Name="FK_Order_CookStatus" Association="Self.FK_Order_CookStatus">
+            <End Role="CookStatus" EntitySet="CookStatus" />
+            <End Role="Order" EntitySet="Order" />
+          </AssociationSet>
           <AssociationSet Name="FK_Order_Employee" Association="Self.FK_Order_Employee">
             <End Role="Employee" EntitySet="Employee" />
             <End Role="Order" EntitySet="Order" />
           </AssociationSet>
+          <AssociationSet Name="FK_Order_PayStatus" Association="Self.FK_Order_PayStatus">
+            <End Role="PayStatus" EntitySet="PayStatus" />
+            <End Role="Order" EntitySet="Order" />
+          </AssociationSet>
           <AssociationSet Name="FK_OrderDishes_Dishes" Association="Self.FK_OrderDishes_Dishes">
             <End Role="Dishes" EntitySet="Dishes" />
             <End Role="OrderDishes" EntitySet="OrderDishes" />
@@ -154,12 +230,24 @@
             <End Role="Order" EntitySet="Order" />
             <End Role="OrderDishes" EntitySet="OrderDishes" />
           </AssociationSet>
+          <AssociationSet Name="FK_Shift_Employee" Association="Self.FK_Shift_Employee">
+            <End Role="Employee" EntitySet="Employee" />
+            <End Role="Shift" EntitySet="Shift" />
+          </AssociationSet>
         </EntityContainer>
       </Schema>
     </edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="KafeDBModel" 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="CookStatus">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Order" Relationship="Self.FK_Order_CookStatus" FromRole="CookStatus" ToRole="Order" />
+        </EntityType>
         <EntityType Name="Dishes">
           <Key>
             <PropertyRef Name="ID" />
@@ -168,7 +256,7 @@
           <Property Name="Title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="Cost" Type="Double" Nullable="false" />
           <Property Name="CookTime" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="OrderDishes" Relationship="Self.FK_OrderDishes_Dishes" FromRole="Dishes" ToRole="OrderDishes" />
+          <NavigationProperty Name="Order" Relationship="Self.OrderDishes" FromRole="Dishes" ToRole="Order" />
         </EntityType>
         <EntityType Name="Employee">
           <Key>
@@ -185,6 +273,7 @@
           <NavigationProperty Name="Position" Relationship="Self.FK_Employee_Position" FromRole="Employee" ToRole="Position" />
           <NavigationProperty Name="Status" Relationship="Self.FK_Employee_Status" FromRole="Employee" ToRole="Status" />
           <NavigationProperty Name="Order" Relationship="Self.FK_Order_Employee" FromRole="Employee" ToRole="Order" />
+          <NavigationProperty Name="Shift" Relationship="Self.FK_Shift_Employee" FromRole="Employee" ToRole="Shift" />
         </EntityType>
         <EntityType Name="Order">
           <Key>
@@ -194,19 +283,20 @@
           <Property Name="TableNumber" Type="Int32" Nullable="false" />
           <Property Name="ClientCount" Type="Int32" Nullable="false" />
           <Property Name="EmployeeID" Type="Int32" Nullable="false" />
+          <Property Name="PayStatusID" Type="Int32" Nullable="false" />
+          <Property Name="CookStatusID" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="CookStatus" Relationship="Self.FK_Order_CookStatus" FromRole="Order" ToRole="CookStatus" />
           <NavigationProperty Name="Employee" Relationship="Self.FK_Order_Employee" FromRole="Order" ToRole="Employee" />
-          <NavigationProperty Name="OrderDishes" Relationship="Self.FK_OrderDishes_Order" FromRole="Order" ToRole="OrderDishes" />
+          <NavigationProperty Name="PayStatus" Relationship="Self.FK_Order_PayStatus" FromRole="Order" ToRole="PayStatus" />
+          <NavigationProperty Name="Dishes" Relationship="Self.OrderDishes" FromRole="Order" ToRole="Dishes" />
         </EntityType>
-        <EntityType Name="OrderDishes">
+        <EntityType Name="PayStatus">
           <Key>
-            <PropertyRef Name="OrderID" />
-            <PropertyRef Name="DishID" />
+            <PropertyRef Name="ID" />
           </Key>
-          <Property Name="OrderID" Type="Int32" Nullable="false" />
-          <Property Name="DishID" Type="Int32" Nullable="false" />
-          <Property Name="Price" Type="Int32" />
-          <NavigationProperty Name="Dishes" Relationship="Self.FK_OrderDishes_Dishes" FromRole="OrderDishes" ToRole="Dishes" />
-          <NavigationProperty Name="Order" Relationship="Self.FK_OrderDishes_Order" FromRole="OrderDishes" ToRole="Order" />
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Order" Relationship="Self.FK_Order_PayStatus" FromRole="PayStatus" ToRole="Order" />
         </EntityType>
         <EntityType Name="Position">
           <Key>
@@ -216,6 +306,15 @@
           <Property Name="Title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <NavigationProperty Name="Employee" Relationship="Self.FK_Employee_Position" FromRole="Position" ToRole="Employee" />
         </EntityType>
+        <EntityType Name="Shift">
+          <Key>
+            <PropertyRef Name="EmployeeID" />
+            <PropertyRef Name="DateShift" />
+          </Key>
+          <Property Name="EmployeeID" Type="Int32" Nullable="false" />
+          <Property Name="DateShift" Type="DateTime" Nullable="false" Precision="0" />
+          <NavigationProperty Name="Employee" Relationship="Self.FK_Shift_Employee" FromRole="Shift" ToRole="Employee" />
+        </EntityType>
         <EntityType Name="Status">
           <Key>
             <PropertyRef Name="ID" />
@@ -224,17 +323,17 @@
           <Property Name="Title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <NavigationProperty Name="Employee" Relationship="Self.FK_Employee_Status" FromRole="Status" ToRole="Employee" />
         </EntityType>
-        <Association Name="FK_OrderDishes_Dishes">
-          <End Role="Dishes" Type="Self.Dishes" Multiplicity="1">
+        <Association Name="FK_Order_CookStatus">
+          <End Role="CookStatus" Type="Self.CookStatus" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Role="OrderDishes" Type="Self.OrderDishes" Multiplicity="*" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Dishes">
+            <Principal Role="CookStatus">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="OrderDishes">
-              <PropertyRef Name="DishID" />
+            <Dependent Role="Order">
+              <PropertyRef Name="CookStatusID" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
@@ -278,30 +377,50 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_OrderDishes_Order">
-          <End Role="Order" Type="Self.Order" Multiplicity="1">
+        <Association Name="FK_Shift_Employee">
+          <End Role="Employee" Type="Self.Employee" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Role="OrderDishes" Type="Self.OrderDishes" Multiplicity="*" />
+          <End Role="Shift" Type="Self.Shift" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Order">
+            <Principal Role="Employee">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="OrderDishes">
-              <PropertyRef Name="OrderID" />
+            <Dependent Role="Shift">
+              <PropertyRef Name="EmployeeID" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <Association Name="FK_Order_PayStatus">
+          <End Role="PayStatus" Type="Self.PayStatus" Multiplicity="1">
+            <OnDelete Action="Cascade" />
+          </End>
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="PayStatus">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Order">
+              <PropertyRef Name="PayStatusID" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="OrderDishes">
+          <End Role="Dishes" Type="Self.Dishes" Multiplicity="*" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
+        </Association>
         <EntityContainer Name="KafeDBEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="CookStatus" EntityType="Self.CookStatus" />
           <EntitySet Name="Dishes" EntityType="Self.Dishes" />
           <EntitySet Name="Employee" EntityType="Self.Employee" />
           <EntitySet Name="Order" EntityType="Self.Order" />
-          <EntitySet Name="OrderDishes" EntityType="Self.OrderDishes" />
+          <EntitySet Name="PayStatus" EntityType="Self.PayStatus" />
           <EntitySet Name="Position" EntityType="Self.Position" />
+          <EntitySet Name="Shift" EntityType="Self.Shift" />
           <EntitySet Name="Status" EntityType="Self.Status" />
-          <AssociationSet Name="FK_OrderDishes_Dishes" Association="Self.FK_OrderDishes_Dishes">
-            <End Role="Dishes" EntitySet="Dishes" />
-            <End Role="OrderDishes" EntitySet="OrderDishes" />
+          <AssociationSet Name="FK_Order_CookStatus" Association="Self.FK_Order_CookStatus">
+            <End Role="CookStatus" EntitySet="CookStatus" />
+            <End Role="Order" EntitySet="Order" />
           </AssociationSet>
           <AssociationSet Name="FK_Employee_Position" Association="Self.FK_Employee_Position">
             <End Role="Position" EntitySet="Position" />
@@ -315,9 +434,17 @@
             <End Role="Employee" EntitySet="Employee" />
             <End Role="Order" EntitySet="Order" />
           </AssociationSet>
-          <AssociationSet Name="FK_OrderDishes_Order" Association="Self.FK_OrderDishes_Order">
+          <AssociationSet Name="FK_Shift_Employee" Association="Self.FK_Shift_Employee">
+            <End Role="Employee" EntitySet="Employee" />
+            <End Role="Shift" EntitySet="Shift" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Order_PayStatus" Association="Self.FK_Order_PayStatus">
+            <End Role="PayStatus" EntitySet="PayStatus" />
+            <End Role="Order" EntitySet="Order" />
+          </AssociationSet>
+          <AssociationSet Name="OrderDishes" Association="Self.OrderDishes">
+            <End Role="Dishes" EntitySet="Dishes" />
             <End Role="Order" EntitySet="Order" />
-            <End Role="OrderDishes" EntitySet="OrderDishes" />
           </AssociationSet>
         </EntityContainer>
       </Schema>
@@ -326,6 +453,14 @@
     <edmx:Mappings>
       <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
         <EntityContainerMapping StorageEntityContainer="Хранилище KafeDBModelContainer" CdmEntityContainer="KafeDBEntities">
+          <EntitySetMapping Name="CookStatus">
+            <EntityTypeMapping TypeName="KafeDBModel.CookStatus">
+              <MappingFragment StoreEntitySet="CookStatus">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Title" ColumnName="Title" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
           <EntitySetMapping Name="Dishes">
             <EntityTypeMapping TypeName="KafeDBModel.Dishes">
               <MappingFragment StoreEntitySet="Dishes">
@@ -357,15 +492,16 @@
                 <ScalarProperty Name="TableNumber" ColumnName="TableNumber" />
                 <ScalarProperty Name="ClientCount" ColumnName="ClientCount" />
                 <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
+                <ScalarProperty Name="PayStatusID" ColumnName="PayStatusID" />
+                <ScalarProperty Name="CookStatusID" ColumnName="CookStatusID" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
-          <EntitySetMapping Name="OrderDishes">
-            <EntityTypeMapping TypeName="KafeDBModel.OrderDishes">
-              <MappingFragment StoreEntitySet="OrderDishes">
-                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
-                <ScalarProperty Name="DishID" ColumnName="DishID" />
-                <ScalarProperty Name="Price" ColumnName="Price" />
+          <EntitySetMapping Name="PayStatus">
+            <EntityTypeMapping TypeName="KafeDBModel.PayStatus">
+              <MappingFragment StoreEntitySet="PayStatus">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Title" ColumnName="Title" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
@@ -377,6 +513,14 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <EntitySetMapping Name="Shift">
+            <EntityTypeMapping TypeName="KafeDBModel.Shift">
+              <MappingFragment StoreEntitySet="Shift">
+                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
+                <ScalarProperty Name="DateShift" ColumnName="DateShift" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
           <EntitySetMapping Name="Status">
             <EntityTypeMapping TypeName="KafeDBModel.Status">
               <MappingFragment StoreEntitySet="Status">
@@ -385,6 +529,14 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <AssociationSetMapping Name="OrderDishes" TypeName="KafeDBModel.OrderDishes" StoreEntitySet="OrderDishes">
+            <EndProperty Name="Dishes">
+              <ScalarProperty Name="ID" ColumnName="DishID" />
+            </EndProperty>
+            <EndProperty Name="Order">
+              <ScalarProperty Name="ID" ColumnName="OrderID" />
+            </EndProperty>
+          </AssociationSetMapping>
         </EntityContainerMapping>
       </Mapping>
     </edmx:Mappings>

+ 13 - 9
Kafe/Kafe/Model.edmx.diagram

@@ -4,18 +4,22 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="43e6c86b5fb54c3eb8040ccab837e5b9" Name="Diagram1">
-        <EntityTypeShape EntityType="KafeDBModel.Dishes" Width="1.5" PointX="5.25" PointY="5.5" IsExpanded="true" />
-        <EntityTypeShape EntityType="KafeDBModel.Employee" Width="1.5" PointX="3" PointY="1" IsExpanded="true" />
-        <EntityTypeShape EntityType="KafeDBModel.Order" Width="1.5" PointX="5.25" PointY="1.5" IsExpanded="true" />
-        <EntityTypeShape EntityType="KafeDBModel.OrderDishes" Width="1.5" PointX="7.5" PointY="1.5" IsExpanded="true" />
-        <EntityTypeShape EntityType="KafeDBModel.Position" Width="1.5" PointX="0.75" PointY="1.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="KafeDBModel.Status" Width="1.5" PointX="0.75" PointY="5.75" IsExpanded="true" />
-        <AssociationConnector Association="KafeDBModel.FK_OrderDishes_Dishes" ManuallyRouted="false" />
+      <Diagram DiagramId="93dbfb46cdeb4919abe11f1d01f5c784" Name="Diagram1">
+        <EntityTypeShape EntityType="KafeDBModel.CookStatus" Width="1.5" PointX="3" PointY="7.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Dishes" Width="1.5" PointX="3" PointY="10.25" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Employee" Width="1.5" PointX="3" PointY="2.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Order" Width="1.5" PointX="5.25" PointY="3.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.PayStatus" Width="1.5" PointX="3" PointY="13" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Position" Width="1.5" PointX="0.75" PointY="3.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Shift" Width="1.5" PointX="5.25" PointY="7.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="KafeDBModel.Status" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
+        <AssociationConnector Association="KafeDBModel.FK_Order_CookStatus" ManuallyRouted="false" />
         <AssociationConnector Association="KafeDBModel.FK_Employee_Position" ManuallyRouted="false" />
         <AssociationConnector Association="KafeDBModel.FK_Employee_Status" ManuallyRouted="false" />
         <AssociationConnector Association="KafeDBModel.FK_Order_Employee" ManuallyRouted="false" />
-        <AssociationConnector Association="KafeDBModel.FK_OrderDishes_Order" ManuallyRouted="false" />
+        <AssociationConnector Association="KafeDBModel.FK_Shift_Employee" ManuallyRouted="false" />
+        <AssociationConnector Association="KafeDBModel.FK_Order_PayStatus" ManuallyRouted="false" />
+        <AssociationConnector Association="KafeDBModel.OrderDishes" ManuallyRouted="false" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 6 - 2
Kafe/Kafe/Order.cs

@@ -17,16 +17,20 @@ namespace Kafe
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Order()
         {
-            this.OrderDishes = new HashSet<OrderDishes>();
+            this.Dishes = new HashSet<Dishes>();
         }
     
         public int ID { get; set; }
         public int TableNumber { get; set; }
         public int ClientCount { get; set; }
         public int EmployeeID { get; set; }
+        public int PayStatusID { get; set; }
+        public int CookStatusID { get; set; }
     
+        public virtual CookStatus CookStatus { get; set; }
         public virtual Employee Employee { get; set; }
+        public virtual PayStatus PayStatus { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<OrderDishes> OrderDishes { get; set; }
+        public virtual ICollection<Dishes> Dishes { get; set; }
     }
 }

+ 29 - 0
Kafe/Kafe/PayStatus.cs

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

+ 4 - 6
Kafe/Kafe/OrderDishes.cs

@@ -12,13 +12,11 @@ namespace Kafe
     using System;
     using System.Collections.Generic;
     
-    public partial class OrderDishes
+    public partial class Shift
     {
-        public int OrderID { get; set; }
-        public int DishID { get; set; }
-        public Nullable<int> Price { get; set; }
+        public int EmployeeID { get; set; }
+        public System.DateTime DateShift { get; set; }
     
-        public virtual Dishes Dishes { get; set; }
-        public virtual Order Order { get; set; }
+        public virtual Employee Employee { get; set; }
     }
 }

BIN
Kafe/Kafe/obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
Kafe/Kafe/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
Kafe/Kafe/obj/Debug/Kafe.csproj.AssemblyReference.cache


+ 6 - 0
Kafe/Kafe/obj/Debug/Kafe.csproj.FileListAbsolute.txt

@@ -0,0 +1,6 @@
+Z:\git\Kafe\Kafe\obj\Debug\Kafe.csproj.AssemblyReference.cache
+Z:\git\Kafe\Kafe\obj\Debug\Kafe.csproj.SuggestedBindingRedirects.cache
+Z:\git\Kafe\Kafe\obj\Debug\MainWindow.g.cs
+Z:\git\Kafe\Kafe\obj\Debug\App.g.cs
+Z:\git\Kafe\Kafe\obj\Debug\Kafe_MarkupCompile.cache
+Z:\git\Kafe\Kafe\obj\Debug\Kafe_MarkupCompile.lref

+ 0 - 0
Kafe/Kafe/obj/Debug/Kafe.csproj.SuggestedBindingRedirects.cache


+ 0 - 14
Kafe/Kafe/obj/Debug/Kafe_Content.g.cs

@@ -1,14 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     Этот код создан программой.
-//     Исполняемая версия:4.0.30319.42000
-//
-//     Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
-//     повторной генерации кода.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("model.context.tt")]
-[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("model.tt")]
-
-

+ 2 - 2
Kafe/Kafe/obj/Debug/Kafe_MarkupCompile.cache

@@ -11,8 +11,8 @@ false
 DEBUG;TRACE
 Z:\git\Kafe\Kafe\App.xaml
 1219584333
-22035508349
-15580042515
+
+6-299724877
 18-1273807529
 MainWindow.xaml;
 

+ 1 - 1
Kafe/Kafe/obj/Debug/Kafe_MarkupCompile.i.cache

@@ -12,7 +12,7 @@ DEBUG;TRACE
 Z:\git\Kafe\Kafe\App.xaml
 1219584333
 22035508349
-15580042515
+181315675107
 18-1273807529
 MainWindow.xaml;
 

BIN
Kafe/Kafe/obj/Debug/TempPE/Model.Designer.cs.dll


BIN
Kafe/Kafe/obj/Debug/TempPE/Model.cs.dll


BIN
db.sql