3 Achegas 1c7752aefd ... 469b6f9064

Autor SHA1 Mensaxe Data
  Imagara 469b6f9064 ./ %!s(int64=2) %!d(string=hai) anos
  Imagara 2caff9f073 ./ %!s(int64=2) %!d(string=hai) anos
  Imagara ef469c4623 . %!s(int64=2) %!d(string=hai) anos

+ 1 - 0
RaspisKusach/Carriages.cs

@@ -23,6 +23,7 @@ namespace RaspisKusach
         public int IdCarriage { get; set; }
         public int IdTrain { get; set; }
         public int Places { get; set; }
+        public string Category { get; set; }
     
         public virtual Trains Trains { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]

+ 6 - 3
RaspisKusach/EDM.edmx

@@ -12,6 +12,7 @@
           <Property Name="IdCarriage" Type="int" Nullable="false" />
           <Property Name="IdTrain" Type="int" Nullable="false" />
           <Property Name="Places" Type="int" Nullable="false" />
+          <Property Name="Category" Type="nvarchar" MaxLength="50" Nullable="false" />
         </EntityType>
         <EntityType Name="Routes">
           <Key>
@@ -57,7 +58,6 @@
           <Property Name="IdTrip" Type="int" Nullable="false" />
           <Property Name="IdCarriage" Type="int" Nullable="false" />
           <Property Name="PlaceNumber" Type="int" Nullable="false" />
-          <Property Name="Category" Type="int" Nullable="false" />
           <Property Name="BuyDate" Type="datetime" Nullable="false" />
         </EntityType>
         <EntityType Name="Trains">
@@ -84,6 +84,7 @@
           <Property Name="IdUser" Type="int" Nullable="false" />
           <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
+          <Property Name="Email" Type="nvarchar" MaxLength="50" Nullable="false" />
           <Property Name="Passport" Type="nvarchar" MaxLength="10" />
           <Property Name="Surname" Type="nvarchar" MaxLength="50" />
           <Property Name="Name" Type="nvarchar" MaxLength="50" />
@@ -285,6 +286,7 @@
           <Property Name="Places" Type="Int32" Nullable="false" />
           <NavigationProperty Name="Trains" Relationship="RouteScheduleDataBaseModel.FK_Carriages_Trains" FromRole="Carriages" ToRole="Trains" />
           <NavigationProperty Name="Tickets" Relationship="RouteScheduleDataBaseModel.FK_Tickets_Carriages" FromRole="Carriages" ToRole="Tickets" />
+          <Property Name="Category" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
         </EntityType>
         <EntityType Name="Routes">
           <Key>
@@ -335,7 +337,6 @@
           <Property Name="IdTrip" Type="Int32" Nullable="false" />
           <Property Name="IdCarriage" Type="Int32" Nullable="false" />
           <Property Name="PlaceNumber" Type="Int32" Nullable="false" />
-          <Property Name="Category" Type="Int32" Nullable="false" />
           <Property Name="BuyDate" Type="DateTime" Nullable="false" Precision="3" />
           <NavigationProperty Name="Carriages" Relationship="RouteScheduleDataBaseModel.FK_Tickets_Carriages" FromRole="Tickets" ToRole="Carriages" />
           <NavigationProperty Name="Trips" Relationship="RouteScheduleDataBaseModel.FK_Tickets_Trips" FromRole="Tickets" ToRole="Trips" />
@@ -376,6 +377,7 @@
           <Property Name="Patronymic" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
           <Property Name="Permissions" Type="Int32" Nullable="false" />
           <NavigationProperty Name="Tickets" Relationship="RouteScheduleDataBaseModel.FK_Tickets_Users" FromRole="Users" ToRole="Tickets" />
+          <Property Name="Email" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
         </EntityType>
         <Association Name="FK_Carriages_Trains">
           <End Type="RouteScheduleDataBaseModel.Trains" Role="Trains" Multiplicity="1" />
@@ -482,6 +484,7 @@
           <EntitySetMapping Name="Carriages">
             <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Carriages">
               <MappingFragment StoreEntitySet="Carriages">
+                <ScalarProperty Name="Category" ColumnName="Category" />
                 <ScalarProperty Name="Places" ColumnName="Places" />
                 <ScalarProperty Name="IdTrain" ColumnName="IdTrain" />
                 <ScalarProperty Name="IdCarriage" ColumnName="IdCarriage" />
@@ -531,7 +534,6 @@
             <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Tickets">
               <MappingFragment StoreEntitySet="Tickets">
                 <ScalarProperty Name="BuyDate" ColumnName="BuyDate" />
-                <ScalarProperty Name="Category" ColumnName="Category" />
                 <ScalarProperty Name="PlaceNumber" ColumnName="PlaceNumber" />
                 <ScalarProperty Name="IdCarriage" ColumnName="IdCarriage" />
                 <ScalarProperty Name="IdTrip" ColumnName="IdTrip" />
@@ -562,6 +564,7 @@
           <EntitySetMapping Name="Users">
             <EntityTypeMapping TypeName="RouteScheduleDataBaseModel.Users">
               <MappingFragment StoreEntitySet="Users">
+                <ScalarProperty Name="Email" ColumnName="Email" />
                 <ScalarProperty Name="Permissions" ColumnName="Permissions" />
                 <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
                 <ScalarProperty Name="Name" ColumnName="Name" />

+ 1 - 1
RaspisKusach/EDM.edmx.diagram

@@ -4,7 +4,7 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="cbfc4ddba6b5479eb5c52b1c4156acc9" Name="Diagram1">
+      <Diagram DiagramId="cbfc4ddba6b5479eb5c52b1c4156acc9" Name="Diagram1" ZoomLevel="98">
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Carriages" Width="1.5" PointX="12" PointY="7.375" />
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.Routes" Width="1.5" PointX="14.625" PointY="4.125" />
         <EntityTypeShape EntityType="RouteScheduleDataBaseModel.RoutesStations" Width="1.5" PointX="14.625" PointY="1" />

+ 2 - 4
RaspisKusach/Encrypt.cs

@@ -1,15 +1,13 @@
 using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
 namespace RaspisKusach
 {
     public class Encrypt
     {
         public static string GetHash(string password)
         {
-            using (var hash = SHA1.Create())
+            using (var hash = System.Security.Cryptography.SHA1.Create())
             {
-                return string.Concat(hash.ComputeHash(Encoding.UTF8.GetBytes(password)).Select(x => x.ToString("X2")));
+                return string.Concat(hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(password)).Select(x => x.ToString("X2")));
             }
         }
     }

+ 19 - 15
RaspisKusach/ErrorWindow.xaml

@@ -6,30 +6,34 @@
         xmlns:local="clr-namespace:RaspisKusach"
         mc:Ignorable="d"
         Title="ErrorWindow" 
-        MinHeight="120" 
-        Height="120"
-        Width="300" 
+        Height="100"
+        Width="600"
         WindowStartupLocation="CenterScreen" 
         WindowStyle="None" 
         ResizeMode="NoResize">
     <Border Background="{StaticResource ItemColor}"
-            MouseDown="Border_MouseDown">
-        <StackPanel>
+            MouseDown="Border_MouseDown"
+            BorderBrush="Black"
+            BorderThickness="1.5">
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="auto"/>
+                <RowDefinition Height="auto"/>
+            </Grid.RowDefinitions>
             <TextBlock Name="ErrorLabel" 
-               Text="Ошибка." 
-               TextWrapping="Wrap"
-               HorizontalAlignment="Center" 
-               Margin="19,10,19,0" 
-               VerticalAlignment="Top" 
-               Width="262">
+                       Text="Ошибка." 
+                       TextWrapping="Wrap"
+                       HorizontalAlignment="Center"
+                       VerticalAlignment="Center" 
+                       Margin="10,5,10,5">
             </TextBlock>
-            <Button Content="Закрыть" 
-                VerticalAlignment="Bottom" 
+            <Button Grid.Row="1"
+                Content="Закрыть" 
+                VerticalAlignment="Center" 
                 HorizontalAlignment="Center" 
                 Height="30" 
                 Width="130" 
-                Margin="0,0,0,15" 
                 Click="BackClick"/>
-        </StackPanel>
+        </Grid>
     </Border>
 </Window>

+ 1 - 0
RaspisKusach/ErrorWindow.xaml.cs

@@ -8,6 +8,7 @@ namespace RaspisKusach
         {
             InitializeComponent();
             ErrorLabel.Text = error;
+            this.SizeToContent = SizeToContent.Height;
         }
         private void BackClick(object sender, RoutedEventArgs e)
         {

+ 14 - 16
RaspisKusach/Functions.cs

@@ -12,7 +12,7 @@ namespace RaspisKusach
         // Получение направления по маршруту или поездке
         public static string GetRouteDirection(Trips trip)
         {
-            return GetDepartureStationLocation(trip) + " - " + GetArrivalStationLocation(trip);
+            return GetDepartureStationLocation(trip.Routes) + " - " + GetArrivalStationLocation(trip.Routes);
         }
         // Получение времени прибытия поезда на станцию
         public static DateTime GetArrivalTime(Stations station, Trips trip)
@@ -40,23 +40,20 @@ namespace RaspisKusach
             return date;
         }
         // Получение станции отправления (первой)
-        public static string GetDepartureStationLocation(Trips trip)
-        {
-            return cnt.db.RoutesStations.Where(item => item.IdRoute == trip.Routes.IdRoute).OrderByDescending(item => item.IdRouteStation).Select(item => item.Stations.Location).FirstOrDefault();
-        }
         public static string GetDepartureStationLocation(Routes route)
         {
             return cnt.db.RoutesStations.Where(item => item.IdRoute == route.IdRoute).OrderByDescending(item => item.IdRouteStation).Select(item => item.Stations.Location).FirstOrDefault();
         }
         // Получение станции прибытия (последней)
-        public static string GetArrivalStationLocation(Trips trip)
-        {
-            return cnt.db.RoutesStations.Where(item => item.IdRoute == trip.Routes.IdRoute).Select(item => item.Stations.Location).FirstOrDefault();
-        }
         public static string GetArrivalStationLocation(Routes route)
         {
             return cnt.db.RoutesStations.Where(item => item.IdRoute == route.IdRoute).Select(item => item.Stations.Location).FirstOrDefault();
         }
+        public static int GetAvailableSeats(Carriages carriage)
+        {
+            //temp
+            return 0;
+        }
 
         // Валидация номера телефона
         public static bool IsPhoneNumberCorrect(string phoneNumber)
@@ -69,11 +66,16 @@ namespace RaspisKusach
             return true;
         }
 
-        // Валидация электронной почты
+        // Проверка электронной почты на правильность ввода
         public static bool IsEmailCorrect(string email)
         {
             return Regex.IsMatch(email, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
         }
+        // Проверка на уникальность электронной почты
+        public static bool IsEmailAlreadyTaken(string Email)
+        {
+            return cnt.db.Users.Select(item => item.Email).Contains(Email);
+        }
         // Валидация дня рождения
         public static bool IsDateOfBirthdayCorrect(DateTime Date)
         {
@@ -87,7 +89,7 @@ namespace RaspisKusach
         // Валидация логина и пароля
         public static bool IsLogEqualPass(string login, string password)
         {
-            return login == password; // RE
+            return login != password;
         }
         // Валидация логина и пароля
         public static bool IsLengthCorrect(string str)
@@ -104,11 +106,7 @@ namespace RaspisKusach
         {
             return cnt.db.Users.Select(item => item.Login).Contains(login);
         }
-        //// Проверка на уникальность электронной почты
-        //public static bool IsEmailAlreadyTaken(string Email)
-        //{
-        //    return cnt.db.Users.Select(item => item.).Contains(Email);
-        //}
+
         //// Проверка на уникальность электронной почты
         //public static bool IsPhoneNumberAlreadyTaken(string Phone)
         //{

+ 1 - 1
RaspisKusach/Pages/MenuPage.xaml

@@ -9,7 +9,7 @@
       d:DesignWidth="792"
       Title="Меню">
     
-    <Grid>
+    <Grid Background="White">
         <Grid.RowDefinitions>
             <RowDefinition/>
             <RowDefinition Height="50"/>

+ 57 - 18
RaspisKusach/Pages/RegisterPage.xaml

@@ -31,41 +31,80 @@
             <Grid Style="{x:Null}" 
                   Background="{x:Null}">
                 <Grid Background="#a0a0a0"
-                      Opacity="0.85"/>
-                <StackPanel Orientation="Vertical"
-                        Margin="10"
-                        VerticalAlignment="Center"
-                        HorizontalAlignment="Center">
-                    <Label Content="Логин:" 
-                       HorizontalContentAlignment="Left"
-                       Height="40" 
-                       Width="240"
-                       FontSize="20"/>
-                    <TextBox Name="LogBox" 
+                      Opacity="0.85">
+                </Grid>
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="108*"/>
+                        <RowDefinition Height="37*"/>
+                    </Grid.RowDefinitions>
+                    
+                    <StackPanel Name="RegA"
+                                Visibility="Visible"
+                                Orientation="Vertical"
+                                Margin="10"
+                                VerticalAlignment="Center"
+                                HorizontalAlignment="Center">
+                        <Label Content="Логин:" 
+                               HorizontalContentAlignment="Left"
+                               Height="40" 
+                               Width="240"
+                               FontSize="20"/>
+                        <TextBox Name="LogBox" 
                              TextWrapping="Wrap" 
                              Height="40" 
                              Width="240"
                              FontSize="20"/>
-                    <Label Content="Пароль:"
+                        <Label Content="Пароль:"
                            HorizontalContentAlignment="Left"
                            Height="40" 
                            Width="240"
                            FontSize="20"/>
-                    <PasswordBox Name="PassBox"
+                        <PasswordBox Name="PassBox"
                                  Height="40" 
                                  Width="240"
                                  FontSize="20"/>
+                    </StackPanel>
+
+                    <StackPanel Name="RegB"
+                                Visibility="Collapsed"
+                                Orientation="Vertical"
+                                Margin="10"
+                                VerticalAlignment="Center"
+                                HorizontalAlignment="Center">
+                        <Label Content="ФИО:" 
+                               HorizontalContentAlignment="Left"
+                               Height="40" 
+                               Width="240"
+                               FontSize="20"/>
+                        <TextBox Name="FIOBox" 
+                             TextWrapping="Wrap" 
+                             Height="40" 
+                             Width="240"
+                             FontSize="20"/>
+                        <Label Content="Электронная почта:"
+                           HorizontalContentAlignment="Left"
+                           Height="40" 
+                           Width="240"
+                           FontSize="20"/>
+                        <TextBox Name="EmailBox"
+                                 Height="40" 
+                                 Width="240"
+                                 FontSize="20"/>
+                    </StackPanel>
+                    
                     <StackPanel Orientation="Horizontal"
-                                Margin="0,20,0,0">
-                        <Button Name="BackButton" 
-                                Content="Назад"
+                                Grid.Row="1"
+                                VerticalAlignment="Center"
+                                HorizontalAlignment="Center">
+                        <Button Content="Назад"
                                 Height="40" 
                                 Width="150" 
                                 Margin="0,0,30,0"
                                 FontSize="20"
                                 Click="BackButton_Click"/>
                         <Button x:Name="RegisterButton" 
-                                Content="Регистрация"
+                                Content="Далее"
                                 Height="40" 
                                 Width="150"
                                 FontSize="20"
@@ -73,7 +112,7 @@
                                 Click="RegisterButton_Click">
                         </Button>
                     </StackPanel>
-                </StackPanel>
+                </Grid>
             </Grid>
         </Border>
     </Grid>

+ 56 - 3
RaspisKusach/Pages/RegisterPage.xaml.cs

@@ -20,6 +20,7 @@ namespace RaspisKusach.Pages
     /// </summary>
     public partial class RegisterPage : Page
     {
+        byte registerStage = 1;
         public RegisterPage()
         {
             InitializeComponent();
@@ -27,13 +28,65 @@ namespace RaspisKusach.Pages
 
         private void BackButton_Click(object sender, RoutedEventArgs e)
         {
-            NavigationService.Navigate(new Pages.LoginPage());
+            NavigationService.GoBack();
         }
 
         private void RegisterButton_Click(object sender, RoutedEventArgs e)
         {
-            MessageBox.Show("{Status here}");
-            NavigationService.Navigate(new Pages.LoginPage());
+            try
+            {
+                if (registerStage == 1)
+                {
+                    if (!Functions.IsLengthCorrect(LogBox.Text.Trim()))
+                        new ErrorWindow("Поле «Логин» должно содержать не менее 5 символов.").Show();
+                    else if (!Functions.IsLengthCorrect(PassBox.Password.Trim()))
+                        new ErrorWindow("Поле «Пароль» должно содержать не менее 5 символов.").Show();
+                    else if (!Functions.IsLogEqualPass(LogBox.Text, PassBox.Password))
+                        new ErrorWindow("Поля «Логин» и «Пароль» не должны быть равны.").Show();
+                    else if (Functions.IsLoginAlreadyTaken(LogBox.Text))
+                        new ErrorWindow("Данный логин уже занят").Show();
+                    else
+                    {
+                        RegA.Visibility = Visibility.Collapsed;
+                        RegB.Visibility = Visibility.Visible;
+                        registerStage = 2;
+                        RegisterButton.Content = "Регистрация";
+                    }
+                }
+                else
+                {
+                    if (!Functions.IsEmailCorrect(EmailBox.Text))
+                        new ErrorWindow("Email введен неверно.").Show();
+                    else if (Functions.IsEmailAlreadyTaken(EmailBox.Text))
+                        new ErrorWindow("Данный email уже используется.").Show();
+                    else
+                    {
+                        string[] fio = new string[3];
+                        fio = FIOBox.Text.Split(' ');
+                        Users newUser = new Users()
+                        {
+                            IdUser = cnt.db.Users.Select(p => p.IdUser).DefaultIfEmpty(0).Max() + 1,
+                            Login = LogBox.Text,
+                            Password = Encrypt.GetHash(PassBox.Password),
+                            Email = EmailBox.Text,
+                            Surname = fio[0],
+                            Name = fio[1],
+                            Patronymic = fio[2],
+                            Permissions = cnt.db.Users.Count() == 0 ? 1 : 0,
+                        };
+                        cnt.db.Users.Add(newUser);
+                        cnt.db.SaveChanges();
+                        new ErrorWindow("Успешная регистрация").ShowDialog();
+
+                        Session.User = cnt.db.Users.Max();
+                        NavigationService.Navigate(new ProfilePage());
+                    }
+                }
+            }
+            catch
+            {
+                new ErrorWindow("Ошибка.").ShowDialog();
+            }
         }
     }
 }

+ 32 - 21
RaspisKusach/Pages/SchedulePage.xaml

@@ -9,49 +9,60 @@
       d:DesignHeight="367" 
       d:DesignWidth="792"
       Title="Расписание">
-    
+
     <Page.Resources>
         <math:MathConverter x:Key="math"/>
     </Page.Resources>
     <Grid Background="White">
         <Grid.RowDefinitions>
-            <RowDefinition Height="40"/>
-            <RowDefinition Height="40"/>
-            <RowDefinition/>
+            <RowDefinition Height="80*"/>
+            <RowDefinition Height="287*"/>
         </Grid.RowDefinitions>
-        <Label Name="TimeNowLabel"
+        <Border 
+            Background="{StaticResource ItemColor}"
+            BorderBrush="{StaticResource Selection}"
+            BorderThickness="1.5"
+            CornerRadius="10"
+            Margin="5">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="*"/>
+                    <RowDefinition Height="*"/>
+                </Grid.RowDefinitions>
+                <Label Name="TimeNowLabel"
                FontSize="20"
                Content="Текущее время">
-        </Label>
-        <Grid Grid.Row="1">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="0.6*"/>
-                <ColumnDefinition/>
-                <ColumnDefinition/>
-                <ColumnDefinition/>
-            </Grid.ColumnDefinitions>
+                </Label>
+                <Grid Grid.Row="1">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="0.6*"/>
+                        <ColumnDefinition/>
+                        <ColumnDefinition/>
+                        <ColumnDefinition/>
+                    </Grid.ColumnDefinitions>
 
-            <Label Grid.Column="0"
+                    <Label Grid.Column="0"
                    FontSize="14"
                    Content="№Рейса"/>
-            <Label Grid.Column="1"
+                    <Label Grid.Column="1"
                    FontSize="14"
                    Content="Направление"/>
-            <Label Grid.Column="2"
+                    <Label Grid.Column="2"
                    FontSize="14"
                    Content="Время прибытия"/>
-            <Label Grid.Column="3"
+                    <Label Grid.Column="3"
                    FontSize="14"
                    Content="Время отправления"/>
-        </Grid>
+                </Grid>
+            </Grid>
+        </Border>
 
         <ListBox Name="TripsListBox"
-                 Grid.Row="2"
+                 Grid.Row="1"
                  Background="White"
                  BorderBrush="{x:Null}"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                  ScrollViewer.VerticalScrollBarVisibility="Hidden">
-            <ScrollBar></ScrollBar>
             <ListBox.ItemTemplate>
                 <DataTemplate>
                     <Border Width="{Binding Path=ActualWidth, Mode=OneWay, ElementName=TripsListBox, Converter={StaticResource math}, ConverterParameter=x-15}"
@@ -68,7 +79,7 @@
                                 <ColumnDefinition/>
                                 <ColumnDefinition/>
                             </Grid.ColumnDefinitions>
-                            
+
                             <Label Grid.Column="0"
                                    FontSize="14"
                                    Content="{Binding Trip.Routes.Name}"/>

+ 2 - 2
RaspisKusach/Pages/SearchForTicketsPage.xaml.cs

@@ -76,9 +76,9 @@ namespace RaspisKusach.Pages
                 if (((TripClass)ListBox.SelectedItem) != null)
                     NavigationService.Navigate(new TripInfoPage(((TripClass)ListBox.SelectedItem).trip));
             }
-            catch
+            catch (Exception ex)
             {
-                new ErrorWindow("Ошибка открытия окна.").ShowDialog();
+                new ErrorWindow("Ошибка открытия окна: " + ex.Message).ShowDialog();
             }
         }
 

+ 29 - 37
RaspisKusach/Pages/TripInfoPage.xaml

@@ -73,15 +73,15 @@
 
 
         <!--DOWN-->
-        <ListBox Name="ListBox"
+        <ListBox Name="CarriageListBox"
                  Grid.Row="1"
                  BorderBrush="{x:Null}"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled">
             temp
             <ListBox.ItemTemplate>
                 <DataTemplate>
-                    <Border Height="120"
-                            Width="{Binding Path=ActualWidth, Mode=OneWay, ElementName=ListBox, Converter={StaticResource math}, ConverterParameter=x-15}"
+                    <Border Height="90"
+                            Width="{Binding Path=ActualWidth, Mode=OneWay, ElementName=CarriageListBox, Converter={StaticResource math}, ConverterParameter=x-15}"
                             CornerRadius="10"
                             Background="{StaticResource ItemColor}"
                             Margin="0,2,0,2"
@@ -91,51 +91,43 @@
 
                         <Grid Margin="7">
                             <Grid.RowDefinitions>
-                                <RowDefinition Height="40"/>
+                                <RowDefinition Height="27"/>
                                 <RowDefinition/>
                             </Grid.RowDefinitions>
 
                             <!--UP-->
                             <StackPanel Orientation="Horizontal">
-                                <Image Width="35"
-                                       Height="35"
-                                       Margin="5"
+                                <Image Width="30"
+                                       Height="30"
                                        HorizontalAlignment="Left"
                                        Source="/RaspisKusach;component/Resources/Сarriage.png">
                                 </Image>
-                                <Label Content="Вагон #2"/>
+                                <Label Content="Вагон #"/>
+                                <Label Content="{Binding CarriageNum}"
+                                       Margin="-10,0,0,0"/>
                             </StackPanel>
 
                             <!--DOWN-->
-                            <Grid Grid.Row="1" Grid.Column="0"
-                                  Background="{x:Null}">
-                                <Grid Background="{x:Null}">
-                                    <Grid.ColumnDefinitions>
-                                        <ColumnDefinition/> 
-                                        <ColumnDefinition/>
-                                        <ColumnDefinition/>
-                                    </Grid.ColumnDefinitions>
-
-                                    <StackPanel>
-                                        <Label Content="{Binding stationDeparture}">
-                                        </Label>
-                                        <Label Content="{Binding timeDeparture}">
-                                        </Label>
-                                    </StackPanel>
-
-                                    <Label Content="{Binding timeBetween}" 
-                                           Grid.Column="1">
-                                    </Label>
-
-                                    <StackPanel Grid.Column="2">
-                                        <Label Content="{Binding stationArrival}">
-
-                                        </Label>
-                                        <Label Content="{Binding timeArrival}">
-
-                                        </Label>
-                                    </StackPanel>
-                                </Grid>
+                            <Grid Grid.Row="1">
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="*"/>
+                                    <ColumnDefinition Width="*"/>
+                                    <ColumnDefinition Width="*"/>
+                                </Grid.ColumnDefinitions>
+                                <StackPanel>
+                                    <Label Content="Свободно мест: "/>
+                                    <Label Content="10"/>
+                                </StackPanel>
+                                <StackPanel Grid.Column="1">
+                                    <Label Content="Класс: "/>
+                                    <Label Content="{Binding Carriage.Category}"/>
+                                </StackPanel>
+
+                                <Button Grid.Column="2"
+                                        Content="Купить"
+                                        Margin="6">
+                                    
+                                </Button>
                             </Grid>
                         </Grid>
                     </Border>

+ 31 - 2
RaspisKusach/Pages/TripInfoPage.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -17,15 +18,43 @@ namespace RaspisKusach.Pages
 {
     public partial class TripInfoPage : Page
     {
-        public TripInfoPage(Trips trip)
+        Trips trip;
+        public TripInfoPage(Trips _trip)
         {
             InitializeComponent();
+            trip = _trip;
+
             string stationsList = "";
+
             foreach (RoutesStations rs in cnt.db.RoutesStations.Where(item => item.IdRoute == trip.IdRoute))
-                stationsList += rs.Stations.Location == Functions.GetDepartureStationLocation(trip) ? rs.Stations.Name : $"{rs.Stations.Name} → ";
+                stationsList += rs.Stations.Location == Functions.GetDepartureStationLocation(trip.Routes) ? rs.Stations.Name : $"{rs.Stations.Name} → ";
 
             Direction.Content = stationsList;
 
+
+            CarriageListBox.Items.Clear();
+            UpdateCarriagesList();
+        }
+        private void UpdateCarriagesList()
+        {
+            List<CarriageClass> routeList = new List<CarriageClass>();
+            int carrNum = 2;
+            foreach (Carriages item in cnt.db.Carriages.Where(item => item.IdTrain == trip.IdTrain))
+            {
+                routeList.Add(new CarriageClass()
+                {
+                    Carriage = item,
+                    CarriageNum = carrNum
+                });
+                carrNum++;
+            }
+
+            CarriageListBox.ItemsSource = routeList;
+        }
+        public class CarriageClass
+        {
+            public Carriages Carriage { get; set; }
+            public int CarriageNum { get; set; }
         }
 
     }

+ 1 - 0
RaspisKusach/RaspisKusach.csproj

@@ -242,6 +242,7 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.cs</LastGenOutput>
     </Content>
+    <Resource Include="todo.txt" />
     <Resource Include="Resources\Сarriage.png" />
     <Resource Include="Resources\Train.png" />
     <Resource Include="Resources\Background.jpg" />

+ 2 - 0
RaspisKusach/Styles/Style.xaml

@@ -101,5 +101,7 @@
         </Setter>
         <Setter Property="Foreground" Value="{StaticResource TextColor}"/>
     </Style>
+    
+    
 
 </ResourceDictionary>

+ 0 - 1
RaspisKusach/Tickets.cs

@@ -19,7 +19,6 @@ namespace RaspisKusach
         public int IdTrip { get; set; }
         public int IdCarriage { get; set; }
         public int PlaceNumber { get; set; }
-        public int Category { get; set; }
         public System.DateTime BuyDate { get; set; }
     
         public virtual Carriages Carriages { get; set; }

+ 1 - 0
RaspisKusach/Users.cs

@@ -28,6 +28,7 @@ namespace RaspisKusach
         public string Name { get; set; }
         public string Patronymic { get; set; }
         public int Permissions { get; set; }
+        public string Email { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<Tickets> Tickets { get; set; }

+ 8 - 0
RaspisKusach/todo.txt

@@ -0,0 +1,8 @@
+✘Подредактировать регистрацию + вход
+✘Добавить проверку на фио
+✘Добавить авто форматирование фио
+✘Добавить возможность покупки билетов
+✘Добавить Админ меню(?)
+✘Сделать юнит тесты
+✘Получить 4/5 за защиту
+✓Пойти спать