Oleg Kireev пре 3 година
родитељ
комит
ab9b54dd5c

+ 1 - 1
Hotel_Course_Project/AuthorizationWindow.xaml.cs

@@ -63,7 +63,7 @@ namespace Hotel_Course_Project
 
         private void LostPass_Click(object sender, RoutedEventArgs e)
         {
-
+            HelpQustionWindow helpQustion = new HelpQustionWindow();
         }
     }
 }

+ 23 - 0
Hotel_Course_Project/EnterLoginWindow.xaml

@@ -0,0 +1,23 @@
+<Window x:Class="Hotel_Course_Project.EnterLoginWindow"
+        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:Hotel_Course_Project"
+        mc:Ignorable="d"
+        Title="EnterLoginWindow" Height="200" Width="300">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition></ColumnDefinition>
+            <ColumnDefinition></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <TextBlock>Введите логин</TextBlock>
+        <TextBox Name="Login" Grid.Column="1"></TextBox>
+        <Button x:Name="Cancelbtn" Click="Cancelbtn_Click" Grid.Row="1">Отмена</Button>
+        <Button x:Name="AcceptBtn" Click="AcceptBtn_Click" Grid.Row="1" Grid.Column="1">Подтвердить</Button>
+    </Grid>
+</Window>

+ 38 - 0
Hotel_Course_Project/EnterLoginWindow.xaml.cs

@@ -0,0 +1,38 @@
+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.Shapes;
+
+namespace Hotel_Course_Project
+{
+    /// <summary>
+    /// Логика взаимодействия для EnterLoginWindow.xaml
+    /// </summary>
+    public partial class EnterLoginWindow : Window
+    {
+        public EnterLoginWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void AcceptBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = false;
+        }
+
+        private void Cancelbtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (DataBase.db.Staff.SingleOrDefault(x => x.Login == Login.Text))
+            DialogResult = true;
+        }
+    }
+}

+ 26 - 0
Hotel_Course_Project/HelpQustionWindow.xaml

@@ -0,0 +1,26 @@
+<Window x:Class="Hotel_Course_Project.HelpQustionWindow"
+        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:Hotel_Course_Project"
+        mc:Ignorable="d"
+        Title="HelpQustionWindow" Height="300" Width="400">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition></ColumnDefinition>
+            <ColumnDefinition></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock>Вопрос</TextBlock>
+        <TextBlock Grid.Row="1">Ответ</TextBlock>
+        <ComboBox Name="TypeQuestionCB" SelectedItem="{Binding Question}" DisplayMemberPath="Name" ItemsSource="{Binding Id_HelpQuestion.HelpQuetion.Id.Name}" Grid.Column="1"></ComboBox>
+        <TextBox Name="AnswerTB" Grid.Column="1" Grid.Row="1"></TextBox>
+        <Button x:Name="CancelBtn" Click="CancelBtn_Click" Grid.Row="2">Отмена</Button>
+        <Button Name="AcceptBtn" Click="AcceptBtn_Click" Grid.Row="2" Grid.Column="1">Подтвердить</Button>
+    </Grid>
+</Window>

+ 44 - 0
Hotel_Course_Project/HelpQustionWindow.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.Shapes;
+
+namespace Hotel_Course_Project
+{
+    /// <summary>
+    /// Логика взаимодействия для HelpQustionWindow.xaml
+    /// </summary>
+    public partial class HelpQustionWindow : Window
+    {
+        public HelpQustionWindow(Staff user)
+        {
+            InitializeComponent();
+            TypeQuestionCB.ItemsSource = DataBase.db.HelpQuestion.ToList();
+            if (user.Id_HelpQuestion != null)
+            {
+                TypeQuestionCB.Text = user.ToString();
+                TypeQuestionCB.IsEditable = false;
+            }
+        }
+
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = false;
+        }
+
+        private void AcceptBtn_Click(object sender, RoutedEventArgs e)
+        {
+
+            DialogResult = true;
+        }
+    }
+}

+ 21 - 0
Hotel_Course_Project/Hotel_Course_Project.csproj

@@ -82,13 +82,22 @@
       <DependentUpon>ClientChangeOrAddPage.xaml</DependentUpon>
     </Compile>
     <Compile Include="DataBase.cs" />
+    <Compile Include="EnterLoginWindow.xaml.cs">
+      <DependentUpon>EnterLoginWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Helper.cs" />
     <Compile Include="HelpQuestion.cs">
       <DependentUpon>ModelDB.tt</DependentUpon>
     </Compile>
+    <Compile Include="HelpQustionWindow.xaml.cs">
+      <DependentUpon>HelpQustionWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="HostelsPage.xaml.cs">
       <DependentUpon>HostelsPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="LoginRememberWindow.xaml.cs">
+      <DependentUpon>LoginRememberWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="ModelDB.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
@@ -170,10 +179,22 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="EnterLoginWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="HelpQustionWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="HostelsPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="LoginRememberWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 22 - 0
Hotel_Course_Project/LoginRememberWindow.xaml

@@ -0,0 +1,22 @@
+<Window x:Class="Hotel_Course_Project.LoginRememberWindow"
+        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:Hotel_Course_Project"
+        mc:Ignorable="d"
+        Title="Проверка логина" Height="200" Width="300">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition></ColumnDefinition>
+            <ColumnDefinition></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <TextBlock Grid.ColumnSpan="2">Вы помните свой логин?</TextBlock>
+        <Button x:Name="CancelBtn" Grid.Row="1" Click="CancelBtn_Click">Нет</Button>
+        <Button x:Name="AcceptBtn" Grid.Row="1" Grid.Column="1" Click="AcceptBtn_Click">Да</Button>
+    </Grid>
+</Window>

+ 39 - 0
Hotel_Course_Project/LoginRememberWindow.xaml.cs

@@ -0,0 +1,39 @@
+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.Shapes;
+
+namespace Hotel_Course_Project
+{
+    /// <summary>
+    /// Логика взаимодействия для LoginRememberWindow.xaml
+    /// </summary>
+    public partial class LoginRememberWindow : Window
+    {
+        public LoginRememberWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = false;
+        }
+
+        private void AcceptBtn_Click(object sender, RoutedEventArgs e)
+        {            
+            DialogResult = true;
+            EnterLoginWindow EnterLogin = new EnterLoginWindow();
+            EnterLogin.ShowDialog();
+        }
+    }
+}

+ 3 - 1
Hotel_Course_Project/MainWindow.xaml.cs

@@ -25,7 +25,9 @@ namespace Hotel_Course_Project
             }
             if (user.Id_HelpQuestion == null)
             {
-                
+                HelpQustionWindow helpQustion = new HelpQustionWindow(user);
+                helpQustion.ShowDialog();
+                DataBase.db.SaveChanges();
             }
         }