ivan matveev 1 year ago
parent
commit
56947b267b

+ 1 - 0
practica12/App.config

@@ -11,6 +11,7 @@
     <add name="EP" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
     <add name="EP" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
     <add name="EP1" connectionString="metadata=res://*/Base.csdl|res://*/Base.ssdl|res://*/Base.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
     <add name="EP1" connectionString="metadata=res://*/Base.csdl|res://*/Base.ssdl|res://*/Base.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
     <add name="EP2" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
     <add name="EP2" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;persist security info=True;user id=41П_МДК01.01;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+    <add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=41hotels15;user id=41П_МДК01.01;password=444444;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   </connectionStrings>
   <entityFramework>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

+ 12 - 0
practica12/App.xaml

@@ -34,5 +34,17 @@
             <Setter Property="VerticalAlignment" Value="Center"/>
             <Setter Property="VerticalAlignment" Value="Center"/>
             <Setter Property="Foreground" Value="#445c93"/>
             <Setter Property="Foreground" Value="#445c93"/>
         </Style>
         </Style>
+        <Style x:Key="btnstyle1" TargetType="Button">
+            <!--кнопки-->
+            <Style.Setters>
+                <Setter Property="Background" Value="#e31e24"/>
+                <Setter Property="FontWeight" Value="DemiBold"/>
+                <Setter Property="Height" Value="auto"/>
+                <Setter Property="Width" Value="250"/>
+                <Setter Property="FontSize" Value="14"/>
+                <Setter Property="Margin" Value="5"/>
+                <Setter Property="Foreground" Value="White"/>
+            </Style.Setters>
+        </Style>
     </Application.Resources>
     </Application.Resources>
 </Application>
 </Application>

+ 1 - 1
practica12/Classs/Base.cs

@@ -8,6 +8,6 @@ namespace practica12
 {
 {
     internal class Base
     internal class Base
     {
     {
-        public static  EP2 ep;
+        public static  Entities ep;
     }
     }
 }
 }

+ 130 - 0
practica12/Classs/Pagin.cs

@@ -0,0 +1,130 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace practica12.Classs
+{
+    internal class Pagin : INotifyPropertyChanged
+    {
+        public event PropertyChangedEventHandler PropertyChanged;  //событие, для изменения значения одного из массивов свойств, описанных ниже
+        static int countitems = 5; //количество объектов для отображения (1 2 3 4 5)
+        public int[] NPage { get; set; } = new int[countitems];// массив с номерами отображаемых страниц    
+        public string[] Visible { get; set; } = new string[countitems];//массив свойст, отвечающий за видимость номера страницы, Visible - видимый, Hidden - скрытый
+        public string[] Bold { get; set; } = new string[countitems];//массив свойств, отвечающий за выделение номера текущей страницы
+        int countpages;  // переменная, в которой буде храниться количество страниц
+        public int CountPages//свойство в котором хранится общее кол-во страц, при изменении данного свойства будет определяться, скрыт будет номер той или итой страницы или нет (в зависимости об общего кол-ва записей в списке) 
+        {
+            get => countpages;
+            set
+            {
+                countpages = value;
+                for (int i = 1; i < countitems; i++)//цикл для определения видимости номеров страниц
+                {
+                    if (CountPages <= i)
+                    {
+                        Visible[i] = "Hidden";//если страниц меньше, чем кнопок - скрываем лишние
+                    }
+                    else
+                    {
+                        Visible[i] = "Visible";// а если их опять стало больше, то показываем назад
+                    }
+                }
+            }
+        }
+
+        int countpage;//количество записей на странице
+        public int CountPage  //свойство, в котором хранится количество записей на странице, при изменении данного свойства будет изменяться общее количесво страниц для отображения
+        {
+            get => countpage;
+            set
+            {
+                countpage = value;
+                if (Countlist % value == 0)
+                {
+                    CountPages = Countlist / value;//определение количества страниц
+                }
+                else
+                {
+                    CountPages = Countlist / value + 1;//в случае нецелого числа прибавляем 1 к итоговому количеству страниц
+                }
+            }
+        }
+
+        int countlist; // количество записей в списке
+        public int Countlist //свойство, в котором хранится общее количество записей в списке, при изменении данного свойства будет изменяться общее количесво страниц для отображения
+        {
+            get => countlist;
+            set
+            {
+                countlist = value;
+                if (value % CountPage == 0)
+                {
+                    CountPages = value / CountPage;//определение количества страниц
+                }
+                else
+                {
+                    CountPages = 1 + value / CountPage;
+                }
+            }
+        }
+        int currentpage;//текущая страница
+        public int CurrentPage  // свойство, в котором будет хранится текущая страница, при изменении которого будет меняться вся отрисовка меню с номерами страниц
+        {
+            get => currentpage;
+            set
+            {
+                currentpage = value;
+                if (currentpage < 1)
+                {
+                    currentpage = 1;
+                }
+                if (currentpage >= CountPages)
+                {
+                    currentpage = CountPages;
+                }
+                //отрисовка меню с номерами страниц, рассмотрим три возможных случая                            
+                for (int i = 0; i < countitems; i++)
+                {
+                    if (currentpage < (1 + countitems / 2) || CountPages < countitems) NPage[i] = i + 1;//если страница в начале списка
+                    else if (currentpage > CountPages - (countitems / 2 + 1)) NPage[i] = CountPages - (countitems - 1) + i;//если страница в конце списка
+                    else NPage[i] = currentpage + i - (countitems / 2);//если страница в середине списка
+                }
+                for (int i = 0; i < countitems; i++)//выделяем активную страницу жирным
+                {
+                    if (NPage[i] == currentpage) Bold[i] = "ExtraBold";
+                    else Bold[i] = "Regular";
+                }
+                //вызываем созбытие, связанное с изменением свойств, используемых в привязке на странице
+                PropertyChanged(this, new PropertyChangedEventArgs("NPage"));
+                PropertyChanged(this, new PropertyChangedEventArgs("Visible"));
+                PropertyChanged(this, new PropertyChangedEventArgs("Bold"));
+            }
+        }
+        public Pagin() // контруктор
+        {
+            for (int i = 0; i < countitems; i++)  // показываем исходное меню ( 1 2 3 4 5)
+            {
+                if (i == 0)
+                {
+                    Visible[i] = "Visible";
+                    Bold[i] = "ExtraBold";
+                }
+                else
+                {
+                    Visible[i] = "Hidden";
+                    Bold[i] = "Regular";
+                }
+
+                NPage[i] = i + 1;
+
+            }
+            currentpage = 1;  // по умолчанию 1-ая страница будет текущей
+            countlist = 1;  // по умолчанию в общем списке будет только одна запись
+            countpage = 10;
+        }
+    }
+}
+

+ 1 - 1
practica12/MainWindow.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:practica12"
         xmlns:local="clr-namespace:practica12"
         mc:Ignorable="d"
         mc:Ignorable="d"
         Style="{StaticResource ResourceKey= BColor}"
         Style="{StaticResource ResourceKey= BColor}"
-        Title="MainWindow" Height="450" Width="800">
+        Title="MainWindow" Height="638" Width="950">
     <Grid>
     <Grid>
         <Frame Name = "frm" Grid.Row="1" NavigationUIVisibility="Hidden">
         <Frame Name = "frm" Grid.Row="1" NavigationUIVisibility="Hidden">
 
 

+ 1 - 1
practica12/MainWindow.xaml.cs

@@ -25,7 +25,7 @@ namespace practica12
         public MainWindow()
         public MainWindow()
         {
         {
             InitializeComponent();
             InitializeComponent();
-            Base.ep = new EP2();
+            Base.ep = new Entities();
             FrameClass.MainFrame = frm;
             FrameClass.MainFrame = frm;
             FrameClass.MainFrame.Navigate(new MainPage());
             FrameClass.MainFrame.Navigate(new MainPage());
             
             

+ 109 - 3
practica12/Model1.Context.cs

@@ -12,11 +12,13 @@ namespace practica12
     using System;
     using System;
     using System.Data.Entity;
     using System.Data.Entity;
     using System.Data.Entity.Infrastructure;
     using System.Data.Entity.Infrastructure;
+    using System.Data.Entity.Core.Objects;
+    using System.Linq;
     
     
-    public partial class EP2 : DbContext
+    public partial class Entities : DbContext
     {
     {
-        public EP2()
-            : base("name=EP2")
+        public Entities()
+            : base("name=Entities")
         {
         {
         }
         }
     
     
@@ -32,5 +34,109 @@ namespace practica12
         public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
         public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
         public virtual DbSet<Tour> Tour { get; set; }
         public virtual DbSet<Tour> Tour { get; set; }
         public virtual DbSet<Type> Type { get; set; }
         public virtual DbSet<Type> Type { get; set; }
+        public virtual DbSet<TypeOfTour> TypeOfTour { get; set; }
+    
+        public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            var versionParameter = version.HasValue ?
+                new ObjectParameter("version", version) :
+                new ObjectParameter("version", typeof(int));
+    
+            var definitionParameter = definition != null ?
+                new ObjectParameter("definition", definition) :
+                new ObjectParameter("definition", typeof(byte[]));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
+        }
+    
+        public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            var versionParameter = version.HasValue ?
+                new ObjectParameter("version", version) :
+                new ObjectParameter("version", typeof(int));
+    
+            var definitionParameter = definition != null ?
+                new ObjectParameter("definition", definition) :
+                new ObjectParameter("definition", typeof(byte[]));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
+        }
+    
+        public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
+        }
+    
+        public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
+        }
+    
+        public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
+        }
+    
+        public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
+        {
+            var diagramnameParameter = diagramname != null ?
+                new ObjectParameter("diagramname", diagramname) :
+                new ObjectParameter("diagramname", typeof(string));
+    
+            var owner_idParameter = owner_id.HasValue ?
+                new ObjectParameter("owner_id", owner_id) :
+                new ObjectParameter("owner_id", typeof(int));
+    
+            var new_diagramnameParameter = new_diagramname != null ?
+                new ObjectParameter("new_diagramname", new_diagramname) :
+                new ObjectParameter("new_diagramname", typeof(string));
+    
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
+        }
+    
+        public virtual int sp_upgraddiagrams()
+        {
+            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
+        }
     }
     }
 }
 }

+ 247 - 116
practica12/Model1.edmx

@@ -4,7 +4,7 @@
   <edmx:Runtime>
   <edmx:Runtime>
     <!-- SSDL content -->
     <!-- SSDL content -->
     <edmx:StorageModels>
     <edmx:StorageModels>
-      <Schema Namespace="Хранилище EP3" 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="Хранилище hotels15Model" 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="Country">
         <EntityType Name="Country">
           <Key>
           <Key>
             <PropertyRef Name="Code" />
             <PropertyRef Name="Code" />
@@ -66,7 +66,7 @@
           <Property Name="TicketCount" Type="int" Nullable="false" />
           <Property Name="TicketCount" Type="int" Nullable="false" />
           <Property Name="Name" Type="nvarchar" MaxLength="100" Nullable="false" />
           <Property Name="Name" Type="nvarchar" MaxLength="100" Nullable="false" />
           <Property Name="Description" Type="nvarchar(max)" />
           <Property Name="Description" Type="nvarchar(max)" />
-          <Property Name="ImagePreview" Type="varbinary(max)" />
+          <Property Name="ImagePreview" Type="nvarchar(max)" />
           <Property Name="Price" Type="money" Nullable="false" />
           <Property Name="Price" Type="money" Nullable="false" />
           <Property Name="IsActual" Type="bit" Nullable="false" />
           <Property Name="IsActual" Type="bit" Nullable="false" />
         </EntityType>
         </EntityType>
@@ -80,9 +80,9 @@
         </EntityType>
         </EntityType>
         <EntityType Name="TypeOfTour">
         <EntityType Name="TypeOfTour">
           <Key>
           <Key>
-            <PropertyRef Name="TourId" />
-            <PropertyRef Name="TypeId" />
+            <PropertyRef Name="ID" />
           </Key>
           </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
           <Property Name="TourId" Type="int" Nullable="false" />
           <Property Name="TourId" Type="int" Nullable="false" />
           <Property Name="TypeId" Type="int" Nullable="false" />
           <Property Name="TypeId" Type="int" Nullable="false" />
         </EntityType>
         </EntityType>
@@ -146,7 +146,7 @@
             </Dependent>
             </Dependent>
           </ReferentialConstraint>
           </ReferentialConstraint>
         </Association>
         </Association>
-        <Association Name="FK_TypeOfTour_Tour">
+        <Association Name="FK_TypeOfTour_Tour1">
           <End Role="Tour" Type="Self.Tour" Multiplicity="1" />
           <End Role="Tour" Type="Self.Tour" Multiplicity="1" />
           <End Role="TypeOfTour" Type="Self.TypeOfTour" Multiplicity="*" />
           <End Role="TypeOfTour" Type="Self.TypeOfTour" Multiplicity="*" />
           <ReferentialConstraint>
           <ReferentialConstraint>
@@ -170,7 +170,38 @@
             </Dependent>
             </Dependent>
           </ReferentialConstraint>
           </ReferentialConstraint>
         </Association>
         </Association>
-        <EntityContainer Name="Хранилище EP3Container">
+        <Function Name="fn_diagramobjects" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" ReturnType="int" />
+        <Function Name="sp_alterdiagram" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+          <Parameter Name="version" Type="int" Mode="In" />
+          <Parameter Name="definition" Type="varbinary(max)" Mode="In" />
+        </Function>
+        <Function Name="sp_creatediagram" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+          <Parameter Name="version" Type="int" Mode="In" />
+          <Parameter Name="definition" Type="varbinary(max)" Mode="In" />
+        </Function>
+        <Function Name="sp_dropdiagram" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+        </Function>
+        <Function Name="sp_helpdiagramdefinition" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+        </Function>
+        <Function Name="sp_helpdiagrams" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+        </Function>
+        <Function Name="sp_renamediagram" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
+          <Parameter Name="diagramname" Type="nvarchar" Mode="In" />
+          <Parameter Name="owner_id" Type="int" Mode="In" />
+          <Parameter Name="new_diagramname" Type="nvarchar" Mode="In" />
+        </Function>
+        <Function Name="sp_upgraddiagrams" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" />
+        <EntityContainer Name="Хранилище hotels15ModelContainer">
           <EntitySet Name="Country" EntityType="Self.Country" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Country" EntityType="Self.Country" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Hotel" EntityType="Self.Hotel" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Hotel" EntityType="Self.Hotel" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="HotelComment" EntityType="Self.HotelComment" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="HotelComment" EntityType="Self.HotelComment" Schema="dbo" store:Type="Tables" />
@@ -200,7 +231,7 @@
             <End Role="Tour" EntitySet="Tour" />
             <End Role="Tour" EntitySet="Tour" />
             <End Role="HotelOfTour" EntitySet="HotelOfTour" />
             <End Role="HotelOfTour" EntitySet="HotelOfTour" />
           </AssociationSet>
           </AssociationSet>
-          <AssociationSet Name="FK_TypeOfTour_Tour" Association="Self.FK_TypeOfTour_Tour">
+          <AssociationSet Name="FK_TypeOfTour_Tour1" Association="Self.FK_TypeOfTour_Tour1">
             <End Role="Tour" EntitySet="Tour" />
             <End Role="Tour" EntitySet="Tour" />
             <End Role="TypeOfTour" EntitySet="TypeOfTour" />
             <End Role="TypeOfTour" EntitySet="TypeOfTour" />
           </AssociationSet>
           </AssociationSet>
@@ -209,32 +240,95 @@
             <End Role="TypeOfTour" EntitySet="TypeOfTour" />
             <End Role="TypeOfTour" EntitySet="TypeOfTour" />
           </AssociationSet>
           </AssociationSet>
         </EntityContainer>
         </EntityContainer>
-      </Schema>
-    </edmx:StorageModels>
+      </Schema></edmx:StorageModels>
     <!-- CSDL content -->
     <!-- CSDL content -->
     <edmx:ConceptualModels>
     <edmx:ConceptualModels>
-      <Schema Namespace="EP3" 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">
+      <Schema Namespace="hotels15Model" 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="Entities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Country" EntityType="hotels15Model.Country" />
+          <EntitySet Name="Hotel" EntityType="hotels15Model.Hotel" />
+          <EntitySet Name="HotelComment" EntityType="hotels15Model.HotelComment" />
+          <EntitySet Name="HotelImage" EntityType="hotels15Model.HotelImage" />
+          <EntitySet Name="sysdiagrams" EntityType="hotels15Model.sysdiagrams" />
+          <EntitySet Name="Tour" EntityType="hotels15Model.Tour" />
+          <EntitySet Name="Type" EntityType="hotels15Model.Type" />
+          <EntitySet Name="TypeOfTour" EntityType="hotels15Model.TypeOfTour" />
+          <AssociationSet Name="FK_Hotel_Country" Association="hotels15Model.FK_Hotel_Country">
+            <End Role="Country" EntitySet="Country" />
+            <End Role="Hotel" EntitySet="Hotel" />
+          </AssociationSet>
+          <AssociationSet Name="FK_HotelComment_Hotel" Association="hotels15Model.FK_HotelComment_Hotel">
+            <End Role="Hotel" EntitySet="Hotel" />
+            <End Role="HotelComment" EntitySet="HotelComment" />
+          </AssociationSet>
+          <AssociationSet Name="FK_HotelImage_Hotel" Association="hotels15Model.FK_HotelImage_Hotel">
+            <End Role="Hotel" EntitySet="Hotel" />
+            <End Role="HotelImage" EntitySet="HotelImage" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TypeOfTour_Tour1" Association="hotels15Model.FK_TypeOfTour_Tour1">
+            <End Role="Tour" EntitySet="Tour" />
+            <End Role="TypeOfTour" EntitySet="TypeOfTour" />
+          </AssociationSet>
+          <AssociationSet Name="FK_TypeOfTour_Type" Association="hotels15Model.FK_TypeOfTour_Type">
+            <End Role="Type" EntitySet="Type" />
+            <End Role="TypeOfTour" EntitySet="TypeOfTour" />
+          </AssociationSet>
+          <AssociationSet Name="HotelOfTour" Association="hotels15Model.HotelOfTour">
+            <End Role="Hotel" EntitySet="Hotel" />
+            <End Role="Tour" EntitySet="Tour" />
+          </AssociationSet>
+          <FunctionImport Name="sp_alterdiagram">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+            <Parameter Name="version" Mode="In" Type="Int32" />
+            <Parameter Name="definition" Mode="In" Type="Binary" />
+          </FunctionImport>
+          <FunctionImport Name="sp_creatediagram">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+            <Parameter Name="version" Mode="In" Type="Int32" />
+            <Parameter Name="definition" Mode="In" Type="Binary" />
+          </FunctionImport>
+          <FunctionImport Name="sp_dropdiagram">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+          </FunctionImport>
+          <FunctionImport Name="sp_helpdiagramdefinition" ReturnType="Collection(hotels15Model.sp_helpdiagramdefinition_Result)">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+          </FunctionImport>
+          <FunctionImport Name="sp_helpdiagrams" ReturnType="Collection(hotels15Model.sp_helpdiagrams_Result)">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+          </FunctionImport>
+          <FunctionImport Name="sp_renamediagram">
+            <Parameter Name="diagramname" Mode="In" Type="String" />
+            <Parameter Name="owner_id" Mode="In" Type="Int32" />
+            <Parameter Name="new_diagramname" Mode="In" Type="String" />
+          </FunctionImport>
+          <FunctionImport Name="sp_upgraddiagrams" />
+        </EntityContainer>
         <EntityType Name="Country">
         <EntityType Name="Country">
           <Key>
           <Key>
             <PropertyRef Name="Code" />
             <PropertyRef Name="Code" />
           </Key>
           </Key>
-          <Property Name="Code" Type="String" MaxLength="2" FixedLength="true" Unicode="true" Nullable="false" />
-          <Property Name="Name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" Nullable="false" />
-          <NavigationProperty Name="Hotel" Relationship="Self.FK_Hotel_Country" FromRole="Country" ToRole="Hotel" />
+          <Property Name="Code" Type="String" Nullable="false" MaxLength="2" FixedLength="true" Unicode="true" />
+          <Property Name="Name" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
+          <NavigationProperty Name="Hotel" Relationship="hotels15Model.FK_Hotel_Country" FromRole="Country" ToRole="Hotel" />
         </EntityType>
         </EntityType>
         <EntityType Name="Hotel">
         <EntityType Name="Hotel">
           <Key>
           <Key>
             <PropertyRef Name="Id" />
             <PropertyRef Name="Id" />
           </Key>
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="Name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
           <Property Name="CountOfStars" Type="Int32" Nullable="false" />
           <Property Name="CountOfStars" Type="Int32" Nullable="false" />
-          <Property Name="CountryCode" Type="String" MaxLength="2" FixedLength="true" Unicode="true" Nullable="false" />
+          <Property Name="CountryCode" Type="String" Nullable="false" MaxLength="2" FixedLength="true" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
-          <NavigationProperty Name="Country" Relationship="Self.FK_Hotel_Country" FromRole="Hotel" ToRole="Country" />
-          <NavigationProperty Name="HotelComment" Relationship="Self.FK_HotelComment_Hotel" FromRole="Hotel" ToRole="HotelComment" />
-          <NavigationProperty Name="HotelImage" Relationship="Self.FK_HotelImage_Hotel" FromRole="Hotel" ToRole="HotelImage" />
-          <NavigationProperty Name="Tour" Relationship="Self.HotelOfTour" FromRole="Hotel" ToRole="Tour" />
+          <NavigationProperty Name="Country" Relationship="hotels15Model.FK_Hotel_Country" FromRole="Hotel" ToRole="Country" />
+          <NavigationProperty Name="HotelComment" Relationship="hotels15Model.FK_HotelComment_Hotel" FromRole="Hotel" ToRole="HotelComment" />
+          <NavigationProperty Name="HotelImage" Relationship="hotels15Model.FK_HotelImage_Hotel" FromRole="Hotel" ToRole="HotelImage" />
+          <NavigationProperty Name="Tour" Relationship="hotels15Model.HotelOfTour" FromRole="Hotel" ToRole="Tour" />
         </EntityType>
         </EntityType>
         <EntityType Name="HotelComment">
         <EntityType Name="HotelComment">
           <Key>
           <Key>
@@ -242,10 +336,10 @@
           </Key>
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="HotelId" Type="Int32" Nullable="false" />
           <Property Name="HotelId" Type="Int32" Nullable="false" />
-          <Property Name="Text" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
-          <Property Name="Author" Type="String" MaxLength="100" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Text" Type="String" Nullable="false" MaxLength="Max" FixedLength="false" Unicode="true" />
+          <Property Name="Author" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
           <Property Name="CreationDate" Type="DateTime" Nullable="false" Precision="3" />
           <Property Name="CreationDate" Type="DateTime" Nullable="false" Precision="3" />
-          <NavigationProperty Name="Hotel" Relationship="Self.FK_HotelComment_Hotel" FromRole="HotelComment" ToRole="Hotel" />
+          <NavigationProperty Name="Hotel" Relationship="hotels15Model.FK_HotelComment_Hotel" FromRole="HotelComment" ToRole="Hotel" />
         </EntityType>
         </EntityType>
         <EntityType Name="HotelImage">
         <EntityType Name="HotelImage">
           <Key>
           <Key>
@@ -253,14 +347,14 @@
           </Key>
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="HotelId" Type="Int32" Nullable="false" />
           <Property Name="HotelId" Type="Int32" Nullable="false" />
-          <Property Name="ImageSource" Type="Binary" MaxLength="Max" FixedLength="false" Nullable="false" />
-          <NavigationProperty Name="Hotel" Relationship="Self.FK_HotelImage_Hotel" FromRole="HotelImage" ToRole="Hotel" />
+          <Property Name="ImageSource" Type="Binary" Nullable="false" MaxLength="Max" FixedLength="false" />
+          <NavigationProperty Name="Hotel" Relationship="hotels15Model.FK_HotelImage_Hotel" FromRole="HotelImage" ToRole="Hotel" />
         </EntityType>
         </EntityType>
         <EntityType Name="sysdiagrams">
         <EntityType Name="sysdiagrams">
           <Key>
           <Key>
             <PropertyRef Name="diagram_id" />
             <PropertyRef Name="diagram_id" />
           </Key>
           </Key>
-          <Property Name="name" Type="String" MaxLength="128" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="name" Type="String" Nullable="false" MaxLength="128" FixedLength="false" Unicode="true" />
           <Property Name="principal_id" Type="Int32" Nullable="false" />
           <Property Name="principal_id" Type="Int32" Nullable="false" />
           <Property Name="diagram_id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="diagram_id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="version" Type="Int32" />
           <Property Name="version" Type="Int32" />
@@ -272,26 +366,36 @@
           </Key>
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="TicketCount" Type="Int32" Nullable="false" />
           <Property Name="TicketCount" Type="Int32" Nullable="false" />
-          <Property Name="Name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
-          <Property Name="ImagePreview" Type="Binary" MaxLength="Max" FixedLength="false" />
-          <Property Name="Price" Type="Decimal" Precision="19" Scale="4" Nullable="false" />
+          <Property Name="ImagePreview" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
+          <Property Name="Price" Type="Decimal" Nullable="false" Precision="19" Scale="4" />
           <Property Name="IsActual" Type="Boolean" Nullable="false" />
           <Property Name="IsActual" Type="Boolean" Nullable="false" />
-          <NavigationProperty Name="Hotel" Relationship="Self.HotelOfTour" FromRole="Tour" ToRole="Hotel" />
-          <NavigationProperty Name="Type" Relationship="Self.TypeOfTour" FromRole="Tour" ToRole="Type" />
+          <NavigationProperty Name="TypeOfTour" Relationship="hotels15Model.FK_TypeOfTour_Tour1" FromRole="Tour" ToRole="TypeOfTour" />
+          <NavigationProperty Name="Hotel" Relationship="hotels15Model.HotelOfTour" FromRole="Tour" ToRole="Hotel" />
         </EntityType>
         </EntityType>
         <EntityType Name="Type">
         <EntityType Name="Type">
           <Key>
           <Key>
             <PropertyRef Name="Id" />
             <PropertyRef Name="Id" />
           </Key>
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="Name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Name" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
           <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
-          <NavigationProperty Name="Tour" Relationship="Self.TypeOfTour" FromRole="Type" ToRole="Tour" />
+          <NavigationProperty Name="TypeOfTour" Relationship="hotels15Model.FK_TypeOfTour_Type" FromRole="Type" ToRole="TypeOfTour" />
+        </EntityType>
+        <EntityType Name="TypeOfTour">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="TourId" Type="Int32" Nullable="false" />
+          <Property Name="TypeId" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Tour" Relationship="hotels15Model.FK_TypeOfTour_Tour1" FromRole="TypeOfTour" ToRole="Tour" />
+          <NavigationProperty Name="Type" Relationship="hotels15Model.FK_TypeOfTour_Type" FromRole="TypeOfTour" ToRole="Type" />
         </EntityType>
         </EntityType>
         <Association Name="FK_Hotel_Country">
         <Association Name="FK_Hotel_Country">
-          <End Role="Country" Type="Self.Country" Multiplicity="1" />
-          <End Role="Hotel" Type="Self.Hotel" Multiplicity="*" />
+          <End Type="hotels15Model.Country" Role="Country" Multiplicity="1" />
+          <End Type="hotels15Model.Hotel" Role="Hotel" Multiplicity="*" />
           <ReferentialConstraint>
           <ReferentialConstraint>
             <Principal Role="Country">
             <Principal Role="Country">
               <PropertyRef Name="Code" />
               <PropertyRef Name="Code" />
@@ -302,8 +406,8 @@
           </ReferentialConstraint>
           </ReferentialConstraint>
         </Association>
         </Association>
         <Association Name="FK_HotelComment_Hotel">
         <Association Name="FK_HotelComment_Hotel">
-          <End Role="Hotel" Type="Self.Hotel" Multiplicity="1" />
-          <End Role="HotelComment" Type="Self.HotelComment" Multiplicity="*" />
+          <End Type="hotels15Model.Hotel" Role="Hotel" Multiplicity="1" />
+          <End Type="hotels15Model.HotelComment" Role="HotelComment" Multiplicity="*" />
           <ReferentialConstraint>
           <ReferentialConstraint>
             <Principal Role="Hotel">
             <Principal Role="Hotel">
               <PropertyRef Name="Id" />
               <PropertyRef Name="Id" />
@@ -314,8 +418,8 @@
           </ReferentialConstraint>
           </ReferentialConstraint>
         </Association>
         </Association>
         <Association Name="FK_HotelImage_Hotel">
         <Association Name="FK_HotelImage_Hotel">
-          <End Role="Hotel" Type="Self.Hotel" Multiplicity="1" />
-          <End Role="HotelImage" Type="Self.HotelImage" Multiplicity="*" />
+          <End Type="hotels15Model.Hotel" Role="Hotel" Multiplicity="1" />
+          <End Type="hotels15Model.HotelImage" Role="HotelImage" Multiplicity="*" />
           <ReferentialConstraint>
           <ReferentialConstraint>
             <Principal Role="Hotel">
             <Principal Role="Hotel">
               <PropertyRef Name="Id" />
               <PropertyRef Name="Id" />
@@ -325,137 +429,164 @@
             </Dependent>
             </Dependent>
           </ReferentialConstraint>
           </ReferentialConstraint>
         </Association>
         </Association>
-        <Association Name="HotelOfTour">
-          <End Role="Hotel" Type="Self.Hotel" Multiplicity="*" />
-          <End Role="Tour" Type="Self.Tour" Multiplicity="*" />
+        <Association Name="FK_TypeOfTour_Tour1">
+          <End Type="hotels15Model.Tour" Role="Tour" Multiplicity="1" />
+          <End Type="hotels15Model.TypeOfTour" Role="TypeOfTour" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Tour">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="TypeOfTour">
+              <PropertyRef Name="TourId" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
         </Association>
-        <Association Name="TypeOfTour">
-          <End Role="Tour" Type="Self.Tour" Multiplicity="*" />
-          <End Role="Type" Type="Self.Type" Multiplicity="*" />
+        <Association Name="FK_TypeOfTour_Type">
+          <End Type="hotels15Model.Type" Role="Type" Multiplicity="1" />
+          <End Type="hotels15Model.TypeOfTour" Role="TypeOfTour" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Type">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="TypeOfTour">
+              <PropertyRef Name="TypeId" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
         </Association>
-        <EntityContainer Name="EP2" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Country" EntityType="Self.Country" />
-          <EntitySet Name="Hotel" EntityType="Self.Hotel" />
-          <EntitySet Name="HotelComment" EntityType="Self.HotelComment" />
-          <EntitySet Name="HotelImage" EntityType="Self.HotelImage" />
-          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" />
-          <EntitySet Name="Tour" EntityType="Self.Tour" />
-          <EntitySet Name="Type" EntityType="Self.Type" />
-          <AssociationSet Name="FK_Hotel_Country" Association="Self.FK_Hotel_Country">
-            <End Role="Country" EntitySet="Country" />
-            <End Role="Hotel" EntitySet="Hotel" />
-          </AssociationSet>
-          <AssociationSet Name="FK_HotelComment_Hotel" Association="Self.FK_HotelComment_Hotel">
-            <End Role="Hotel" EntitySet="Hotel" />
-            <End Role="HotelComment" EntitySet="HotelComment" />
-          </AssociationSet>
-          <AssociationSet Name="FK_HotelImage_Hotel" Association="Self.FK_HotelImage_Hotel">
-            <End Role="Hotel" EntitySet="Hotel" />
-            <End Role="HotelImage" EntitySet="HotelImage" />
-          </AssociationSet>
-          <AssociationSet Name="HotelOfTour" Association="Self.HotelOfTour">
-            <End Role="Hotel" EntitySet="Hotel" />
-            <End Role="Tour" EntitySet="Tour" />
-          </AssociationSet>
-          <AssociationSet Name="TypeOfTour" Association="Self.TypeOfTour">
-            <End Role="Tour" EntitySet="Tour" />
-            <End Role="Type" EntitySet="Type" />
-          </AssociationSet>
-        </EntityContainer>
-      </Schema>
+        <Association Name="HotelOfTour">
+          <End Type="hotels15Model.Hotel" Role="Hotel" Multiplicity="*" />
+          <End Type="hotels15Model.Tour" Role="Tour" Multiplicity="*" />
+        </Association>
+        <ComplexType Name="sp_helpdiagramdefinition_Result">
+          <Property Type="Int32" Name="version" Nullable="true" />
+          <Property Type="Binary" Name="definition" Nullable="true" />
+        </ComplexType>
+        <ComplexType Name="sp_helpdiagrams_Result">
+          <Property Type="String" Name="Database" Nullable="true" MaxLength="128" />
+          <Property Type="String" Name="Name" Nullable="false" MaxLength="128" />
+          <Property Type="Int32" Name="ID" Nullable="false" />
+          <Property Type="String" Name="Owner" Nullable="true" MaxLength="128" />
+          <Property Type="Int32" Name="OwnerID" Nullable="false" />
+        </ComplexType>
+        </Schema>
     </edmx:ConceptualModels>
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
     <!-- C-S mapping content -->
     <edmx:Mappings>
     <edmx:Mappings>
       <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
       <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
-        <EntityContainerMapping StorageEntityContainer="Хранилище EP3Container" CdmEntityContainer="EP2">
+        <EntityContainerMapping StorageEntityContainer="Хранилище hotels15ModelContainer" CdmEntityContainer="Entities">
           <EntitySetMapping Name="Country">
           <EntitySetMapping Name="Country">
-            <EntityTypeMapping TypeName="EP3.Country">
+            <EntityTypeMapping TypeName="hotels15Model.Country">
               <MappingFragment StoreEntitySet="Country">
               <MappingFragment StoreEntitySet="Country">
-                <ScalarProperty Name="Code" ColumnName="Code" />
                 <ScalarProperty Name="Name" ColumnName="Name" />
                 <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Code" ColumnName="Code" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Hotel">
           <EntitySetMapping Name="Hotel">
-            <EntityTypeMapping TypeName="EP3.Hotel">
+            <EntityTypeMapping TypeName="hotels15Model.Hotel">
               <MappingFragment StoreEntitySet="Hotel">
               <MappingFragment StoreEntitySet="Hotel">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
-                <ScalarProperty Name="CountOfStars" ColumnName="CountOfStars" />
-                <ScalarProperty Name="CountryCode" ColumnName="CountryCode" />
                 <ScalarProperty Name="Description" ColumnName="Description" />
                 <ScalarProperty Name="Description" ColumnName="Description" />
+                <ScalarProperty Name="CountryCode" ColumnName="CountryCode" />
+                <ScalarProperty Name="CountOfStars" ColumnName="CountOfStars" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="HotelComment">
           <EntitySetMapping Name="HotelComment">
-            <EntityTypeMapping TypeName="EP3.HotelComment">
+            <EntityTypeMapping TypeName="hotels15Model.HotelComment">
               <MappingFragment StoreEntitySet="HotelComment">
               <MappingFragment StoreEntitySet="HotelComment">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="HotelId" ColumnName="HotelId" />
-                <ScalarProperty Name="Text" ColumnName="Text" />
-                <ScalarProperty Name="Author" ColumnName="Author" />
                 <ScalarProperty Name="CreationDate" ColumnName="CreationDate" />
                 <ScalarProperty Name="CreationDate" ColumnName="CreationDate" />
+                <ScalarProperty Name="Author" ColumnName="Author" />
+                <ScalarProperty Name="Text" ColumnName="Text" />
+                <ScalarProperty Name="HotelId" ColumnName="HotelId" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="HotelImage">
           <EntitySetMapping Name="HotelImage">
-            <EntityTypeMapping TypeName="EP3.HotelImage">
+            <EntityTypeMapping TypeName="hotels15Model.HotelImage">
               <MappingFragment StoreEntitySet="HotelImage">
               <MappingFragment StoreEntitySet="HotelImage">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="HotelId" ColumnName="HotelId" />
                 <ScalarProperty Name="ImageSource" ColumnName="ImageSource" />
                 <ScalarProperty Name="ImageSource" ColumnName="ImageSource" />
+                <ScalarProperty Name="HotelId" ColumnName="HotelId" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="sysdiagrams">
           <EntitySetMapping Name="sysdiagrams">
-            <EntityTypeMapping TypeName="EP3.sysdiagrams">
+            <EntityTypeMapping TypeName="hotels15Model.sysdiagrams">
               <MappingFragment StoreEntitySet="sysdiagrams">
               <MappingFragment StoreEntitySet="sysdiagrams">
-                <ScalarProperty Name="name" ColumnName="name" />
-                <ScalarProperty Name="principal_id" ColumnName="principal_id" />
-                <ScalarProperty Name="diagram_id" ColumnName="diagram_id" />
-                <ScalarProperty Name="version" ColumnName="version" />
                 <ScalarProperty Name="definition" ColumnName="definition" />
                 <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>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Tour">
           <EntitySetMapping Name="Tour">
-            <EntityTypeMapping TypeName="EP3.Tour">
+            <EntityTypeMapping TypeName="hotels15Model.Tour">
               <MappingFragment StoreEntitySet="Tour">
               <MappingFragment StoreEntitySet="Tour">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="TicketCount" ColumnName="TicketCount" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
-                <ScalarProperty Name="Description" ColumnName="Description" />
-                <ScalarProperty Name="ImagePreview" ColumnName="ImagePreview" />
-                <ScalarProperty Name="Price" ColumnName="Price" />
                 <ScalarProperty Name="IsActual" ColumnName="IsActual" />
                 <ScalarProperty Name="IsActual" ColumnName="IsActual" />
+                <ScalarProperty Name="Price" ColumnName="Price" />
+                <ScalarProperty Name="ImagePreview" ColumnName="ImagePreview" />
+                <ScalarProperty Name="Description" ColumnName="Description" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="TicketCount" ColumnName="TicketCount" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Type">
           <EntitySetMapping Name="Type">
-            <EntityTypeMapping TypeName="EP3.Type">
+            <EntityTypeMapping TypeName="hotels15Model.Type">
               <MappingFragment StoreEntitySet="Type">
               <MappingFragment StoreEntitySet="Type">
-                <ScalarProperty Name="Id" ColumnName="Id" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
                 <ScalarProperty Name="Description" ColumnName="Description" />
                 <ScalarProperty Name="Description" ColumnName="Description" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
               </MappingFragment>
             </EntityTypeMapping>
             </EntityTypeMapping>
           </EntitySetMapping>
           </EntitySetMapping>
-          <AssociationSetMapping Name="HotelOfTour" TypeName="EP3.HotelOfTour" StoreEntitySet="HotelOfTour">
-            <EndProperty Name="Hotel">
-              <ScalarProperty Name="Id" ColumnName="HotelId" />
-            </EndProperty>
-            <EndProperty Name="Tour">
-              <ScalarProperty Name="Id" ColumnName="TourId" />
-            </EndProperty>
-          </AssociationSetMapping>
-          <AssociationSetMapping Name="TypeOfTour" TypeName="EP3.TypeOfTour" StoreEntitySet="TypeOfTour">
+          <EntitySetMapping Name="TypeOfTour">
+            <EntityTypeMapping TypeName="hotels15Model.TypeOfTour">
+              <MappingFragment StoreEntitySet="TypeOfTour">
+                <ScalarProperty Name="TypeId" ColumnName="TypeId" />
+                <ScalarProperty Name="TourId" ColumnName="TourId" />
+                <ScalarProperty Name="ID" ColumnName="ID" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <AssociationSetMapping Name="HotelOfTour" TypeName="hotels15Model.HotelOfTour" StoreEntitySet="HotelOfTour">
             <EndProperty Name="Tour">
             <EndProperty Name="Tour">
               <ScalarProperty Name="Id" ColumnName="TourId" />
               <ScalarProperty Name="Id" ColumnName="TourId" />
             </EndProperty>
             </EndProperty>
-            <EndProperty Name="Type">
-              <ScalarProperty Name="Id" ColumnName="TypeId" />
+            <EndProperty Name="Hotel">
+              <ScalarProperty Name="Id" ColumnName="HotelId" />
             </EndProperty>
             </EndProperty>
           </AssociationSetMapping>
           </AssociationSetMapping>
+          <FunctionImportMapping FunctionImportName="sp_alterdiagram" FunctionName="Хранилище hotels15Model.sp_alterdiagram" />
+          <FunctionImportMapping FunctionImportName="sp_creatediagram" FunctionName="Хранилище hotels15Model.sp_creatediagram" />
+          <FunctionImportMapping FunctionImportName="sp_dropdiagram" FunctionName="Хранилище hotels15Model.sp_dropdiagram" />
+          <FunctionImportMapping FunctionImportName="sp_helpdiagramdefinition" FunctionName="Хранилище hotels15Model.sp_helpdiagramdefinition">
+            <ResultMapping>
+              <ComplexTypeMapping TypeName="hotels15Model.sp_helpdiagramdefinition_Result">
+                <ScalarProperty Name="version" ColumnName="version" />
+                <ScalarProperty Name="definition" ColumnName="definition" />
+              </ComplexTypeMapping>
+            </ResultMapping>
+          </FunctionImportMapping>
+          <FunctionImportMapping FunctionImportName="sp_helpdiagrams" FunctionName="Хранилище hotels15Model.sp_helpdiagrams">
+            <ResultMapping>
+              <ComplexTypeMapping TypeName="hotels15Model.sp_helpdiagrams_Result">
+                <ScalarProperty Name="Database" ColumnName="Database" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Owner" ColumnName="Owner" />
+                <ScalarProperty Name="OwnerID" ColumnName="OwnerID" />
+              </ComplexTypeMapping>
+            </ResultMapping>
+          </FunctionImportMapping>
+          <FunctionImportMapping FunctionImportName="sp_renamediagram" FunctionName="Хранилище hotels15Model.sp_renamediagram" />
+          <FunctionImportMapping FunctionImportName="sp_upgraddiagrams" FunctionName="Хранилище hotels15Model.sp_upgraddiagrams" />
         </EntityContainerMapping>
         </EntityContainerMapping>
       </Mapping>
       </Mapping>
     </edmx:Mappings>
     </edmx:Mappings>

+ 15 - 13
practica12/Model1.edmx.diagram

@@ -4,19 +4,21 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
     <edmx:Diagrams>
-      <Diagram DiagramId="e3333e73802b45f0899236081b539d22" Name="Diagram1" ZoomLevel="82">
-        <EntityTypeShape EntityType="EP3.Country" Width="1.5" PointX="0.75" PointY="4.5" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.Hotel" Width="1.5" PointX="3" PointY="4" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.HotelComment" Width="1.5" PointX="5.25" PointY="1.25" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.HotelImage" Width="1.5" PointX="5.25" PointY="4.125" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.sysdiagrams" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.Tour" Width="1.5" PointX="5.25" PointY="6.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="EP3.Type" Width="1.5" PointX="7.5" PointY="7.125" IsExpanded="true" />
-        <AssociationConnector Association="EP3.FK_Hotel_Country" ManuallyRouted="false" />
-        <AssociationConnector Association="EP3.FK_HotelComment_Hotel" ManuallyRouted="false" />
-        <AssociationConnector Association="EP3.FK_HotelImage_Hotel" ManuallyRouted="false" />
-        <AssociationConnector Association="EP3.HotelOfTour" ManuallyRouted="false" />
-        <AssociationConnector Association="EP3.TypeOfTour" ManuallyRouted="false" />
+      <Diagram DiagramId="bd5b42fe88d9422fb0b4b70bf1d674b5" Name="Diagram1">
+        <EntityTypeShape EntityType="hotels15Model.Country" Width="1.5" PointX="0.75" PointY="4.5" />
+        <EntityTypeShape EntityType="hotels15Model.Hotel" Width="1.5" PointX="3" PointY="4" />
+        <EntityTypeShape EntityType="hotels15Model.HotelComment" Width="1.5" PointX="5.25" PointY="4.75" />
+        <EntityTypeShape EntityType="hotels15Model.HotelImage" Width="1.5" PointX="5.25" PointY="7.625" />
+        <EntityTypeShape EntityType="hotels15Model.sysdiagrams" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="hotels15Model.Tour" Width="1.5" PointX="5.25" PointY="1.25" />
+        <EntityTypeShape EntityType="hotels15Model.Type" Width="1.5" PointX="5.25" PointY="10.75" />
+        <EntityTypeShape EntityType="hotels15Model.TypeOfTour" Width="1.5" PointX="7.5" PointY="1.625" />
+        <AssociationConnector Association="hotels15Model.FK_Hotel_Country" />
+        <AssociationConnector Association="hotels15Model.FK_HotelComment_Hotel" />
+        <AssociationConnector Association="hotels15Model.FK_HotelImage_Hotel" />
+        <AssociationConnector Association="hotels15Model.FK_TypeOfTour_Tour1" />
+        <AssociationConnector Association="hotels15Model.FK_TypeOfTour_Type" />
+        <AssociationConnector Association="hotels15Model.HotelOfTour" />
       </Diagram>
       </Diagram>
     </edmx:Diagrams>
     </edmx:Diagrams>
   </edmx:Designer>
   </edmx:Designer>

+ 29 - 3
practica12/Pages/HotelPage.xaml

@@ -10,9 +10,11 @@
 
 
     <Grid>
     <Grid>
         <StackPanel>
         <StackPanel>
-            <TextBlock Text="Отели"/>
+        <StackPanel>
+        <StackPanel>
+                <TextBlock Text="Отели" FontSize="28" Style="{StaticResource TBStyle}"/>
         </StackPanel>
         </StackPanel>
-        <DataGrid Name="dgHotels" AutoGenerateColumns="False" CanUserAddRows="False" FontSize="16" FontFamily="Comic Sans MS">
+        <DataGrid Name="dgHotels" AutoGenerateColumns="False" Height="450" CanUserAddRows="False" FontSize="16" FontFamily="Comic Sans MS" Margin="0,0,0,5">
             <DataGrid.Columns>
             <DataGrid.Columns>
                 <DataGridTextColumn Header="Название" Width="*" Binding="{Binding Name}"/>
                 <DataGridTextColumn Header="Название" Width="*" Binding="{Binding Name}"/>
                 <DataGridTextColumn Header="Кол-во звезд" Width="*" Binding="{Binding CountOfStars}"/>
                 <DataGridTextColumn Header="Кол-во звезд" Width="*" Binding="{Binding CountOfStars}"/>
@@ -21,11 +23,35 @@
                 <DataGridTemplateColumn Width="*">
                 <DataGridTemplateColumn Width="*">
                     <DataGridTemplateColumn.CellTemplate>
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                         <DataTemplate>
-                            <Button Name="btnUpdate" Uid="{Binding Id}" Content="Редактировать"/>
+                                <Button Name="btnUpdate" Uid="{Binding Id}" HorizontalAlignment="Center" FontSize="14" Style="{StaticResource btnstyle1}" Content="Редактировать"/>
                         </DataTemplate>
                         </DataTemplate>
                     </DataGridTemplateColumn.CellTemplate>
                     </DataGridTemplateColumn.CellTemplate>
                 </DataGridTemplateColumn>
                 </DataGridTemplateColumn>
             </DataGrid.Columns>
             </DataGrid.Columns>
         </DataGrid>
         </DataGrid>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+            <Button Name="btn_Tours" Content="Туры" Click="btn_Tours_Click"  Style="{StaticResource btnstyle1}" />
+            <Button Name="btn_Add" Content="Добавить" Click="btn_Add_Click"  Style="{StaticResource btnstyle1}" />
+            <Button Name="btn_Dell" Content="Туры" Click="btn_Dell_Click"  Style="{StaticResource btnstyle1}" />
+            </StackPanel>
+        </StackPanel>
+        <StackPanel>
+        <!--Меню с номерами страниц-->
+            <StackPanel>
+        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+            <GroupBox Header="Введите количество записей на одной странице">
+            <TextBox Name="txtPageCount" TextChanged="txtPageCount_TextChanged"/>
+            </GroupBox>
+            <TextBlock Name="txtPrev" Uid="prev" Text=" &lt; " MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txt1" Uid="1" Text="{Binding  Path = NPage[0]}" Visibility="{Binding Visible[0]}" FontWeight="{Binding Bold[0]}" MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txt2" Uid="2" Text="{Binding  Path = NPage[1]}" Visibility="{Binding Visible[1]}" FontWeight="{Binding Bold[1]}" MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txt3" Uid="3" Text="{Binding  Path = NPage[2]}" Visibility="{Binding Visible[2]}" FontWeight="{Binding Bold[2]}" MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txt4" Uid="4" Text="{Binding  Path = NPage[3]}" Visibility="{Binding Visible[3]}" FontWeight="{Binding Bold[3]}" MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txt5" Uid="5" Text="{Binding  Path = NPage[4]}" Visibility="{Binding Visible[4]}" FontWeight="{Binding Bold[4]}" MouseDown="GoPage_MouseDown"/>
+            <TextBlock Name="txtNext" Uid="next" Text=" &gt;" MouseDown="GoPage_MouseDown"/>
+        </StackPanel>
+            </StackPanel>
+        </StackPanel>
+        </StackPanel>
     </Grid>
     </Grid>
 </Page>
 </Page>

+ 59 - 3
practica12/Pages/HotelPage.xaml.cs

@@ -21,14 +21,70 @@ namespace practica12.Pages
     /// </summary>
     /// </summary>
     public partial class HotelPage : Page
     public partial class HotelPage : Page
     {
     {
-       
+        Pagin pc = new Pagin();
         List<Hotel> listHotel = Base.ep.Hotel.ToList();
         List<Hotel> listHotel = Base.ep.Hotel.ToList();
         public HotelPage()
         public HotelPage()
         {
         {
             InitializeComponent();
             InitializeComponent();
             dgHotels.ItemsSource = Base.ep.Hotel.ToList();
             dgHotels.ItemsSource = Base.ep.Hotel.ToList();
-            
-            
+            pc.Countlist = listHotel.Count;
+            pc.CountPage = 10;
+            dgHotels.ItemsSource = listHotel.Skip(0).Take(pc.CountPage).ToList();  
+            DataContext = pc;
+
+        }
+        private void txtPageCount_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            try
+            {
+                pc.CountPage = Convert.ToInt32(txtPageCount.Text); // если в текстовом поле есnь значение, присваиваем его свойству объекта, которое хранит количество записей на странице
+            }
+            catch
+            {
+                pc.CountPage = 10; // если в текстовом поле значения нет, присваиваем свойству объекта, которое хранит количество записей на странице количество элементов в списке
+            }
+            pc.Countlist = listHotel.Count;  // присваиваем новое значение свойству, которое в объекте отвечает за общее количество записей
+            dgHotels.ItemsSource = listHotel.Skip(0).Take(pc.CountPage).ToList();  // отображаем первые записи в том количестве, которое равно CountPage
+            pc.CurrentPage = 1; // текущая страница - это страница 1
+        }
+        private void GoPage_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+
+            switch (tb.Uid)  // определяем, куда конкретно было сделано нажатие
+            {
+                case "prev":
+                    pc.CurrentPage--;
+                    break;
+                case "next":
+                    pc.CurrentPage++;
+                    break;
+                case "firstPage":
+                    pc.CurrentPage = 1;
+                    break;
+                case "lastPage":
+                    pc.CurrentPage = pc.CountPages;
+                    break;
+                default:
+                    pc.CurrentPage = Convert.ToInt32(tb.Text);
+                    break;
+            }
+            dgHotels.ItemsSource = listHotel.Skip(pc.CurrentPage * pc.CountPage - pc.CountPage).Take(pc.CountPage).ToList();  // оображение записей постранично с определенным количеством на каждой странице
+        }
+        private void btn_Tours_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.MainFrame.Navigate(new MainPage());
         }
         }
+
+        private void btn_Add_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void btn_Dell_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+       
     }
     }
 }
 }

+ 34 - 18
practica12/Pages/MainPage.xaml

@@ -5,33 +5,50 @@
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:local="clr-namespace:practica12.Pages"
       xmlns:local="clr-namespace:practica12.Pages"
       mc:Ignorable="d" 
       mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800"
+      d:DesignHeight="574" d:DesignWidth="950" 
       Title="MainPage">
       Title="MainPage">
-
+    <Page.Resources>
+        <BitmapImage x:Key="defaultImage" UriSource="/Resourse/NoPhoto.png"/>
+    </Page.Resources>
     <Grid>
     <Grid>
-        <StackPanel>
+        <StackPanel Height="574" VerticalAlignment="Bottom">
             
             
 
 
                 <TextBlock Text="Туры" FontSize="28" Margin="0,0,0,10" Style="{StaticResource TBStyle}" />
                 <TextBlock Text="Туры" FontSize="28" Margin="0,0,0,10" Style="{StaticResource TBStyle}" />
                 <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
                 <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
                     <TextBlock Text="Введите текс для поиска:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
                     <TextBlock Text="Введите текс для поиска:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
-                    <TextBox Name="Search"  Height="20" Width="300" />
+                <TextBox Name="Search" TextChanged="Search_TextChanged" Height="20" Width="300" />
                 </StackPanel>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal" Margin="105,0,0,0" HorizontalAlignment="Center">
                 <StackPanel Orientation="Horizontal" Margin="105,0,0,0" HorizontalAlignment="Center">
                     <TextBlock Text="Выберите тип:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
                     <TextBlock Text="Выберите тип:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
-                    <ComboBox  x:Name="ComboBox1" Height="20" Width="300"  >
-                        <ComboBoxItem>Мужской</ComboBoxItem>
-                        <ComboBoxItem>Женский</ComboBoxItem>
+                <ComboBox  x:Name="ComboBox1"  SelectionChanged="ComboBox1_SelectionChanged"  Height="20" Width="300"  >
+                        
                     </ComboBox>
                     </ComboBox>
                 </StackPanel>
                 </StackPanel>
-                <CheckBox Name="cbActual" Content="Только актуальные туры" Checked="cbActual_Checked" Unchecked="cbActual_Checked" HorizontalAlignment="Center"/>
+            <StackPanel Orientation="Horizontal" Margin="35,0,0,0"  HorizontalAlignment="Center">
+                <TextBlock Margin="5" FontSize="20" Text="Критерий сортировки" Style="{StaticResource TBStyle}"/>
+                <StackPanel Height="36" Width="305" Orientation="Horizontal">
+                    <ComboBox  x:Name="Sort"   SelectionChanged="Sort_SelectionChanged" Height="20" Width="300" >
+
+                        <ComboBoxItem>Без сотрировки</ComboBoxItem>
+                        <ComboBoxItem>По возрастанию</ComboBoxItem>
+                        <ComboBoxItem>По убыванию</ComboBoxItem>
+                        
 
 
+                    </ComboBox>
+                </StackPanel>
+            </StackPanel>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <CheckBox Name="cbActual" Content="Только актуальные туры" FontSize="14" Checked="cbActual_Checked" Foreground="#445c93" Unchecked="cbActual_Checked" HorizontalAlignment="Center"/>
+
+                <TextBlock Name="tbTotalCostOfTours"  FontSize="20" Foreground="#445c93"  Margin="300,0,0,0" HorizontalAlignment="Right"/>
+            </StackPanel>
 
 
-                <StackPanel>
+            <StackPanel>
                     
                     
                     
                     
 
 
-                <ListView x:Name="lvListTour" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Height="273">
+                <ListView x:Name="lvListTour" Margin="10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Height="312">
                     <ListView.ItemsPanel>
                     <ListView.ItemsPanel>
                         <ItemsPanelTemplate>
                         <ItemsPanelTemplate>
                             <WrapPanel HorizontalAlignment="Center"></WrapPanel>
                             <WrapPanel HorizontalAlignment="Center"></WrapPanel>
@@ -42,21 +59,20 @@
                             <Border Padding="10" CornerRadius="20" BorderThickness="1" BorderBrush="#445c93">
                             <Border Padding="10" CornerRadius="20" BorderThickness="1" BorderBrush="#445c93">
                                 <Grid Width="400" Height="400">
                                 <Grid Width="400" Height="400">
                                     <StackPanel>
                                     <StackPanel>
-                                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" FontSize="24" Margin="10" TextWrapping="Wrap" TextAlignment="Center"/>
-                                        <Image Width="400" Height="220" Source="{Binding ImagePreview, TargetNullValue={StaticResource defaultImage}}"/>
-                                        <TextBlock Text="{Binding Price, StringFormat={}{0:F3} РУБ}" HorizontalAlignment="Center" FontSize="28" FontWeight="Bold" Margin="0,10,0,0"/>
+                                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" FontSize="24" Margin="10" TextWrapping="Wrap" TextAlignment="Center"/>
+                                    <Image Width="400" Height="220" Source="{Binding ImagePreview, TargetNullValue={StaticResource defaultImage}}"/>
+                                    <TextBlock Text="{Binding Price, StringFormat={}{0:F3} РУБ}" HorizontalAlignment="Center" FontSize="28" FontWeight="Bold" Margin="0,10,0,0"/>
                                         <Grid Margin="0,20,0,0">
                                         <Grid Margin="0,20,0,0">
-                                            <TextBlock Text="{Binding Actual}" HorizontalAlignment="Left" Margin="10, 0, 0, 0" Foreground="{Binding ForegroundActual}"/>
-                                            <TextBlock Text="{Binding TicketCount, StringFormat={}Билетов: {0}}" HorizontalAlignment="Right" Margin="0, 0, 10, 0"/>
-                                        </Grid>
-                                    </StackPanel>
+                                            <TextBlock Text="{Binding TicketCount, StringFormat={}Билетов: {0}}" HorizontalAlignment="Center" Margin="0, 0, 10, 0"/>
+                                    </Grid>
+                                </StackPanel>  
                                 </Grid>
                                 </Grid>
                             </Border>
                             </Border>
                         </DataTemplate>
                         </DataTemplate>
                     </ListView.ItemTemplate>
                     </ListView.ItemTemplate>
                 </ListView>
                 </ListView>
             </StackPanel>
             </StackPanel>
-            <Button Name="btn_hotel" Content="Отели" Click="btn_hotel_Click" />
+            <Button Name="btn_hotel" Content="Отели" Click="btn_hotel_Click"  Style="{StaticResource btnstyle1}" />
             </StackPanel>
             </StackPanel>
         
         
     </Grid>
     </Grid>

+ 85 - 10
practica12/Pages/MainPage.xaml.cs

@@ -22,29 +22,104 @@ namespace practica12.Pages
     /// </summary>
     /// </summary>
     public partial class MainPage : Page
     public partial class MainPage : Page
     {
     {
-       //List<Tour> listFilter = Base.ep.Tour.ToList();
+       List<Tour> listFilter = Base.ep.Tour.ToList();
+       List<Tour> list = Base.ep.Tour.ToList();
         public MainPage()
         public MainPage()
         {
         {
             InitializeComponent();
             InitializeComponent();
             lvListTour.ItemsSource = Base.ep.Tour.ToList();
             lvListTour.ItemsSource = Base.ep.Tour.ToList();
-            //List<Type> type = Base.ep.Type.ToList();
-            //ComboBox1.Items.Add("Все типы");
-            //for (int i = 0; i < type.Count; i++)
-            //{
-            //    ComboBox1.Items.Add(type[i].Name);
-            //}
-            //ComboBox1.SelectedIndex = 0;
-            
+            List<Type> type = Base.ep.Type.ToList();
+            ComboBox1.Items.Add("Все типы");
+            for (int i = 0; i < type.Count; i++)
+            {
+                ComboBox1.Items.Add(type[i].Name);
+            }
+            ComboBox1.SelectedIndex = 0;
+            Sort.SelectedIndex = 0;
         }
         }
 
 
         private void cbActual_Checked(object sender, RoutedEventArgs e)
         private void cbActual_Checked(object sender, RoutedEventArgs e)
         {
         {
-
+            Filter();
         }
         }
 
 
         private void btn_hotel_Click(object sender, RoutedEventArgs e)
         private void btn_hotel_Click(object sender, RoutedEventArgs e)
         {
         {
             FrameClass.MainFrame.Navigate(new HotelPage());
             FrameClass.MainFrame.Navigate(new HotelPage());
         }
         }
+        public void Filter()
+        {
+            
+            string t = ComboBox1.SelectedValue.ToString();
+            int index = ComboBox1.SelectedIndex;
+            List<TypeOfTour> types = Base.ep.TypeOfTour.Where(z => z.Type.Name == t).ToList();
+            if (index != 0)
+            {
+                listFilter = new List<Tour>();
+                foreach (TypeOfTour tot in types)
+                {
+                    foreach (Tour tour in list)
+                    {
+                        if (tour.Id == tot.TourId)
+                        {
+                            listFilter.Add(tour);
+                        }
+                    }
+                }
+            }
+            else
+            {
+                listFilter = Base.ep.Tour.ToList();
+            }
+
+            if (!string.IsNullOrWhiteSpace(Search.Text))
+            {
+                listFilter = listFilter.Where(z => z.Name.ToLower().Contains(Search.Text.ToLower())).ToList();
+            }
+
+            if (cbActual.IsChecked == true) 
+            {
+                listFilter = listFilter.Where(z => z.IsActual == true).ToList();
+            }
+
+            switch (Sort.SelectedIndex) 
+            {
+                case 1:
+                    listFilter.Sort((x, y) => x.Price.CompareTo(y.Price));
+                    break;
+                case 2:
+                    listFilter.Sort((x, y) => x.Price.CompareTo(y.Price));
+                    listFilter.Reverse();
+                    break;
+            }
+
+            lvListTour.ItemsSource = listFilter;
+            int price = 0;
+            foreach (Tour tour in listFilter) 
+            {
+                price += (int)tour.Price * tour.TicketCount;
+            }
+            tbTotalCostOfTours.Text = string.Format("Общая стоимость туров: {0:C2}", price);
+            if (listFilter.Count == 0)
+            {
+                MessageBox.Show("нет записей");
+            }
+        }
+
+        private void ComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            Filter();
+        }
+
+        private void Sort_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            Filter();
+        }
+
+        private void Search_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            Filter();
+        }
+        
     }
     }
 }
 }

+ 4 - 4
practica12/Tour.cs

@@ -17,21 +17,21 @@ namespace practica12
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Tour()
         public Tour()
         {
         {
+            this.TypeOfTour = new HashSet<TypeOfTour>();
             this.Hotel = new HashSet<Hotel>();
             this.Hotel = new HashSet<Hotel>();
-            this.Type = new HashSet<Type>();
         }
         }
     
     
         public int Id { get; set; }
         public int Id { get; set; }
         public int TicketCount { get; set; }
         public int TicketCount { get; set; }
         public string Name { get; set; }
         public string Name { get; set; }
         public string Description { get; set; }
         public string Description { get; set; }
-        public byte[] ImagePreview { get; set; }
+        public string ImagePreview { get; set; }
         public decimal Price { get; set; }
         public decimal Price { get; set; }
         public bool IsActual { get; set; }
         public bool IsActual { get; set; }
     
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<Hotel> Hotel { get; set; }
+        public virtual ICollection<TypeOfTour> TypeOfTour { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<Type> Type { get; set; }
+        public virtual ICollection<Hotel> Hotel { get; set; }
     }
     }
 }
 }

+ 2 - 2
practica12/Type.cs

@@ -17,7 +17,7 @@ namespace practica12
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Type()
         public Type()
         {
         {
-            this.Tour = new HashSet<Tour>();
+            this.TypeOfTour = new HashSet<TypeOfTour>();
         }
         }
     
     
         public int Id { get; set; }
         public int Id { get; set; }
@@ -25,6 +25,6 @@ namespace practica12
         public string Description { get; set; }
         public string Description { get; set; }
     
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<Tour> Tour { get; set; }
+        public virtual ICollection<TypeOfTour> TypeOfTour { get; set; }
     }
     }
 }
 }

+ 24 - 0
practica12/TypeOfTour.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace practica12
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class TypeOfTour
+    {
+        public int ID { get; set; }
+        public int TourId { get; set; }
+        public int TypeId { get; set; }
+    
+        public virtual Tour Tour { get; set; }
+        public virtual Type Type { get; set; }
+    }
+}

+ 13 - 1
practica12/practica12.csproj

@@ -65,6 +65,7 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     </ApplicationDefinition>
     <Compile Include="Classs\Base.cs" />
     <Compile Include="Classs\Base.cs" />
+    <Compile Include="Classs\Pagin.cs" />
     <Compile Include="Country.cs">
     <Compile Include="Country.cs">
       <DependentUpon>Model1.tt</DependentUpon>
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
     </Compile>
@@ -82,6 +83,12 @@
       <DesignTime>True</DesignTime>
       <DesignTime>True</DesignTime>
       <DependentUpon>Model1.tt</DependentUpon>
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="sp_helpdiagramdefinition_Result.cs">
+      <DependentUpon>Model1.tt</DependentUpon>
+    </Compile>
+    <Compile Include="sp_helpdiagrams_Result.cs">
+      <DependentUpon>Model1.tt</DependentUpon>
+    </Compile>
     <Compile Include="sysdiagrams.cs">
     <Compile Include="sysdiagrams.cs">
       <DependentUpon>Model1.tt</DependentUpon>
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
     </Compile>
@@ -91,6 +98,9 @@
     <Compile Include="Type.cs">
     <Compile Include="Type.cs">
       <DependentUpon>Model1.tt</DependentUpon>
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="TypeOfTour.cs">
+      <DependentUpon>Model1.tt</DependentUpon>
+    </Compile>
     <Page Include="MainWindow.xaml">
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
@@ -190,6 +200,9 @@
   <ItemGroup>
   <ItemGroup>
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Resourse\NoPhoto.png" />
+  </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Content Include="Model1.Context.tt">
     <Content Include="Model1.Context.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <Generator>TextTemplatingFileGenerator</Generator>
@@ -201,7 +214,6 @@
       <DependentUpon>Model1.edmx</DependentUpon>
       <DependentUpon>Model1.edmx</DependentUpon>
       <LastGenOutput>Model1.cs</LastGenOutput>
       <LastGenOutput>Model1.cs</LastGenOutput>
     </Content>
     </Content>
-    <Resource Include="Resourse\NoPhoto.png" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
 </Project>

+ 19 - 0
practica12/sp_helpdiagramdefinition_Result.cs

@@ -0,0 +1,19 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace practica12
+{
+    using System;
+    
+    public partial class sp_helpdiagramdefinition_Result
+    {
+        public Nullable<int> version { get; set; }
+        public byte[] definition { get; set; }
+    }
+}

+ 22 - 0
practica12/sp_helpdiagrams_Result.cs

@@ -0,0 +1,22 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace practica12
+{
+    using System;
+    
+    public partial class sp_helpdiagrams_Result
+    {
+        public string Database { get; set; }
+        public string Name { get; set; }
+        public int ID { get; set; }
+        public string Owner { get; set; }
+        public int OwnerID { get; set; }
+    }
+}