Browse Source

библиотека для проверки полей, страницы некоторый - основной функционал пользователя "без прав" реализован

Smerdova Liza 7 months ago
parent
commit
966fbb641c

+ 48 - 0
LibraryRDK/InputValidation.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace LibraryRDK
+{
+    public class InputValidation
+    {
+        public static bool Pattern(string text)
+        {
+            string pattern = @"\b[0-2][0-9]:[0-5][0-9]-[0-2][0-9]:[0-5][0-9]\b";
+            Regex regex = new Regex(pattern);
+            if (regex.IsMatch(text))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        public static bool CheckAuthorization(string login, string password)
+        {
+            if (!string.IsNullOrWhiteSpace(login))
+            {
+                if (!string.IsNullOrEmpty(password))
+                {
+                    return true;
+                }
+                else
+                {
+                    MessageBox.Show("Заполните Пароль", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                    return false;
+                }
+            }
+            else
+            {
+                MessageBox.Show("Заполните Логин", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                return false;
+            }
+        }
+    }
+}

+ 50 - 0
LibraryRDK/LibraryRDK.csproj

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{6EA9FA25-969F-484B-BABC-2DE02E12D164}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>LibraryRDK</RootNamespace>
+    <AssemblyName>LibraryRDK</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="InputValidation.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 36 - 0
LibraryRDK/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные со сборкой.
+[assembly: AssemblyTitle("LibraryRDK")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LibraryRDK")]
+[assembly: AssemblyCopyright("Copyright ©  2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
+[assembly: ComVisible(false)]
+
+// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
+[assembly: Guid("6ea9fa25-969f-484b-babc-2de02e12d164")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+//      Основной номер версии
+//      Дополнительный номер версии
+//      Номер сборки
+//      Редакция
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию 
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 20 - 0
PDK_Concert/Classes/UserClass.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace PDK_Concert
+{
+    public partial class Users
+    {
+        public string FIO
+        {
+            get
+            {
+                return (string)(Surname + " " +Name.Substring(0,1)+". "+ Patronymic.Substring(0, 1)+".");
+            }
+        }
+    }
+}

+ 2 - 2
PDK_Concert/ModelBD.edmx

@@ -68,7 +68,7 @@
           <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
           <Property Name="IDSchedule" Type="int" Nullable="false" />
           <Property Name="IDUser" Type="int" Nullable="false" />
-          <Property Name="RehearsalTime" Type="nvarchar" MaxLength="5" Nullable="false" />
+          <Property Name="RehearsalTime" Type="nvarchar" MaxLength="11" Nullable="false" />
         </EntityType>
         <EntityType Name="Users">
           <Key>
@@ -340,7 +340,7 @@
           <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="IDSchedule" Type="Int32" Nullable="false" />
           <Property Name="IDUser" Type="Int32" Nullable="false" />
-          <Property Name="RehearsalTime" Type="String" Nullable="false" MaxLength="5" FixedLength="false" Unicode="true" />
+          <Property Name="RehearsalTime" Type="String" Nullable="false" MaxLength="11" FixedLength="false" Unicode="true" />
           <NavigationProperty Name="RehearsalDate" Relationship="sm_RDKModel.FK_RehearsalSchedule_RehearsalDate" FromRole="RehearsalSchedule" ToRole="RehearsalDate" />
           <NavigationProperty Name="Users" Relationship="sm_RDKModel.FK_RehearsalSchedule_Users" FromRole="RehearsalSchedule" ToRole="Users" />
         </EntityType>

+ 9 - 9
PDK_Concert/ModelBD.edmx.diagram

@@ -5,15 +5,15 @@
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
       <Diagram DiagramId="7cff3210b2dc40c680f2c4fd473a00ee" Name="Diagram1">
-        <EntityTypeShape EntityType="sm_RDKModel.Concert" Width="1.5" PointX="5.25" PointY="9.625" />
-        <EntityTypeShape EntityType="sm_RDKModel.ConcertProgram" Width="1.5" PointX="7.5" PointY="6.5" />
-        <EntityTypeShape EntityType="sm_RDKModel.Logined" Width="1.5" PointX="0.75" PointY="3.875" />
-        <EntityTypeShape EntityType="sm_RDKModel.Numbers" Width="1.5" PointX="5.25" PointY="6.5" />
-        <EntityTypeShape EntityType="sm_RDKModel.Post" Width="1.5" PointX="0.75" PointY="7.125" />
-        <EntityTypeShape EntityType="sm_RDKModel.Power" Width="1.5" PointX="0.75" PointY="0.75" />
-        <EntityTypeShape EntityType="sm_RDKModel.RehearsalDate" Width="1.5" PointX="3" PointY="8.875" />
-        <EntityTypeShape EntityType="sm_RDKModel.RehearsalSchedule" Width="1.5" PointX="5.25" PointY="3.625" />
-        <EntityTypeShape EntityType="sm_RDKModel.Users" Width="1.5" PointX="3" PointY="3" />
+        <EntityTypeShape EntityType="sm_RDKModel.Concert" Width="1.5" PointX="5.25" PointY="9.75" />
+        <EntityTypeShape EntityType="sm_RDKModel.ConcertProgram" Width="1.5" PointX="7.5" PointY="6.625" />
+        <EntityTypeShape EntityType="sm_RDKModel.Logined" Width="1.5" PointX="0.75" PointY="7.125" />
+        <EntityTypeShape EntityType="sm_RDKModel.Numbers" Width="1.5" PointX="5.25" PointY="6.625" />
+        <EntityTypeShape EntityType="sm_RDKModel.Post" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="sm_RDKModel.Power" Width="1.5" PointX="0.75" PointY="4" />
+        <EntityTypeShape EntityType="sm_RDKModel.RehearsalDate" Width="1.5" PointX="3" PointY="9" />
+        <EntityTypeShape EntityType="sm_RDKModel.RehearsalSchedule" Width="1.5" PointX="5.25" PointY="3.75" />
+        <EntityTypeShape EntityType="sm_RDKModel.Users" Width="1.5" PointX="3" PointY="3.125" />
         <AssociationConnector Association="sm_RDKModel.FK_ConcertProgram_Concert" />
         <AssociationConnector Association="sm_RDKModel.FK_ConcertProgram_Numbers" />
         <AssociationConnector Association="sm_RDKModel.FK_Users_Logined" />

+ 13 - 9
PDK_Concert/Pages/AuthorizationPage.xaml.cs

@@ -14,6 +14,7 @@ using System.Windows.Navigation;
 using System.Windows.Shapes;
 using PDK_Concert.Classes;
 using PDK_Concert.Pages;
+using LibraryRDK;
 
 namespace PDK_Concert.Pages
 {
@@ -29,16 +30,19 @@ namespace PDK_Concert.Pages
 
         private void go_Click(object sender, RoutedEventArgs e)
         {
-            int passwordHash = psPassword.Password.GetHashCode();
-            Logined logined = DataBaseClass.connect.Logined.FirstOrDefault(x => x.Login == tbLogin.Text && x.Password == passwordHash);
-            if (logined != null)
+            if (InputValidation.CheckAuthorization(tbLogin.Text, psPassword.Password))
             {
-                MessageBox.Show("Успешный вход", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
-                FrameClass.frame.Navigate(new MainPage(logined));
-            }
-            else
-            {
-                MessageBox.Show("Такого пользователя не существует", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                int passwordHash = psPassword.Password.GetHashCode();
+                Logined logined = DataBaseClass.connect.Logined.FirstOrDefault(x => x.Login == tbLogin.Text && x.Password == passwordHash);
+                if (logined != null)
+                {
+                    MessageBox.Show("Успешный вход", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                    FrameClass.frame.Navigate(new MainPage(logined));
+                }
+                else
+                {
+                    MessageBox.Show("Такого пользователя не существует", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
             }
         }
     }

+ 2 - 2
PDK_Concert/Pages/ConcertPage.xaml.cs

@@ -38,12 +38,12 @@ namespace PDK_Concert.Pages
         private void listConcent_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             Concert concertProgram = listConcent.SelectedItem as Concert;
-            Classes.FrameClass.menuFrame.Navigate(new ConcertProgramPage(concertProgram.IDConcert, logined));
+            Classes.FrameClass.menuFrame.Navigate(new ConcertProgramPage(concertProgram.IDConcert, logined,1));
         }
 
         private void btConcert_Click(object sender, RoutedEventArgs e)
         {
-
+            Classes.FrameClass.menuFrame.Navigate(new PastConcertPage(logined));
         }
     }
 }

+ 5 - 1
PDK_Concert/Pages/ConcertProgramPage.xaml

@@ -41,7 +41,7 @@
             </ListView>
             <TextBlock Text="Концертной прораммы нет" Style="{StaticResource Title}" Name="not" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"/>
         </StackPanel>
-        <StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
+        <StackPanel Name="yesAccess" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
             <TextBlock Style="{StaticResource Title}" Text="Добавить свой номер" Margin="0 0 0 50" HorizontalAlignment="Center"/>
             <GroupBox Width="300" Header="Название номера">
                 <ComboBox Width="300" FontSize="20" Name="numberTitle"/>
@@ -49,5 +49,9 @@
             <Button Content="Добавить"  Name="addNumder" Click="addNumder_Click"/>
             <Button Content="Назад" Name="back" Click="back_Click"/>
         </StackPanel>
+        <StackPanel Name="notAccess" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical" Visibility="Collapsed">
+            <TextBlock  HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource Title}" Text="Возможность добовления номеров закрыта"/>
+            <Button Content="Назад" Name="pastBack" Click="pastBack_Click"/>
+        </StackPanel>
     </Grid>
 </Page>

+ 18 - 3
PDK_Concert/Pages/ConcertProgramPage.xaml.cs

@@ -26,7 +26,7 @@ namespace PDK_Concert.Pages
         Logined logined;
         int ID;
         int index = 1;
-        public ConcertProgramPage(int IDConcert, Logined logined)
+        public ConcertProgramPage(int IDConcert, Logined logined, int access)
         {
             InitializeComponent();
             this.ID = IDConcert;
@@ -41,7 +41,11 @@ namespace PDK_Concert.Pages
                 not.Visibility = Visibility.Visible;
                 listNumber.Visibility = Visibility.Collapsed;
             }
-
+            if(access == 0)
+            {
+                notAccess.Visibility = Visibility.Visible;
+                yesAccess.Visibility = Visibility.Collapsed;
+            }
             this.logined = logined;
         }
 
@@ -62,7 +66,13 @@ namespace PDK_Concert.Pages
                 };
                 Classes.DataBaseClass.connect.ConcertProgram.Add(concertProgram);
                 Classes.DataBaseClass.connect.SaveChanges();
-                listNumber.ItemsSource = Classes.DataBaseClass.connect.ConcertProgram.Where(x => x.IDConcert == ID).OrderBy(x => x.IndexNumber).ToList();
+                concertProgramList = Classes.DataBaseClass.connect.ConcertProgram.Where(x => x.IDConcert == ID).OrderBy(x => x.IndexNumber).ToList();
+                listNumber.ItemsSource = concertProgramList;
+                if (concertProgramList.Count > 0)
+                {
+                    not.Visibility = Visibility.Collapsed;
+                    listNumber.Visibility = Visibility.Visible;
+                }
                 numberTitle.SelectedIndex = -1;
             }
             else
@@ -84,5 +94,10 @@ namespace PDK_Concert.Pages
             Classes.DataBaseClass.connect.SaveChanges();
             //listNumber.ItemsSource = Classes.DataBaseClass.connect.ConcertProgram.Where(x => x.IDConcert == ID).OrderBy(x => x.IndexNumber).ToList();
         }
+
+        private void pastBack_Click(object sender, RoutedEventArgs e)
+        {
+            Classes.FrameClass.menuFrame.Navigate(new PastConcertPage(logined));
+        }
     }
 }

+ 3 - 2
PDK_Concert/Pages/NewDayPehearsalPage.xaml

@@ -14,9 +14,10 @@
             <GroupBox Header="Дата">
                 <DatePicker Name="date" FontSize="20"/>
             </GroupBox>
-            <GroupBox Header="Время вашей репетиции">
-                <TextBox Name="time"/>
+            <GroupBox Header="Время вашей репетиции" ToolTip="(00:00-00:00)">
+                <TextBox Name="time" ToolTip="(00:00-00:00)"/>
             </GroupBox>
+            <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" Name="notAdd" Content="Не добавлять свою репетицию" Foreground="White" FontSize="20"/>
             <StackPanel Orientation="Horizontal">
             <Button Content="Добавить" Name="addRehearsal" Click="addRehearsal_Click"/>
                 <Button Content="Отмена" Name="back" Click="back_Click"/>

+ 22 - 9
PDK_Concert/Pages/NewDayPehearsalPage.xaml.cs

@@ -12,6 +12,7 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using LibraryRDK;
 
 namespace PDK_Concert.Pages
 {
@@ -34,23 +35,35 @@ namespace PDK_Concert.Pages
                 //сделать проверу на имеющийся элемент
                 RehearsalDate rehearsalDate = new RehearsalDate()
                 {
-                    RehearsalDate1 = date.DisplayDate
+                    //RehearsalDate1 = (DateTime)date.Text,
                 };
                 Classes.DataBaseClass.connect.RehearsalDate.Add(rehearsalDate);
-                RehearsalSchedule rehearsalSchedule = new RehearsalSchedule()
-                {
-                    IDSchedule = rehearsalDate.IDData,
-                    IDUser = logined.ID,
-                    RehearsalTime = time.Text
-                };
-                Classes.DataBaseClass.connect.RehearsalSchedule.Add(rehearsalSchedule);
                 Classes.DataBaseClass.connect.SaveChanges();
+                if (notAdd.IsChecked == false)
+                {
+                    if(InputValidation.Pattern(time.Text))
+                    {
+                        RehearsalSchedule rehearsalSchedule = new RehearsalSchedule()
+                        {
+                            IDSchedule = rehearsalDate.IDData,
+                            IDUser = logined.ID,
+                            RehearsalTime = time.Text
+                        };
+                        Classes.DataBaseClass.connect.RehearsalSchedule.Add(rehearsalSchedule);
+                        Classes.DataBaseClass.connect.SaveChanges();
+                    }
+                    else
+                    {
+                        MessageBox.Show("Вы ввели время не в том виде!\nВведите в формате 00:00-00:00", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                    }
+                }
+               
                 MessageBox.Show("Репетиция успешно добавлена", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
                 Classes.FrameClass.menuFrame.Navigate(new RehearsalSchedulePage(logined));
             }
             else
             {
-                MessageBox.Show("Вы выбрали дату позднее текущей","Ошибка",MessageBoxButton.OK, MessageBoxImage.Error);
+                MessageBox.Show("Вы выбрали дату позднее текущей", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
 

+ 37 - 0
PDK_Concert/Pages/PastConcertPage.xaml

@@ -0,0 +1,37 @@
+<Page x:Class="PDK_Concert.Pages.PastConcertPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="PastConcertPage">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="60"/>
+            <RowDefinition Height="1*"/>
+            <RowDefinition Height="50"/>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Column="1" Text="Прошедшие концерты" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+        <ListView SelectionChanged="listConcent_SelectionChanged" Grid.Row="1" Grid.Column="1" HorizontalContentAlignment="Stretch" Name="listConcent">
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel>
+                        <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
+                            <Run Text="Дата:" FontWeight="Bold"/>
+                            <Run Text="{Binding ConcertDate, StringFormat={}dd.MM.yyyy}"/>
+                        </TextBlock>
+                        <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
+                            <Run Text="Название: " FontWeight="Bold"/>
+                            <Run Text="{Binding Titlee}"/>
+                        </TextBlock>
+                    </StackPanel>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+        <TextBlock Name="not" Text="Актуальных концертов нет" Grid.Row="1" Style="{StaticResource Title}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"/>
+        <Button Grid.Column="1" Click="back_Click" Margin="0" Content="Назад" Grid.Row="2" Name="back"/>
+    </Grid>
+</Page>

+ 44 - 0
PDK_Concert/Pages/PastConcertPage.xaml.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для PastConcertPage.xaml
+    /// </summary>
+    public partial class PastConcertPage : Page
+    {
+        Logined logined;
+        List<Concert> concertList;
+        public PastConcertPage(Logined logined)
+        {
+            InitializeComponent();
+            this.logined = logined;
+            concertList = Classes.DataBaseClass.connect.Concert.Where(x=> x.ConcertDate<DateTime.Today).ToList();
+            listConcent.ItemsSource = concertList;
+        }
+
+        private void listConcent_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            Concert concertProgram = listConcent.SelectedItem as Concert;
+            Classes.FrameClass.menuFrame.Navigate(new ConcertProgramPage(concertProgram.IDConcert, logined,0));
+        }
+
+        private void back_Click(object sender, RoutedEventArgs e)
+        {
+            Classes.FrameClass.menuFrame.Navigate(new CocertPage(logined));
+        }
+    }
+}

+ 6 - 6
PDK_Concert/Pages/RehearsalPage.xaml

@@ -25,14 +25,14 @@
                         <GridViewColumn Header="Время">
                             <GridViewColumn.CellTemplate>
                                 <DataTemplate>
-                                    <TextBox TextChanged="TextBox_TextChanged" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontSize="20" Text="{Binding RehearsalTime}"/>
+                                    <TextBlock Style="{StaticResource List}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontSize="20" Text="{Binding RehearsalTime}"/>
                                 </DataTemplate>
                             </GridViewColumn.CellTemplate>
                         </GridViewColumn>
                         <GridViewColumn Header="Кто">
                             <GridViewColumn.CellTemplate>
                                 <DataTemplate>
-                                    <TextBlock Style="{StaticResource List}" Text="{Binding Numbers.Title}"/>
+                                    <TextBlock Style="{StaticResource List}" Text="{Binding Users.FIO}"/>
                                 </DataTemplate>
                             </GridViewColumn.CellTemplate>
                         </GridViewColumn>
@@ -42,11 +42,11 @@
             <TextBlock Text="Репетиций в этот день нет" Style="{StaticResource Title}" Name="not" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"/>
         </StackPanel>
         <StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
-            <TextBlock Style="{StaticResource Title}" Text="Добавить свой номер" Margin="0 0 0 50" HorizontalAlignment="Center"/>
-            <GroupBox Width="300" Header="Название номера">
-                <ComboBox Width="300" FontSize="20" Name="numberTitle"/>
+            <TextBlock Style="{StaticResource Title}" Text="Добавить время репетиции" Margin="0 0 0 50" HorizontalAlignment="Center"/>
+            <GroupBox Width="300" Header="Время" ToolTip="(00:00-00:00)">
+                <TextBox Name="time" ToolTip="(00:00-00:00)"/>
             </GroupBox>
-            <Button Content="Добавить"  Name="addNumder" Click="addNumder_Click"/>
+            <Button Content="Добавить"  Name="addTime" Click="addTime_Click"/>
             <Button Content="Назад" Name="back" Click="back_Click"/>
         </StackPanel>
     </Grid>

+ 39 - 2
PDK_Concert/Pages/RehearsalPage.xaml.cs

@@ -12,6 +12,7 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using LibraryRDK;
 
 namespace PDK_Concert.Pages
 {
@@ -20,14 +21,50 @@ namespace PDK_Concert.Pages
     /// </summary>
     public partial class RehearsalPage : Page
     {
-        public RehearsalPage()
+        int ID;
+        RehearsalDate date;
+        Logined logined;
+        List<RehearsalSchedule> schedules;
+        public RehearsalPage(int id, Logined logined)
         {
             InitializeComponent();
-            if (concertProgramList.Count == 0)
+            ID = id;
+            schedules = Classes.DataBaseClass.connect.RehearsalSchedule.Where(x => x.IDSchedule == ID).ToList();
+            if (schedules.Count == 0)
             {
                 not.Visibility = Visibility.Visible;
                 listRehearsal.Visibility = Visibility.Collapsed;
             }
+            listRehearsal.ItemsSource = schedules;
+            date = Classes.DataBaseClass.connect.RehearsalDate.FirstOrDefault(x => x.IDData == ID);
+            DataContext = date;
+            this.logined = logined;
+        }
+
+        private void back_Click(object sender, RoutedEventArgs e)
+        {
+            Classes.FrameClass.menuFrame.Navigate(new RehearsalSchedulePage(logined));
+        }
+
+        private void addTime_Click(object sender, RoutedEventArgs e)
+        {
+            if(InputValidation.Pattern(time.Text))
+            {
+                RehearsalSchedule rehearsalSchedule = new RehearsalSchedule()
+                {
+                    IDSchedule = ID,
+                    IDUser = logined.ID,
+                    RehearsalTime = time.Text
+                };
+                Classes.DataBaseClass.connect.RehearsalSchedule.Add(rehearsalSchedule);
+                Classes.DataBaseClass.connect.SaveChanges();
+                listRehearsal.ItemsSource = Classes.DataBaseClass.connect.RehearsalSchedule.Where(x => x.IDSchedule == ID).ToList();
+                time.Text = "";
+            }
+            else
+            {
+                MessageBox.Show("Вы ввели время не в том виде!\nВведите в формате 00:00-00:00", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
         }
     }
 }

+ 1 - 1
PDK_Concert/Pages/RehearsalSchedulePage.xaml.cs

@@ -43,7 +43,7 @@ namespace PDK_Concert.Pages
         private void listRehearsal_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             RehearsalDate rehearsalDate = listRehearsal.SelectedItem as RehearsalDate;
-
+            Classes.FrameClass.menuFrame.Navigate(new RehearsalPage(rehearsalDate.IDData,logined));
         }
     }
 }

+ 14 - 0
PDK_Concert/RDK_Concert.csproj

@@ -65,6 +65,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="Classes\UserClass.cs" />
     <Compile Include="Concert.cs">
       <DependentUpon>ModelBD.tt</DependentUpon>
     </Compile>
@@ -97,6 +98,9 @@
     <Compile Include="Pages\NumberPage.xaml.cs">
       <DependentUpon>NumberPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\PastConcertPage.xaml.cs">
+      <DependentUpon>PastConcertPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\ProfilePage.xaml.cs">
       <DependentUpon>ProfilePage.xaml</DependentUpon>
     </Compile>
@@ -169,6 +173,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\PastConcertPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\ProfilePage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -255,5 +263,11 @@
   <ItemGroup>
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\LibraryRDK\LibraryRDK.csproj">
+      <Project>{6ea9fa25-969f-484b-babc-2de02e12d164}</Project>
+      <Name>LibraryRDK</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 6 - 0
RDK_Concert.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 17.7.34031.279
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RDK_Concert", "PDK_Concert\RDK_Concert.csproj", "{4F723419-04CE-418D-9658-0966DEC752FF}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryRDK", "LibraryRDK\LibraryRDK.csproj", "{6EA9FA25-969F-484B-BABC-2DE02E12D164}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{4F723419-04CE-418D-9658-0966DEC752FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F723419-04CE-418D-9658-0966DEC752FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{4F723419-04CE-418D-9658-0966DEC752FF}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6EA9FA25-969F-484B-BABC-2DE02E12D164}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6EA9FA25-969F-484B-BABC-2DE02E12D164}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6EA9FA25-969F-484B-BABC-2DE02E12D164}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6EA9FA25-969F-484B-BABC-2DE02E12D164}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE