максим карбышев hace 2 años
padre
commit
cea6fdbc6d

+ 10 - 8
Kinomaks/AddWindows/AddFilmWindow.xaml

@@ -7,14 +7,16 @@
         mc:Ignorable="d"
         Title="Добавление фильма" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
     <Grid>
-        <Label Content="Название:" HorizontalAlignment="Left" Margin="127,134,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
-        <TextBox Name="Title" HorizontalAlignment="Left" Margin="307,134,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="60" Width="730" FontSize="36"/>
-        <Label Content="Описание:" HorizontalAlignment="Left" Margin="127,228,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
-        <TextBox Name="Description" HorizontalAlignment="Left" Margin="137,304,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="328" Width="904" FontSize="36"/>
-        <Label Content="Лого:" HorizontalAlignment="Left" Margin="127,662,0,0" VerticalAlignment="Top" Height="61" Width="162" Foreground="White" FontSize="36"/>
-        <Button Name="SelectButton" Content="Выбрать" HorizontalAlignment="Left" Margin="307,662,0,0" VerticalAlignment="Top" Height="60" Width="180" FontSize="36" Click="SelectButtonClick"/>
-        <Image Name="Logo" HorizontalAlignment="Left" Height="500" Margin="1126,170,0,0" VerticalAlignment="Top"  Width="374"/>
+        <Label Content="Название:" HorizontalAlignment="Left" Margin="127,86,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <TextBox Name="Title" HorizontalAlignment="Left" Margin="307,86,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="60" Width="730" FontSize="36"/>
+        <Label Content="Цена:" HorizontalAlignment="Left" Margin="127,180,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <TextBox Name="Price" HorizontalAlignment="Left" Margin="307,180,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="60" Width="250" FontSize="36"/>
+        <Label Content="Описание:" HorizontalAlignment="Left" Margin="127,274,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <TextBox Name="Description" HorizontalAlignment="Left" Margin="137,350,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="328" Width="904" FontSize="36"/>
+        <Label Content="Лого:" HorizontalAlignment="Left" Margin="127,708,0,0" VerticalAlignment="Top" Height="61" Width="162" Foreground="White" FontSize="36"/>
+        <Button Name="SelectButton" Content="Выбрать" HorizontalAlignment="Left" Margin="307,708,0,0" VerticalAlignment="Top" Height="60" Width="180" FontSize="36" Click="SelectButtonClick"/>
+        <Image Name="Logo" HorizontalAlignment="Left" Height="649" Margin="1129,133,0,0" VerticalAlignment="Top"  Width="411"/>
         <Button Name="BackButton"  Content="Назад" HorizontalAlignment="Left" Margin="20,17,0,0" VerticalAlignment="Top" Height="39" Width="140" FontSize="25" Click="BackButtonClick"/>
-        <Button Name="AddButton" Content="Добавить" HorizontalAlignment="Center" Margin="0,746,0,0" VerticalAlignment="Top" Height="60" Width="180" FontSize="36" Click="AddButtonClick" />
+        <Button Name="AddButton" Content="Добавить" HorizontalAlignment="Center" Margin="0,792,0,0" VerticalAlignment="Top" Height="60" Width="180" FontSize="36" Click="AddButtonClick" />
     </Grid>
 </Window>

+ 20 - 10
Kinomaks/AddWindows/AddFilmWindow.xaml.cs

@@ -1,4 +1,5 @@
-using System.Windows;
+using System;
+using System.Windows;
 using System.Windows.Media.Imaging;
 
 namespace Kinomaks.AddWindows
@@ -21,26 +22,28 @@ namespace Kinomaks.AddWindows
             #endregion
         }
 
-        private void BackButtonClick(object sender, RoutedEventArgs e)
-        {
-            MainWindow mainWindow = new MainWindow();
-            mainWindow.Show();
-            this.Close();
-        }
-
         private void AddButtonClick(object sender, RoutedEventArgs e)
         {
             #region Добавление фильма
-            if (Title.Text == "")
+            if (Title.Text == "" || Price.Text == "")
             {
                 ErrorWindow errorWindow = new ErrorWindow("пустые поля");
                 errorWindow.Show();
                 return;
             }
 
+            decimal tempResult;
+            if (!decimal.TryParse(Price.Text, out tempResult))
+            {
+                ErrorWindow errorWindow = new ErrorWindow("цена указана неверно");
+                errorWindow.Show();
+                return;
+            }
+
             Films film = new Films()
             {
-                Title = Title.Text
+                Title = Title.Text,
+                Price = Convert.ToDecimal(Price.Text)
             };
 
             if (Description.Text != null)
@@ -57,5 +60,12 @@ namespace Kinomaks.AddWindows
             this.Close();
             #endregion
         }
+
+        private void BackButtonClick(object sender, RoutedEventArgs e)
+        {
+            MainWindow mainWindow = new MainWindow();
+            mainWindow.Show();
+            this.Close();
+        }
     }
 }

+ 8 - 1
Kinomaks/AddWindows/AddHallWindow.xaml.cs

@@ -44,7 +44,6 @@ namespace Kinomaks.AddWindows
             }
 
             int countOfSeats = 0;
-
             foreach (UIElement item in Seats.Children)
             {
                 countOfSeats++;
@@ -57,6 +56,14 @@ namespace Kinomaks.AddWindows
                 return;
             }
 
+            int tempResult;
+            if (!int.TryParse(Number.Text, out tempResult))
+            {
+                ErrorWindow errorWindow = new ErrorWindow("номер указан неверно");
+                errorWindow.Show();
+                return;
+            }
+
             Hall hall = new Hall()
             {
                 Number = Convert.ToInt32(Number.Text),

+ 22 - 0
Kinomaks/AddWindows/AddTimetable.xaml

@@ -0,0 +1,22 @@
+<Window x:Class="Kinomaks.AddWindows.AddTimetable"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:Kinomaks.AddWindows"
+        mc:Ignorable="d"
+        Title="Добавление расписания" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
+    <Grid>
+        <Label Content="Дата:" HorizontalAlignment="Left" Margin="449,222,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <TextBox x:Name="Date" HorizontalAlignment="Left" Margin="629,222,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="60" Width="316" FontSize="36" TextChanged="DateTextChanged"/>
+        <Label Content="Время:" HorizontalAlignment="Left" Margin="449,316,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <TextBox x:Name="Time" HorizontalAlignment="Left" Margin="629,316,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="60" Width="316" FontSize="36" TextChanged="TimeTextChanged"/>
+        <Button x:Name="BackButton"  Content="Назад" HorizontalAlignment="Left" Margin="20,17,0,0" VerticalAlignment="Top" Height="39" Width="140" FontSize="25" Click="BackButtonClick"/>
+        <Button x:Name="AddButton" Content="Добавить" HorizontalAlignment="Center" Margin="0,792,0,0" VerticalAlignment="Top" Height="60" Width="180" FontSize="36" Click="AddButtonClick" />
+        <Label Content="Зал №:" HorizontalAlignment="Left" Margin="449,410,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <ComboBox x:Name="Hall" HorizontalAlignment="Left" VerticalAlignment="Top" Height="60" Width="316" Foreground="White" FontSize="36" Margin="629,410,0,0"/>
+        <Label Content="Фильм:" HorizontalAlignment="Left" Margin="449,504,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <ComboBox x:Name="Film" HorizontalAlignment="Left" VerticalAlignment="Top" Height="60" Width="544" Foreground="White" FontSize="36" Margin="629,504,0,0"/>
+
+    </Grid>
+</Window>

+ 100 - 0
Kinomaks/AddWindows/AddTimetable.xaml.cs

@@ -0,0 +1,100 @@
+using System;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Text.RegularExpressions;
+
+namespace Kinomaks.AddWindows
+{
+    /// <summary>
+    /// Логика взаимодействия для AddTimetable.xaml
+    /// </summary>
+    public partial class AddTimetable : Window
+    {
+
+        public AddTimetable()
+        {
+            InitializeComponent();
+            Film.ItemsSource = Connection.db.Films.Select(items => items.Title).ToList();
+        }
+        private void AddButtonClick(object sender, RoutedEventArgs e)
+        {
+            #region Добавление расписания
+            if (Date.Text == "" || Time.Text == "" || Hall.SelectedItem == null || Film.SelectedItem == null)
+            {
+                ErrorWindow errorWindow = new ErrorWindow("пустые поля");
+                errorWindow.Show();
+                return;
+            }
+
+            TimeSpan timeResult;
+            if (!TimeSpan.TryParse(Time.Text, out timeResult) || Time.Text.Count(item => item == ':') != 2)
+            {
+                ErrorWindow errorWindow = new ErrorWindow("неверно указано время");
+                errorWindow.Show();
+                return;
+            }
+
+            string year, month, day;
+            day = Date.Text.Substring(0, Date.Text.IndexOf('.'));
+            month = Date.Text.Substring(Date.Text.IndexOf('.') + 1, 2);
+            year = Date.Text.Substring(Date.Text.LastIndexOf('.') + 1, Date.Text.Length - 1 - Date.Text.LastIndexOf('.'));
+            string correctDate = year + '.' + month + '.' + day;
+
+            DateTime dateResult;
+            if (!DateTime.TryParse(correctDate, out dateResult) || correctDate.Count(item => item == '.') != 2)
+            {
+                ErrorWindow errorWindow = new ErrorWindow("неверно указана дата");
+                errorWindow.Show();
+                return;
+            }
+
+            Timetable timetable = new Timetable()
+            {
+                Time = timeResult,
+                Date = dateResult,
+                IDHall = Connection.db.Hall.Where(item => item.Number == Convert.ToInt32(Hall.SelectedItem)).Select(item => item.ID).FirstOrDefault()
+            };
+
+            Connection.db.Timetable.Add(timetable);
+            Connection.db.SaveChanges();
+
+            FilmTimetable filmTimetable = new FilmTimetable()
+            {
+                IDFilm = Connection.db.Films.Where(item => item.Title == Film.Text).Select(item => item.ID).FirstOrDefault(),
+                IDTimeTable = Connection.db.Timetable.Max(item => item.ID)
+            };
+
+            Connection.db.FilmTimetable.Add(filmTimetable);
+            Connection.db.SaveChanges();
+            #endregion
+        }
+
+        private void DateTextChanged(object sender, TextChangedEventArgs e)
+        {
+            #region Валидация
+            if (Regex.IsMatch((((TextBox)sender).Text).ToString(), "[^0-9.]"))
+            {
+                ((TextBox)sender).Text = ((TextBox)sender).Text.Remove(((TextBox)sender).Text.Length - 1);
+                ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Length;
+            }
+        }
+
+        private void TimeTextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (Regex.IsMatch((((TextBox)sender).Text).ToString(), "[^0-9:]"))
+            {
+                ((TextBox)sender).Text = ((TextBox)sender).Text.Remove(((TextBox)sender).Text.Length - 1);
+                ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Length;
+            }
+            #endregion
+        }
+
+        private void BackButtonClick(object sender, RoutedEventArgs e)
+        {
+            MainWindow mainWindow = new MainWindow();
+            mainWindow.Show();
+            this.Close();
+        }
+    }
+}

+ 24 - 1
Kinomaks/App.config

@@ -17,4 +17,27 @@
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
   </entityFramework>
-<connectionStrings><add name="KinomaksEntities" connectionString="metadata=res://*/KinomaksDB.csdl|res://*/KinomaksDB.ssdl|res://*/KinomaksDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DESKTOP-5285QDG;initial catalog=Kinomaks;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings></configuration>
+  <connectionStrings>
+    <add name="KinomaksEntities" connectionString="metadata=res://*/KinomaksDB.csdl|res://*/KinomaksDB.ssdl|res://*/KinomaksDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DESKTOP-5285QDG;initial catalog=Kinomaks;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.5.1" newVersion="4.0.5.1" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 1 - 1
Kinomaks/App.xaml

@@ -2,7 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:local="clr-namespace:Kinomaks"
-             StartupUri="AuthorizationWindow.xaml">
+             StartupUri="MainWindow.xaml">
     <Application.Resources>
         <ResourceDictionary Source="Style.xaml"/>
     </Application.Resources>

+ 3 - 6
Kinomaks/BuyCash.cs

@@ -8,15 +8,13 @@ namespace Kinomaks
         int IDFilm;
         decimal Price;
         int idTimetable;
-        int IDHall;
         List<int> numberOfSeats;
 
-        public BuyCash(int idFilm, List<int> numberOfSeats, int idTimetable, int idHall)
+        public BuyCash(int idFilm, List<int> numberOfSeats, int idTimetable)
         {
             this.IDFilm = idFilm;
             this.numberOfSeats = numberOfSeats;
             this.idTimetable = idTimetable;
-            this.IDHall = idHall;
             this.Price = Connection.db.Films.Where(item => item.ID == IDFilm).Select(item => item.Price).FirstOrDefault();
         }
 
@@ -24,14 +22,13 @@ namespace Kinomaks
         {
             foreach (int item in this.numberOfSeats)
             {
-                HallTimetable hallTimetable = new HallTimetable()
+                UserTicket userTicket = new UserTicket()
                 {
-                    IDHall = this.IDHall,
                     IDTimetable = this.idTimetable,
                     IDUser = User.IDUser,
                     IDPlace = item
                 };
-                Connection.db.HallTimetable.Add(hallTimetable);
+                Connection.db.UserTicket.Add(userTicket);
                 Connection.db.SaveChanges();
             }
         }

+ 2 - 2
Kinomaks/ElementsWindows/BuyingATicket.xaml

@@ -142,12 +142,12 @@
             <!--#endregion-->
         </Grid>
         <Label Content="Название:" HorizontalAlignment="Left" Margin="36,176,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
-        <Label x:Name="Title" HorizontalAlignment="Left" Margin="218,176,0,0" VerticalAlignment="Top" Height="60" Width="700" FontSize="36" Foreground="#FF54E4FF"/>
+        <Label x:Name="Title" HorizontalAlignment="Left" Margin="218,176,0,0" VerticalAlignment="Top" Height="60" Width="700" FontSize="36" Foreground="White"/>
         <Image x:Name="Logo" HorizontalAlignment="Left" Margin="34,246,0,0" Width="307" Height="372" VerticalAlignment="Top"/>
         <Label Content="Дата и время:" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="363,285,0,0" VerticalAlignment="Top" Height="60" Width="252" Foreground="White" FontSize="36"/>
         <Label x:Name="Time" Content="" HorizontalAlignment="Center" Margin="0,285,0,0" VerticalAlignment="Top" Height="60" Width="364" Foreground="White" FontSize="36"/>
         <Label Content="Зал №:" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="363,366,0,0" VerticalAlignment="Top" Height="60" Width="252" Foreground="White" FontSize="36"/>
-        <Label x:Name="Hall" Content="" HorizontalAlignment="Center" VerticalAlignment="Top" Height="60" Width="364" Foreground="White" FontSize="36" Margin="0,366,0,0"/>
+        <Label x:Name="Hall" HorizontalAlignment="Center" VerticalAlignment="Top" Height="60" Width="364" Foreground="White" FontSize="36" Margin="0,366,0,0"/>
         <Label Content="Цена:" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="363,447,0,0" VerticalAlignment="Top" Height="60" Width="252" Foreground="White" FontSize="36"/>
         <Label x:Name="Price" Content="" HorizontalAlignment="Center" VerticalAlignment="Top" Height="60" Width="364" Foreground="White" FontSize="36" Margin="0,447,0,0"/>
         <Label Content="Мест:" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="363,528,0,0" VerticalAlignment="Top" Height="60" Width="252" Foreground="White" FontSize="36"/>

+ 17 - 15
Kinomaks/ElementsWindows/BuyingATicket.xaml.cs

@@ -4,6 +4,7 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
+using System;
 
 namespace Kinomaks.ElementsWindows
 {
@@ -34,12 +35,13 @@ namespace Kinomaks.ElementsWindows
             Title.Content = film.Title;
             Logo.Source = ImagesManip.NewImage(film);
 
-            Time.Content = Connection.db.Timetable.Where(item => item.ID == idTimetable).Select(item => item.Time).FirstOrDefault();
+            Time.Content = Connection.db.Timetable.Where(item => item.ID == idTimetable).Select(item => item.Time + " " + item.Date).FirstOrDefault();
 
-            hall = Connection.db.HallTimetable.Where(item => item.IDTimetable == idTimetable).Select(item => item.Hall).FirstOrDefault();
-            Hall.Content = hall.Number;
+            hall = Connection.db.Timetable.Where(item => item.ID == idTimetable).Select(item => item.Hall).FirstOrDefault();
+            Hall.Content = hall.ID;
 
             int tempNumberOfSeat = 0;
+
             foreach (UIElement seat in Seats.Children)
             {
                 tempNumberOfSeat++;
@@ -49,11 +51,13 @@ namespace Kinomaks.ElementsWindows
                     continue;
                 }
 
-                if (Connection.db.HallTimetable.Where(item => item.IDTimetable == idTimetable).Select(item => item.IDPlace).Contains(tempNumberOfSeat))
+                if (Connection.db.UserTicket.Where(item => item.Timetable.ID == idTimetable).Select(item => item.IDPlace).Contains(tempNumberOfSeat))
                 {
                     ((Button)seat).Background = Brushes.Red;
                 }
             }
+
+            Price.Content = string.Format("{0:f2}", film.Price);
         }
 
         private void ClickOnCell(object sender, MouseButtonEventArgs e)
@@ -70,24 +74,15 @@ namespace Kinomaks.ElementsWindows
                 ((Button)sender).Background = Brushes.Blue;
 
                 numberOfSeats.Add((Grid.GetRow((Button)sender) * 10) + 1 + Grid.GetColumn((Button)sender) + 1);
-
-                CountOfSeats.Content = numberOfSeats.Count;
             }    
             else if (((Button)sender).Background == Brushes.Blue)
             {
                 ((Button)sender).Background = color;
 
                 numberOfSeats.Remove((Grid.GetRow((Button)sender) * 10) + 1 + Grid.GetColumn((Button)sender) + 1);
-
-                CountOfSeats.Content = numberOfSeats.Count;
             }
-        }
 
-        private void BackButtonClick(object sender, RoutedEventArgs e)
-        {
-            MainWindow mainWindow = new MainWindow();
-            mainWindow.Show();
-            this.Close();
+            CountOfSeats.Content = numberOfSeats.Count;
         }
 
         private void BuyButtonClick(object sender, RoutedEventArgs e)
@@ -99,9 +94,16 @@ namespace Kinomaks.ElementsWindows
                 return;
             }
 
-            PaymentMethod paymentMethod = new PaymentMethod(film.ID, numberOfSeats, idTimetable, hall.ID);
+            PaymentMethod paymentMethod = new PaymentMethod(film.ID, numberOfSeats, idTimetable);
             paymentMethod.Show();
             this.Close();
         }
+
+        private void BackButtonClick(object sender, RoutedEventArgs e)
+        {
+            MainWindow mainWindow = new MainWindow();
+            mainWindow.Show();
+            this.Close();
+        }
     }
 }

+ 7 - 4
Kinomaks/ElementsWindows/FilmWindow.xaml

@@ -8,10 +8,13 @@
         Title="Фильм" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
     <Grid>
         <Button Name="BackButton" Content="Назад" HorizontalAlignment="Left" Margin="20,17,0,0" VerticalAlignment="Top" Height="39" Width="140" FontSize="25" Click="BackButtonClick"/>
-        <Label Content="Название:" HorizontalAlignment="Left" Margin="140,176,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
-        <Label Name="Title" HorizontalAlignment="Left" Margin="322,176,0,0" VerticalAlignment="Top" Height="60" Width="700" FontSize="36" Foreground="#FF54E4FF"/>
+        <Label Content="Название:" HorizontalAlignment="Left" Margin="140,86,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
+        <Label Name="Title" HorizontalAlignment="Left" Margin="322,86,0,0" VerticalAlignment="Top" Height="60" Width="700" FontSize="36" Foreground="White"/>
+        <Label Content="Цена:" HorizontalAlignment="Left" Margin="140,176,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" HorizontalContentAlignment="Right" FontSize="36"/>
+        <Label Name="Price" HorizontalAlignment="Left" Margin="322,176,0,0" VerticalAlignment="Top" Height="60" Width="700" FontSize="36" Foreground="White"/>
         <Label Content="Описание:" HorizontalAlignment="Left" Margin="140,266,0,0" VerticalAlignment="Top" Height="60" Width="180" Foreground="White" FontSize="36"/>
-        <Label Name="Description" HorizontalAlignment="Left" Margin="140,337,0,0" VerticalAlignment="Top" Height="441" Width="884" FontSize="36" Foreground="#FF54E4FF"/>
+        <Label Name="Description" HorizontalAlignment="Left" Margin="140,337,0,0" VerticalAlignment="Top" Height="413" Width="884" FontSize="36" Foreground="White"/>
         <Image Name="Logo" HorizontalAlignment="Left" Margin="1129,133,0,0" Width="411" Height="649" VerticalAlignment="Top"/>
+        <Button x:Name="GoToTimetable" Content="Перейти к расписанию с фильмом" HorizontalAlignment="Center" Margin="0,792,0,0" VerticalAlignment="Top" Height="60" Width="608" FontSize="36" Click="GoToTimetableClick" />
     </Grid>
-</Window>
+</Window>

+ 8 - 0
Kinomaks/ElementsWindows/FilmWindow.xaml.cs

@@ -15,9 +15,17 @@ namespace Kinomaks.ElementsWindows
             InitializeComponent();
             film = Connection.db.Films.Where(item => item.ID == id).FirstOrDefault();
             Title.Content = film.Title;
+            Price.Content = string.Format("{0:f2}", film.Price);
             Logo.Source = ImagesManip.NewImage(film);
         }
 
+        private void GoToTimetableClick(object sender, RoutedEventArgs e)
+        {
+            TimetableWindow timetableWindow = new TimetableWindow(film.ID);
+            timetableWindow.Show();
+            this.Close();
+        }
+
         private void BackButtonClick(object sender, RoutedEventArgs e)
         {
             FilmsListWindow filmsListWindow = new FilmsListWindow();

+ 2 - 4
Kinomaks/ElementsWindows/PaymentMethod.xaml.cs

@@ -11,21 +11,19 @@ namespace Kinomaks.ElementsWindows
         int idFilm;
         List<int> numberOfSeats;
         int idTimetable;
-        int idHall;
 
-        public PaymentMethod(int idFilm, List<int> numberOfSeats, int idTimetable, int idHall)
+        public PaymentMethod(int idFilm, List<int> numberOfSeats, int idTimetable)
         {
             InitializeComponent();
 
             this.idFilm = idFilm;
             this.numberOfSeats = numberOfSeats;
             this.idTimetable = idTimetable;
-            this.idHall = idHall;
         }
 
         private void CashButtonClick(object sender, RoutedEventArgs e)
         {
-            PaymentWindow paymentWindow = new PaymentWindow(idFilm, numberOfSeats, idTimetable, idHall);
+            PaymentWindow paymentWindow = new PaymentWindow(idFilm, numberOfSeats, idTimetable);
             paymentWindow.Show();
             this.Close();
         }

+ 4 - 6
Kinomaks/ElementsWindows/PaymentWindow.xaml.cs

@@ -12,25 +12,23 @@ namespace Kinomaks.ElementsWindows
         int idFilm;
         List<int> numberOfSeats;
         int idTimetable;
-        int idHall;
 
-        public PaymentWindow(int idFilm, List<int> numberOfSeats, int idTimetable, int idHall)
+        public PaymentWindow(int idFilm, List<int> numberOfSeats, int idTimetable)
         {
             InitializeComponent();
 
             this.idFilm = idFilm;
             this.numberOfSeats = numberOfSeats;
             this.idTimetable = idTimetable;
-            this.idHall = idHall;
 
-            ToPay.Content = Connection.db.Films.Where(item => item.ID == this.idFilm).Select(item => item.Price).FirstOrDefault() * this.numberOfSeats.Count();
+            ToPay.Content = string.Format("{0:f2}", Connection.db.Films.Where(item => item.ID == this.idFilm).Select(item => item.Price).FirstOrDefault() * this.numberOfSeats.Count());
             Payment();
         }
 
         void Payment()
         {
             Buyer buyer = new Buyer();
-            buyer.DoBuy(new BuyCash(idFilm, numberOfSeats, idTimetable, idHall));
+            buyer.DoBuy(new BuyCash(idFilm, numberOfSeats, idTimetable));
         }
 
         private void PaidButtonClick(object sender, RoutedEventArgs e)
@@ -42,7 +40,7 @@ namespace Kinomaks.ElementsWindows
 
         private void BackButtonClick(object sender, RoutedEventArgs e)
         {
-            PaymentMethod paymentMethod = new PaymentMethod(idFilm, numberOfSeats, idTimetable, idHall);
+            PaymentMethod paymentMethod = new PaymentMethod(idFilm, numberOfSeats, idTimetable);
             paymentMethod.Show();
             this.Close();
         }

+ 16 - 2
Kinomaks/ElementsWindows/TimetableWindow.xaml

@@ -8,12 +8,26 @@
         Title="Расписание" Height="900" Width="1600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
     <Grid>
         <Button Name="BackButton" Content="Назад" HorizontalAlignment="Left" Margin="20,17,0,0" VerticalAlignment="Top" Height="39" Width="140" FontSize="25" Click="BackButtonClick"/>
-        <ListBox VerticalAlignment="Top" HorizontalAlignment="Center" Width="1500" Height="300" Margin="0,112,0,0">
+        <ListBox Name="FilmsList" VerticalAlignment="Center" HorizontalAlignment="Center" Width="1500" Height="500"
+                 ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionChanged="FilmsListSelectionChanged">
             <ListBox.ItemsPanel>
                 <ItemsPanelTemplate>
                     <VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
                 </ItemsPanelTemplate>
             </ListBox.ItemsPanel>
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel Name="FilmStack">
+                        <Image Source="{Binding Films.Logo}" Width="250" Height="300"/>
+                        <Label Content="{Binding Films.Title}" Width="250" Foreground="White" FontSize="25" Height="50"/>
+                        <Label Content="{Binding Films.Price}" Width="250" Foreground="White" FontSize="25" Height="50"/>
+                        <Label Content="{Binding Timetable.Date}" Width="250" Foreground="White" FontSize="25" Height="50"/>
+                        <Label Content="{Binding Timetable.Time}" Width="250" Foreground="White" FontSize="25" Height="50"/>
+                    </StackPanel>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
         </ListBox>
+        <TextBox x:Name="Search" HorizontalAlignment="Center" Margin="0,99,0,0" TextWrapping="Wrap" Text="Поиск" VerticalAlignment="Top" Width="1500" Height="30" FontSize="20" 
+            Foreground="#FF675B5B" PreviewMouseLeftButtonUp="SearchPreviewMouseLeftButtonUp" LostFocus="SearchLostFocus" TextChanged="SearchTextChanged"/>
     </Grid>
-</Window>
+</Window>

+ 52 - 11
Kinomaks/ElementsWindows/TimetableWindow.xaml.cs

@@ -1,16 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kinomaks.ElementsWindows
 {
@@ -22,6 +13,56 @@ namespace Kinomaks.ElementsWindows
         public TimetableWindow()
         {
             InitializeComponent();
+            FilmsList.ItemsSource = Connection.db.FilmTimetable.ToList();
+        }
+
+        public TimetableWindow(int idFilm)
+        {
+            InitializeComponent();
+            FilmsList.ItemsSource = Connection.db.FilmTimetable.Where(item => item.IDFilm == idFilm).ToList();
+            Search.Visibility = Visibility.Hidden;
+        }
+
+        private void FilmsListSelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            int idTimetable = ((FilmTimetable)sender).IDTimeTable;
+            BuyingATicket buyingATicket = new BuyingATicket(idTimetable);
+            buyingATicket.Show();
+            this.Close();
+        }
+
+        private void SearchPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            #region Поиск
+            if (Search.Text == "Поиск")
+                Search.Text = "";
+        }
+
+        private void SearchLostFocus(object sender, RoutedEventArgs e)
+        {
+            if (Search.Text == "")
+                Search.Text = "Поиск";
+        }
+
+        private void SearchTextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (Search.Text != "" && Search.Text != "Поиск")
+            {
+                FilmsList.ItemsSource = Connection.db.FilmTimetable.Where(item => (item.Films.Title + " " + item.Films.Price + " " 
+                                                                                    + item.Timetable.Date + " " + item.Timetable.Time).Contains(Search.Text)).ToList();
+            }
+            else if (Search.Text == "" || Search.Text == "Поиск")
+            {
+                FilmsList.ItemsSource = Connection.db.FilmTimetable.ToList();
+            }
+            #endregion
+        }
+
+        private void BackButtonClick(object sender, RoutedEventArgs e)
+        {
+            MainWindow mw = new MainWindow();
+            mw.Show();
+            this.Close();
         }
     }
-}
+}

+ 3 - 3
Kinomaks/Hall.cs

@@ -17,8 +17,8 @@ namespace Kinomaks
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Hall()
         {
-            this.HallTimetable = new HashSet<HallTimetable>();
             this.Places = new HashSet<Places>();
+            this.Timetable = new HashSet<Timetable>();
         }
     
         public int ID { get; set; }
@@ -26,8 +26,8 @@ namespace Kinomaks
         public int CountOfSeats { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<HallTimetable> HallTimetable { get; set; }
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<Places> Places { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Timetable> Timetable { get; set; }
     }
 }

+ 44 - 3
Kinomaks/Kinomaks.csproj

@@ -35,17 +35,51 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
+      <HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
+    </Reference>
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
     </Reference>
     <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.OData.Edm, Version=7.12.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.OData.Edm.7.12.3\lib\net45\Microsoft.OData.Edm.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Security" />
+    <Reference Include="System.Text.Encodings.Web, Version=4.0.5.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
+    </Reference>
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Core" />
@@ -70,6 +104,9 @@
     <Compile Include="AddWindows\AddHallWindow.xaml.cs">
       <DependentUpon>AddHallWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="AddWindows\AddTimetable.xaml.cs">
+      <DependentUpon>AddTimetable.xaml</DependentUpon>
+    </Compile>
     <Compile Include="BuyCash.cs" />
     <Compile Include="Buyer.cs" />
     <Compile Include="Connection.cs" />
@@ -97,9 +134,6 @@
     <Compile Include="Hall.cs">
       <DependentUpon>KinomaksDB.tt</DependentUpon>
     </Compile>
-    <Compile Include="HallTimetable.cs">
-      <DependentUpon>KinomaksDB.tt</DependentUpon>
-    </Compile>
     <Compile Include="IBuy.cs" />
     <Compile Include="KinomaksDB.Context.cs">
       <AutoGen>True</AutoGen>
@@ -141,6 +175,9 @@
     <Compile Include="Users.cs">
       <DependentUpon>KinomaksDB.tt</DependentUpon>
     </Compile>
+    <Compile Include="UserTicket.cs">
+      <DependentUpon>KinomaksDB.tt</DependentUpon>
+    </Compile>
     <Page Include="AddWindows\AddFilmWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -149,6 +186,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="AddWindows\AddTimetable.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="AuthorizationWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 1 - 1
Kinomaks/KinomaksDB.Context.cs

@@ -28,11 +28,11 @@ namespace Kinomaks
         public virtual DbSet<Films> Films { get; set; }
         public virtual DbSet<FilmTimetable> FilmTimetable { get; set; }
         public virtual DbSet<Hall> Hall { get; set; }
-        public virtual DbSet<HallTimetable> HallTimetable { get; set; }
         public virtual DbSet<Places> Places { get; set; }
         public virtual DbSet<Roles> Roles { get; set; }
         public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
         public virtual DbSet<Timetable> Timetable { get; set; }
         public virtual DbSet<Users> Users { get; set; }
+        public virtual DbSet<UserTicket> UserTicket { get; set; }
     }
 }

+ 116 - 113
Kinomaks/KinomaksDB.edmx

@@ -31,16 +31,6 @@
           <Property Name="Number" Type="int" Nullable="false" />
           <Property Name="CountOfSeats" Type="int" Nullable="false" />
         </EntityType>
-        <EntityType Name="HallTimetable">
-          <Key>
-            <PropertyRef Name="ID" />
-          </Key>
-          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
-          <Property Name="IDHall" Type="int" Nullable="false" />
-          <Property Name="IDTimetable" Type="int" Nullable="false" />
-          <Property Name="IDPlace" Type="int" Nullable="false" />
-          <Property Name="IDUser" Type="int" Nullable="false" />
-        </EntityType>
         <EntityType Name="Places">
           <Key>
             <PropertyRef Name="ID" />
@@ -71,7 +61,9 @@
             <PropertyRef Name="ID" />
           </Key>
           <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
-          <Property Name="Time" Type="datetime" Nullable="false" />
+          <Property Name="Time" Type="time" Precision="7" Nullable="false" />
+          <Property Name="Date" Type="date" Nullable="false" />
+          <Property Name="IDHall" Type="int" Nullable="false" />
         </EntityType>
         <EntityType Name="Users">
           <Key>
@@ -86,6 +78,15 @@
           <Property Name="Email" Type="varchar" MaxLength="50" Nullable="false" />
           <Property Name="IDRole" Type="int" Nullable="false" />
         </EntityType>
+        <EntityType Name="UserTicket">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="IDTimetable" Type="int" Nullable="false" />
+          <Property Name="IDUser" Type="int" Nullable="false" />
+          <Property Name="IDPlace" Type="int" Nullable="false" />
+        </EntityType>
         <Association Name="FK_FilmTimetable_Films">
           <End Role="Films" Type="Self.Films" Multiplicity="1" />
           <End Role="FilmTimetable" Type="Self.FilmTimetable" Multiplicity="*" />
@@ -110,63 +111,63 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Hall">
+        <Association Name="FK_Places_Hall">
           <End Role="Hall" Type="Self.Hall" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+          <End Role="Places" Type="Self.Places" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Hall">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
+            <Dependent Role="Places">
               <PropertyRef Name="IDHall" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Timetable">
-          <End Role="Timetable" Type="Self.Timetable" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+        <Association Name="FK_Timetable_Hall">
+          <End Role="Hall" Type="Self.Hall" Multiplicity="1" />
+          <End Role="Timetable" Type="Self.Timetable" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Timetable">
+            <Principal Role="Hall">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
-              <PropertyRef Name="IDTimetable" />
+            <Dependent Role="Timetable">
+              <PropertyRef Name="IDHall" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Users">
-          <End Role="Users" Type="Self.Users" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+        <Association Name="FK_Users_Roles">
+          <End Role="Roles" Type="Self.Roles" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Users">
+            <Principal Role="Roles">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
-              <PropertyRef Name="IDUser" />
+            <Dependent Role="Users">
+              <PropertyRef Name="IDRole" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_Places_Hall">
-          <End Role="Hall" Type="Self.Hall" Multiplicity="1" />
-          <End Role="Places" Type="Self.Places" Multiplicity="*" />
+        <Association Name="FK_UserTicket_Timetable">
+          <End Role="Timetable" Type="Self.Timetable" Multiplicity="1" />
+          <End Role="UserTicket" Type="Self.UserTicket" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Hall">
+            <Principal Role="Timetable">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="Places">
-              <PropertyRef Name="IDHall" />
+            <Dependent Role="UserTicket">
+              <PropertyRef Name="IDTimetable" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_Users_Roles">
-          <End Role="Roles" Type="Self.Roles" Multiplicity="1" />
-          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+        <Association Name="FK_UserTicket_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="UserTicket" Type="Self.UserTicket" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Roles">
+            <Principal Role="Users">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="Users">
-              <PropertyRef Name="IDRole" />
+            <Dependent Role="UserTicket">
+              <PropertyRef Name="IDUser" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
@@ -174,12 +175,12 @@
           <EntitySet Name="Films" EntityType="Self.Films" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="FilmTimetable" EntityType="Self.FilmTimetable" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Hall" EntityType="Self.Hall" Schema="dbo" store:Type="Tables" />
-          <EntitySet Name="HallTimetable" EntityType="Self.HallTimetable" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Places" EntityType="Self.Places" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Roles" EntityType="Self.Roles" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Timetable" EntityType="Self.Timetable" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="UserTicket" EntityType="Self.UserTicket" Schema="dbo" store:Type="Tables" />
           <AssociationSet Name="FK_FilmTimetable_Films" Association="Self.FK_FilmTimetable_Films">
             <End Role="Films" EntitySet="Films" />
             <End Role="FilmTimetable" EntitySet="FilmTimetable" />
@@ -188,25 +189,25 @@
             <End Role="Timetable" EntitySet="Timetable" />
             <End Role="FilmTimetable" EntitySet="FilmTimetable" />
           </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Hall" Association="Self.FK_HallTimetable_Hall">
+          <AssociationSet Name="FK_Places_Hall" Association="Self.FK_Places_Hall">
             <End Role="Hall" EntitySet="Hall" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
+            <End Role="Places" EntitySet="Places" />
           </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Timetable" Association="Self.FK_HallTimetable_Timetable">
+          <AssociationSet Name="FK_Timetable_Hall" Association="Self.FK_Timetable_Hall">
+            <End Role="Hall" EntitySet="Hall" />
             <End Role="Timetable" EntitySet="Timetable" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
           </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Users" Association="Self.FK_HallTimetable_Users">
+          <AssociationSet Name="FK_Users_Roles" Association="Self.FK_Users_Roles">
+            <End Role="Roles" EntitySet="Roles" />
             <End Role="Users" EntitySet="Users" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
           </AssociationSet>
-          <AssociationSet Name="FK_Places_Hall" Association="Self.FK_Places_Hall">
-            <End Role="Hall" EntitySet="Hall" />
-            <End Role="Places" EntitySet="Places" />
+          <AssociationSet Name="FK_UserTicket_Timetable" Association="Self.FK_UserTicket_Timetable">
+            <End Role="Timetable" EntitySet="Timetable" />
+            <End Role="UserTicket" EntitySet="UserTicket" />
           </AssociationSet>
-          <AssociationSet Name="FK_Users_Roles" Association="Self.FK_Users_Roles">
-            <End Role="Roles" EntitySet="Roles" />
+          <AssociationSet Name="FK_UserTicket_Users" Association="Self.FK_UserTicket_Users">
             <End Role="Users" EntitySet="Users" />
+            <End Role="UserTicket" EntitySet="UserTicket" />
           </AssociationSet>
         </EntityContainer>
       </Schema>
@@ -242,21 +243,8 @@
           <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Number" Type="Int32" Nullable="false" />
           <Property Name="CountOfSeats" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="HallTimetable" Relationship="Self.FK_HallTimetable_Hall" FromRole="Hall" ToRole="HallTimetable" />
           <NavigationProperty Name="Places" Relationship="Self.FK_Places_Hall" FromRole="Hall" ToRole="Places" />
-        </EntityType>
-        <EntityType Name="HallTimetable">
-          <Key>
-            <PropertyRef Name="ID" />
-          </Key>
-          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="IDHall" Type="Int32" Nullable="false" />
-          <Property Name="IDTimetable" Type="Int32" Nullable="false" />
-          <Property Name="IDPlace" Type="Int32" Nullable="false" />
-          <Property Name="IDUser" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Hall" Relationship="Self.FK_HallTimetable_Hall" FromRole="HallTimetable" ToRole="Hall" />
-          <NavigationProperty Name="Timetable" Relationship="Self.FK_HallTimetable_Timetable" FromRole="HallTimetable" ToRole="Timetable" />
-          <NavigationProperty Name="Users" Relationship="Self.FK_HallTimetable_Users" FromRole="HallTimetable" ToRole="Users" />
+          <NavigationProperty Name="Timetable" Relationship="Self.FK_Timetable_Hall" FromRole="Hall" ToRole="Timetable" />
         </EntityType>
         <EntityType Name="Places">
           <Key>
@@ -290,9 +278,12 @@
             <PropertyRef Name="ID" />
           </Key>
           <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="Time" Type="DateTime" Nullable="false" Precision="3" />
+          <Property Name="Time" Type="Time" Nullable="false" Precision="7" />
+          <Property Name="Date" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="IDHall" Type="Int32" Nullable="false" />
           <NavigationProperty Name="FilmTimetable" Relationship="Self.FK_FilmTimetable_Timetable" FromRole="Timetable" ToRole="FilmTimetable" />
-          <NavigationProperty Name="HallTimetable" Relationship="Self.FK_HallTimetable_Timetable" FromRole="Timetable" ToRole="HallTimetable" />
+          <NavigationProperty Name="Hall" Relationship="Self.FK_Timetable_Hall" FromRole="Timetable" ToRole="Hall" />
+          <NavigationProperty Name="UserTicket" Relationship="Self.FK_UserTicket_Timetable" FromRole="Timetable" ToRole="UserTicket" />
         </EntityType>
         <EntityType Name="Users">
           <Key>
@@ -306,8 +297,19 @@
           <Property Name="MiddleName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
           <Property Name="Email" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
           <Property Name="IDRole" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="HallTimetable" Relationship="Self.FK_HallTimetable_Users" FromRole="Users" ToRole="HallTimetable" />
           <NavigationProperty Name="Roles" Relationship="Self.FK_Users_Roles" FromRole="Users" ToRole="Roles" />
+          <NavigationProperty Name="UserTicket" Relationship="Self.FK_UserTicket_Users" FromRole="Users" ToRole="UserTicket" />
+        </EntityType>
+        <EntityType Name="UserTicket">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="IDTimetable" Type="Int32" Nullable="false" />
+          <Property Name="IDUser" Type="Int32" Nullable="false" />
+          <Property Name="IDPlace" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Timetable" Relationship="Self.FK_UserTicket_Timetable" FromRole="UserTicket" ToRole="Timetable" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_UserTicket_Users" FromRole="UserTicket" ToRole="Users" />
         </EntityType>
         <Association Name="FK_FilmTimetable_Films">
           <End Role="Films" Type="Self.Films" Multiplicity="1" />
@@ -333,63 +335,63 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Hall">
+        <Association Name="FK_Places_Hall">
           <End Role="Hall" Type="Self.Hall" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+          <End Role="Places" Type="Self.Places" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Hall">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
+            <Dependent Role="Places">
               <PropertyRef Name="IDHall" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_Places_Hall">
+        <Association Name="FK_Timetable_Hall">
           <End Role="Hall" Type="Self.Hall" Multiplicity="1" />
-          <End Role="Places" Type="Self.Places" Multiplicity="*" />
+          <End Role="Timetable" Type="Self.Timetable" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Hall">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="Places">
+            <Dependent Role="Timetable">
               <PropertyRef Name="IDHall" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Timetable">
-          <End Role="Timetable" Type="Self.Timetable" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+        <Association Name="FK_Users_Roles">
+          <End Role="Roles" Type="Self.Roles" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Timetable">
+            <Principal Role="Roles">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
-              <PropertyRef Name="IDTimetable" />
+            <Dependent Role="Users">
+              <PropertyRef Name="IDRole" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_HallTimetable_Users">
-          <End Role="Users" Type="Self.Users" Multiplicity="1" />
-          <End Role="HallTimetable" Type="Self.HallTimetable" Multiplicity="*" />
+        <Association Name="FK_UserTicket_Timetable">
+          <End Role="Timetable" Type="Self.Timetable" Multiplicity="1" />
+          <End Role="UserTicket" Type="Self.UserTicket" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Users">
+            <Principal Role="Timetable">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="HallTimetable">
-              <PropertyRef Name="IDUser" />
+            <Dependent Role="UserTicket">
+              <PropertyRef Name="IDTimetable" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <Association Name="FK_Users_Roles">
-          <End Role="Roles" Type="Self.Roles" Multiplicity="1" />
-          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+        <Association Name="FK_UserTicket_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="UserTicket" Type="Self.UserTicket" Multiplicity="*" />
           <ReferentialConstraint>
-            <Principal Role="Roles">
+            <Principal Role="Users">
               <PropertyRef Name="ID" />
             </Principal>
-            <Dependent Role="Users">
-              <PropertyRef Name="IDRole" />
+            <Dependent Role="UserTicket">
+              <PropertyRef Name="IDUser" />
             </Dependent>
           </ReferentialConstraint>
         </Association>
@@ -397,12 +399,12 @@
           <EntitySet Name="Films" EntityType="Self.Films" />
           <EntitySet Name="FilmTimetable" EntityType="Self.FilmTimetable" />
           <EntitySet Name="Hall" EntityType="Self.Hall" />
-          <EntitySet Name="HallTimetable" EntityType="Self.HallTimetable" />
           <EntitySet Name="Places" EntityType="Self.Places" />
           <EntitySet Name="Roles" EntityType="Self.Roles" />
           <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" />
           <EntitySet Name="Timetable" EntityType="Self.Timetable" />
           <EntitySet Name="Users" EntityType="Self.Users" />
+          <EntitySet Name="UserTicket" EntityType="Self.UserTicket" />
           <AssociationSet Name="FK_FilmTimetable_Films" Association="Self.FK_FilmTimetable_Films">
             <End Role="Films" EntitySet="Films" />
             <End Role="FilmTimetable" EntitySet="FilmTimetable" />
@@ -411,26 +413,26 @@
             <End Role="Timetable" EntitySet="Timetable" />
             <End Role="FilmTimetable" EntitySet="FilmTimetable" />
           </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Hall" Association="Self.FK_HallTimetable_Hall">
-            <End Role="Hall" EntitySet="Hall" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
-          </AssociationSet>
           <AssociationSet Name="FK_Places_Hall" Association="Self.FK_Places_Hall">
             <End Role="Hall" EntitySet="Hall" />
             <End Role="Places" EntitySet="Places" />
           </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Timetable" Association="Self.FK_HallTimetable_Timetable">
+          <AssociationSet Name="FK_Timetable_Hall" Association="Self.FK_Timetable_Hall">
+            <End Role="Hall" EntitySet="Hall" />
             <End Role="Timetable" EntitySet="Timetable" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
-          </AssociationSet>
-          <AssociationSet Name="FK_HallTimetable_Users" Association="Self.FK_HallTimetable_Users">
-            <End Role="Users" EntitySet="Users" />
-            <End Role="HallTimetable" EntitySet="HallTimetable" />
           </AssociationSet>
           <AssociationSet Name="FK_Users_Roles" Association="Self.FK_Users_Roles">
             <End Role="Roles" EntitySet="Roles" />
             <End Role="Users" EntitySet="Users" />
           </AssociationSet>
+          <AssociationSet Name="FK_UserTicket_Timetable" Association="Self.FK_UserTicket_Timetable">
+            <End Role="Timetable" EntitySet="Timetable" />
+            <End Role="UserTicket" EntitySet="UserTicket" />
+          </AssociationSet>
+          <AssociationSet Name="FK_UserTicket_Users" Association="Self.FK_UserTicket_Users">
+            <End Role="Users" EntitySet="Users" />
+            <End Role="UserTicket" EntitySet="UserTicket" />
+          </AssociationSet>
         </EntityContainer>
       </Schema>
     </edmx:ConceptualModels>
@@ -467,17 +469,6 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
-          <EntitySetMapping Name="HallTimetable">
-            <EntityTypeMapping TypeName="KinomaksModel.HallTimetable">
-              <MappingFragment StoreEntitySet="HallTimetable">
-                <ScalarProperty Name="ID" ColumnName="ID" />
-                <ScalarProperty Name="IDHall" ColumnName="IDHall" />
-                <ScalarProperty Name="IDTimetable" ColumnName="IDTimetable" />
-                <ScalarProperty Name="IDPlace" ColumnName="IDPlace" />
-                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
           <EntitySetMapping Name="Places">
             <EntityTypeMapping TypeName="KinomaksModel.Places">
               <MappingFragment StoreEntitySet="Places">
@@ -511,6 +502,8 @@
               <MappingFragment StoreEntitySet="Timetable">
                 <ScalarProperty Name="ID" ColumnName="ID" />
                 <ScalarProperty Name="Time" ColumnName="Time" />
+                <ScalarProperty Name="Date" ColumnName="Date" />
+                <ScalarProperty Name="IDHall" ColumnName="IDHall" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
@@ -528,6 +521,16 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <EntitySetMapping Name="UserTicket">
+            <EntityTypeMapping TypeName="KinomaksModel.UserTicket">
+              <MappingFragment StoreEntitySet="UserTicket">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="IDTimetable" ColumnName="IDTimetable" />
+                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
+                <ScalarProperty Name="IDPlace" ColumnName="IDPlace" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
         </EntityContainerMapping>
       </Mapping>
     </edmx:Mappings>

+ 13 - 13
Kinomaks/KinomaksDB.edmx.diagram

@@ -4,23 +4,23 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="94c4894b896e40b88b092d51e142a2f1" Name="Diagram1">
-        <EntityTypeShape EntityType="KinomaksModel.Films" Width="1.5" PointX="0.75" PointY="15.125" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.FilmTimetable" Width="1.5" PointX="3" PointY="0.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.Hall" Width="1.5" PointX="0.75" PointY="4.625" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.HallTimetable" Width="1.5" PointX="3" PointY="4.25" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.Places" Width="1.5" PointX="3" PointY="8" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.Roles" Width="1.5" PointX="1.5" PointY="12" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.sysdiagrams" Width="1.5" PointX="5.75" PointY="2.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.Timetable" Width="1.5" PointX="0.75" PointY="1.875" IsExpanded="true" />
-        <EntityTypeShape EntityType="KinomaksModel.Users" Width="1.5" PointX="0.75" PointY="7.375" IsExpanded="true" />
+      <Diagram DiagramId="afdbe7b076f74279979da4c86ececcda" Name="Diagram1">
+        <EntityTypeShape EntityType="KinomaksModel.Films" Width="1.5" PointX="3" PointY="11.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.FilmTimetable" Width="1.5" PointX="5.25" PointY="7.25" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.Hall" Width="1.5" PointX="0.75" PointY="6" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.Places" Width="1.5" PointX="3" PointY="4.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.Roles" Width="1.5" PointX="0.75" PointY="3.625" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.sysdiagrams" Width="1.5" PointX="7.75" PointY="2.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.Timetable" Width="1.5" PointX="3" PointY="7" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.Users" Width="1.5" PointX="3" PointY="0.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="KinomaksModel.UserTicket" Width="1.5" PointX="5.25" PointY="4.125" IsExpanded="true" />
         <AssociationConnector Association="KinomaksModel.FK_FilmTimetable_Films" ManuallyRouted="false" />
         <AssociationConnector Association="KinomaksModel.FK_FilmTimetable_Timetable" ManuallyRouted="false" />
-        <AssociationConnector Association="KinomaksModel.FK_HallTimetable_Hall" ManuallyRouted="false" />
         <AssociationConnector Association="KinomaksModel.FK_Places_Hall" ManuallyRouted="false" />
-        <AssociationConnector Association="KinomaksModel.FK_HallTimetable_Timetable" ManuallyRouted="false" />
-        <AssociationConnector Association="KinomaksModel.FK_HallTimetable_Users" ManuallyRouted="false" />
+        <AssociationConnector Association="KinomaksModel.FK_Timetable_Hall" ManuallyRouted="false" />
         <AssociationConnector Association="KinomaksModel.FK_Users_Roles" ManuallyRouted="false" />
+        <AssociationConnector Association="KinomaksModel.FK_UserTicket_Timetable" ManuallyRouted="false" />
+        <AssociationConnector Association="KinomaksModel.FK_UserTicket_Users" ManuallyRouted="false" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 2 - 1
Kinomaks/ListWindows/FilmsListWindow.xaml

@@ -17,8 +17,9 @@
             </DataGrid.ItemContainerStyle>
             <DataGrid.Columns>
                 <DataGridTextColumn Binding="{Binding Name}" Header="Название фильма" Width="300" IsReadOnly="True"/>
+                <DataGridTextColumn Binding="{Binding Price}" Header="Цена" Width="100" IsReadOnly="True"/>
                 <DataGridTextColumn Binding="{Binding Description}" Header="Описание" Width="600" IsReadOnly="True"/>
-                <DataGridTemplateColumn Header="Лого" Width="400">
+                <DataGridTemplateColumn Header="Лого" Width="300">
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                             <Image Source="{Binding Logo}" Height="150"/>

+ 1 - 1
Kinomaks/ListWindows/FilmsListWindow.xaml.cs

@@ -40,7 +40,7 @@ namespace Kinomaks.ListWindows
         {
             if (Search.Text != "" && Search.Text != "Поиск")
             {
-                FilmsList.ItemsSource = Connection.db.Films.Where(item => (item.Title + " " + item.Descripton).Contains(Search.Text)).ToList();
+                FilmsList.ItemsSource = Connection.db.Films.Where(item => (item.Title + " " + item.Descripton + " " + item.Price).Contains(Search.Text)).ToList();
             }
             else if (Search.Text == "" || Search.Text == "Поиск")
             {

+ 3 - 2
Kinomaks/MainWindow.xaml.cs

@@ -1,6 +1,7 @@
 using System.Windows;
 using Kinomaks.ListWindows;
 using Kinomaks.AddWindows;
+using Kinomaks.ElementsWindows;
 
 namespace Kinomaks
 {
@@ -52,8 +53,8 @@ namespace Kinomaks
 
         private void TimetableListClick(object sender, RoutedEventArgs e)
         {
-            //TimetableListWindow timetableListWindow = new TimetableListWindow();
-            //timetableListWindow.Show();
+            TimetableWindow timetableWindow = new TimetableWindow();
+            timetableWindow.Show();
             this.Close();
         }
         #endregion

+ 13 - 0
Kinomaks/Style.xaml

@@ -15,6 +15,19 @@
     </Style>
     <!--#endregion-->
 
+    <!--#region Оформление листбокса-->
+    <Style TargetType="ListBox">
+        <Setter Property="Background">
+            <Setter.Value>
+                <RadialGradientBrush MappingMode="RelativeToBoundingBox" GradientOrigin="0.9,0.2" Center="0.5,0.5" RadiusX="0.7" RadiusY="0.7">
+                    <GradientStop Color="#FF1B1B15" Offset="1"/>
+                    <GradientStop Color="#FF142F2C"/>
+                </RadialGradientBrush>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <!--#endregion-->
+    
     <!--#region Стиль кнопки-->
     <Style TargetType="Button">
 

+ 6 - 3
Kinomaks/Timetable.cs

@@ -18,15 +18,18 @@ namespace Kinomaks
         public Timetable()
         {
             this.FilmTimetable = new HashSet<FilmTimetable>();
-            this.HallTimetable = new HashSet<HallTimetable>();
+            this.UserTicket = new HashSet<UserTicket>();
         }
     
         public int ID { get; set; }
-        public System.DateTime Time { get; set; }
+        public System.TimeSpan Time { get; set; }
+        public System.DateTime Date { get; set; }
+        public int IDHall { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<FilmTimetable> FilmTimetable { get; set; }
+        public virtual Hall Hall { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<HallTimetable> HallTimetable { get; set; }
+        public virtual ICollection<UserTicket> UserTicket { get; set; }
     }
 }

+ 2 - 4
Kinomaks/HallTimetable.cs

@@ -12,15 +12,13 @@ namespace Kinomaks
     using System;
     using System.Collections.Generic;
     
-    public partial class HallTimetable
+    public partial class UserTicket
     {
         public int ID { get; set; }
-        public int IDHall { get; set; }
         public int IDTimetable { get; set; }
-        public int IDPlace { get; set; }
         public int IDUser { get; set; }
+        public int IDPlace { get; set; }
     
-        public virtual Hall Hall { get; set; }
         public virtual Timetable Timetable { get; set; }
         public virtual Users Users { get; set; }
     }

+ 3 - 3
Kinomaks/Users.cs

@@ -17,7 +17,7 @@ namespace Kinomaks
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public Users()
         {
-            this.HallTimetable = new HashSet<HallTimetable>();
+            this.UserTicket = new HashSet<UserTicket>();
         }
     
         public int ID { get; set; }
@@ -29,8 +29,8 @@ namespace Kinomaks
         public string Email { get; set; }
         public int IDRole { get; set; }
     
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<HallTimetable> HallTimetable { get; set; }
         public virtual Roles Roles { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<UserTicket> UserTicket { get; set; }
     }
 }

+ 11 - 0
Kinomaks/packages.config

@@ -2,4 +2,15 @@
 <packages>
   <package id="EntityFramework" version="6.2.0" targetFramework="net472" />
   <package id="EntityFramework.ru" version="6.2.0" targetFramework="net472" />
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net472" />
+  <package id="Microsoft.OData.Edm" version="7.12.3" targetFramework="net472" />
+  <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net472" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
+  <package id="System.Text.Encodings.Web" version="4.7.2" targetFramework="net472" />
+  <package id="System.Text.Json" version="4.6.0" targetFramework="net472" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net472" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
 </packages>