2 Komitmen c2cba624e0 ... 6db741cd45

Pembuat SHA1 Pesan Tanggal
  gr682_bpv 6db741cd45 //// 4 tahun lalu
  gr682_bpv 3fe4b7be65 ... 4 tahun lalu

+ 28 - 35
HotelCalifornia/Client.xaml

@@ -14,18 +14,16 @@
                 <GradientStop Color="#383E7A" Offset="0"/>
                 <GradientStop Color="#383E7A" Offset="0"/>
             </LinearGradientBrush>
             </LinearGradientBrush>
         </Grid.Background>
         </Grid.Background>
-        <Label Content="Информация о клиентах" Foreground="White" FontSize="35" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="148,54,148,336.6"/>
-        <StackPanel Margin="6,124,547,68.6" Orientation="Vertical">
-            <TextBox Name="nametxt" Margin="10,0,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
-  materialDesign:HintAssist.Hint="Имя клиента"/>
-            <TextBox Name="familiatxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
+        <Label Content="Клиенты" Foreground="White" FontSize="35" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="148,54,148,336.6"/>
+        <StackPanel Margin="6,134,547,58.6" Orientation="Vertical">
+            <TextBox Name="familiatxt" Margin="10,0,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
   materialDesign:HintAssist.Hint="Фамилия клиента"/>
   materialDesign:HintAssist.Hint="Фамилия клиента"/>
-            <TextBox Name="otchestvotxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="25"
+            <TextBox Name="nametxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
+  materialDesign:HintAssist.Hint="Имя клиента"/>
+            <TextBox Name="otchestvotxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
   materialDesign:HintAssist.Hint="Отчество клиента"/>
   materialDesign:HintAssist.Hint="Отчество клиента"/>
-            <ComboBox Margin="10,10,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White"
-                      Style="{StaticResource MaterialDesignFloatingHintComboBox}"
-                       materialDesign:ColorZoneAssist.Mode="Inverted"
-  materialDesign:HintAssist.Hint="Страна">
+            <ComboBox Margin="10,10,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" Style="{StaticResource MaterialDesignFloatingHintComboBox}"
+             materialDesign:ColorZoneAssist.Mode="Inverted" materialDesign:HintAssist.Hint="Страна">
                 <ComboBoxItem
                 <ComboBoxItem
     Content="Россия" />
     Content="Россия" />
                 <ComboBoxItem
                 <ComboBoxItem
@@ -38,40 +36,35 @@
     Content="Казахстан" />
     Content="Казахстан" />
                 <ComboBoxItem
                 <ComboBoxItem
     Content="Белоруссия" />
     Content="Белоруссия" />
+                <ComboBoxItem
+    Content="Другая..." />
             </ComboBox>
             </ComboBox>
+            
         </StackPanel>
         </StackPanel>
         <StackPanel Margin="0,320,547,43.6" Orientation="Horizontal">
         <StackPanel Margin="0,320,547,43.6" Orientation="Horizontal">
-            <Button
-  Style="{StaticResource MaterialDesignIconButton}" Foreground="White"
-  ToolTip="Добавить" Margin="25,0,0,0">
-                <materialDesign:PackIcon
-    Kind="Add" />
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Добавить" Margin="25,0,0,0">
+                <materialDesign:PackIcon Kind="Add" />
             </Button>
             </Button>
-            <Button
-  Style="{StaticResource MaterialDesignIconButton}" Foreground="White"
-  ToolTip="Редактировать" Margin="25,0,0,0">
-                <materialDesign:PackIcon
-    Kind="Edit" />
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Редактировать" Margin="25,0,0,0">
+                <materialDesign:PackIcon Kind="Edit" />
             </Button>
             </Button>
-            <Button
-  Style="{StaticResource MaterialDesignIconButton}" Foreground="White"
-  ToolTip="Удалить" Margin="25,0,0,0">
-                <materialDesign:PackIcon
-    Kind="Delete" />
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Удалить" Margin="25,0,0,0">
+                <materialDesign:PackIcon Kind="Delete" />
             </Button>
             </Button>
         </StackPanel>
         </StackPanel>
-        <DataGrid HorizontalAlignment="Left" Height="257" Margin="293,124,0,0" VerticalAlignment="Top" Width="497" />
-        <Button
-  Style="{StaticResource MaterialDesignIconButton}"
-  ToolTip="Вернуться к окну выбора функции" Margin="10,10,742,391.6" Click="Back">
-            <materialDesign:PackIcon
-    Kind="Backburger"  Foreground="White"/>
+        <DataGrid IsReadOnly="True" HorizontalAlignment="Left" Height="257" Margin="293,134,0,0" VerticalAlignment="Top" Width="497" />
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Вернуться к окну выбора функции" Margin="10,10,742,391.6" Click="Back">
+            <materialDesign:PackIcon Kind="Backburger"  Foreground="White"/>
+        </Button>
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
+            <materialDesign:PackIcon Kind="ExitToApp" Foreground="White"/>
         </Button>
         </Button>
-        <Button
+        <Button Name="WindMin"
   Style="{StaticResource MaterialDesignIconButton}"
   Style="{StaticResource MaterialDesignIconButton}"
-  ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
-        <materialDesign:PackIcon
-    Kind="ExitToApp" Foreground="White"/>
+  ToolTip="Свернуть окно" Margin="694,10,58,391.6" Click="WindMin_Click">
+            <materialDesign:PackIcon
+    Kind="WindowMinimize" Foreground="White"/>
         </Button>
         </Button>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="561,105,10,0" TextWrapping="Wrap" Foreground="White" FontSize="22" VerticalAlignment="Top" Height="28" Width="229"/>
     </Grid>
     </Grid>
 </Window>
 </Window>

+ 15 - 0
HotelCalifornia/Client.xaml.cs

@@ -11,6 +11,7 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
 using System.Windows.Shapes;
+using System.Windows.Threading;
 
 
 namespace HotelCalifornia
 namespace HotelCalifornia
 {
 {
@@ -22,6 +23,15 @@ namespace HotelCalifornia
         public Client()
         public Client()
         {
         {
             InitializeComponent();
             InitializeComponent();
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Tick += new EventHandler(Update_Timer_Tick);
+            timer.Interval = new TimeSpan(0, 0, 1);
+            timer.Start();
+        }
+
+        private void Update_Timer_Tick(object sender, EventArgs e)
+        {
+            timetxt.Text = DateTime.Now.ToString();
         }
         }
 
 
         //Перетаскивание окна
         //Перетаскивание окна
@@ -59,5 +69,10 @@ namespace HotelCalifornia
                     break;
                     break;
             }
             }
         }
         }
+
+        private void WindMin_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
     }
     }
 }
 }

+ 17 - 0
HotelCalifornia/HotelCalifornia.csproj

@@ -66,6 +66,12 @@
     <Compile Include="Client.xaml.cs">
     <Compile Include="Client.xaml.cs">
       <DependentUpon>Client.xaml</DependentUpon>
       <DependentUpon>Client.xaml</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="Room.xaml.cs">
+      <DependentUpon>Room.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Staff.xaml.cs">
+      <DependentUpon>Staff.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Variant.xaml.cs">
     <Compile Include="Variant.xaml.cs">
       <DependentUpon>Variant.xaml</DependentUpon>
       <DependentUpon>Variant.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -85,6 +91,14 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
       <SubType>Code</SubType>
     </Compile>
     </Compile>
+    <Page Include="Room.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Staff.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Variant.xaml">
     <Page Include="Variant.xaml">
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
@@ -138,6 +152,9 @@
   <ItemGroup>
   <ItemGroup>
     <Resource Include="Image\cir2.png" />
     <Resource Include="Image\cir2.png" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\room.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets')" />
   <Import Project="..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

TEMPAT SAMPAH
HotelCalifornia/Image/room.png


+ 8 - 2
HotelCalifornia/MainWindow.xaml

@@ -26,12 +26,12 @@
             <StackPanel Orientation="Horizontal">
             <StackPanel Orientation="Horizontal">
                 <materialDesign:PackIcon Kind="User" Width="30" Height="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                 <materialDesign:PackIcon Kind="User" Width="30" Height="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                 <TextBox Name="logintxt" Margin="0,0,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
                 <TextBox Name="logintxt" Margin="0,0,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
-  materialDesign:HintAssist.Hint="Введите логин" Width="227"/>
+  materialDesign:HintAssist.Hint="Введите логин" Width="227" PreviewKeyDown="logintxt_PreviewKeyDown" TextChanged="logintxt_TextChanged"/>
             </StackPanel>
             </StackPanel>
             <Label Content="Пароль:" Margin="0,10,0,0" Foreground="White" FontSize="18" FontFamily="Century Gothic"/>
             <Label Content="Пароль:" Margin="0,10,0,0" Foreground="White" FontSize="18" FontFamily="Century Gothic"/>
             <StackPanel Orientation="Horizontal">
             <StackPanel Orientation="Horizontal">
                 <materialDesign:PackIcon Kind="Password" Width="30" Height="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                 <materialDesign:PackIcon Kind="Password" Width="30" Height="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
-                <PasswordBox Name="passwordtxt"   materialDesign:HintAssist.Hint="Введите пароль" Foreground="White" FontSize="18" FontFamily="Century Gothic"  HorizontalAlignment="Center" Margin="0,5,0,0" Width="226" MaxLength="10"/>
+                <PasswordBox Name="passwordtxt" materialDesign:HintAssist.Hint="Введите пароль" Foreground="White" FontSize="18" FontFamily="Century Gothic"  HorizontalAlignment="Center" Margin="0,5,0,0" Width="226" MaxLength="10" PreviewKeyDown="passwordtxt_PreviewKeyDown" PreviewTextInput="passwordtxt_PreviewTextInput"/>
             </StackPanel>
             </StackPanel>
         </StackPanel>
         </StackPanel>
         <Button
         <Button
@@ -46,5 +46,11 @@
             <materialDesign:PackIcon
             <materialDesign:PackIcon
     Kind="ExitToApp" Foreground="White"/>
     Kind="ExitToApp" Foreground="White"/>
         </Button>
         </Button>
+        <Button Name="WindMin"
+  Style="{StaticResource MaterialDesignIconButton}"
+  ToolTip="Свернуть окно" Margin="594,10,58,342" Click="WindMin_Click">
+            <materialDesign:PackIcon
+    Kind="WindowMinimize" Foreground="White"/>
+        </Button>
     </Grid>
     </Grid>
 </Window>
 </Window>

+ 79 - 6
HotelCalifornia/MainWindow.xaml.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls;
@@ -12,6 +13,8 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
 using System.Windows.Shapes;
+using System.Data.SqlClient;
+using System.Data;
 
 
 namespace HotelCalifornia
 namespace HotelCalifornia
 {
 {
@@ -24,6 +27,8 @@ namespace HotelCalifornia
         {
         {
             InitializeComponent();        
             InitializeComponent();        
         }
         }
+
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=kursah;Integrated Security=True");
  
  
         //Перетаскивание окна
         //Перетаскивание окна
         private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
         private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
@@ -48,16 +53,84 @@ namespace HotelCalifornia
         //Авторизация пользователя
         //Авторизация пользователя
         private void Vhod(object sender, RoutedEventArgs e)
         private void Vhod(object sender, RoutedEventArgs e)
         {
         {
-            if (logintxt.Text == "" || passwordtxt.Password == "")
+            try
             {
             {
-                MessageBox.Show("Поля не могут быть пустыми!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                if (logintxt.Text == "" || passwordtxt.Password == "")
+                {
+                    MessageBox.Show("Поля не могут быть пустыми!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else
+                {
+                    con.Open();
+                    SqlCommand cmd = new SqlCommand("Select * from Administrator where Login ='" + logintxt.Text + "'  and Password ='" + passwordtxt.Password + "'", con);
+                    cmd.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter = new SqlDataAdapter();
+                    adapter.SelectCommand = cmd;
+                    DataSet dataSet = new DataSet();
+                    adapter.Fill(dataSet);
+                    if (dataSet.Tables[0].Rows.Count > 0)
+                    {
+                        Variant variant = new Variant();                    
+                        string username = dataSet.Tables[0].Rows[0]["ID_Administrator"].ToString();
+                        variant.idadmintxt.Text = username;
+                        con.Close();
+                        MessageBox.Show("Добро пожаловать!", "Вход", MessageBoxButton.OK, MessageBoxImage.Information);
+                        variant.Show();
+                        this.Close();
+                    }
+                    else
+                    {
+                        con.Close();
+                        MessageBox.Show("Такого Администратора нет в системе!", "Вход", MessageBoxButton.OK, MessageBoxImage.Information);
+                    }
+                }
             }
             }
-            else
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(),"Ошибка",MessageBoxButton.OK, MessageBoxImage.Error);
+            }       
+        }
+
+        //Запрет пробела
+        private void logintxt_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Space)
             {
             {
-                Variant variant = new Variant();
-                this.Close();
-                variant.Show();
+                e.Handled = true;
             }
             }
         }
         }
+
+        //Запрет пробела
+        private void passwordtxt_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Space)
+            {
+                e.Handled = true;
+            }
+        }
+
+        //Определенные символы
+        private void logintxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')).ToArray());
+            }
+        }
+
+        //Определенные символы
+        private void passwordtxt_PreviewTextInput(object sender, TextCompositionEventArgs e)
+        {
+            bool a = new Regex("[^A-Z]+").IsMatch(e.Text);
+            bool b = new Regex("[^a-z]+").IsMatch(e.Text);
+            bool c = new Regex("[^0-9]+").IsMatch(e.Text);
+            e.Handled = a && b && c;
+        }
+
+        private void WindMin_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
     }
     }
 }
 }

+ 58 - 0
HotelCalifornia/Room.xaml

@@ -0,0 +1,58 @@
+<Window x:Class="HotelCalifornia.Room"
+        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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+        xmlns:local="clr-namespace:HotelCalifornia"
+        mc:Ignorable="d"
+        Title="Room" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png">
+    <Grid MouseDown="Grid_MouseDown" Loaded="Grid_Loaded" >
+        <Grid.Background>
+            <LinearGradientBrush StartPoint="0.1,0" EndPoint="0.9,1">
+                <GradientStop Color="#7E42F5" Offset="1" />
+                <GradientStop Color="#383E7A" Offset="0"/>
+            </LinearGradientBrush>
+        </Grid.Background>
+        <Label Content="Комнаты" Foreground="White" FontSize="35" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="167,46,167,344.6"/>
+        <DataGrid Name="dataroom" IsReadOnly="True" HorizontalAlignment="Left" Height="257" Margin="293,138,0,0" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Top" Width="497" SelectionChanged="dataroom_SelectionChanged" />
+        <StackPanel Margin="6,124,547,175.6" Orientation="Vertical">
+            <TextBox Name="numbertxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="3"
+  materialDesign:HintAssist.Hint="Номер комнаты" PreviewTextInput="numbertxt_PreviewTextInput" PreviewKeyDown="numbertxt_PreviewKeyDown"/>
+            <TextBox Name="telephonetxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="9"
+  materialDesign:HintAssist.Hint="Телефон комнаты" PreviewTextInput="telephonetxt_PreviewTextInput" PreviewKeyDown="telephonetxt_PreviewKeyDown"/>
+            <Label Content="Статус комнаты:" Margin="10,15,0,0" Foreground="White" FontSize="18" FontFamily="Century Gothic"/>
+        </StackPanel>
+        <Label Content="Свободна" Margin="17,274,676,135.6" Foreground="White" FontSize="18" FontFamily="Century Gothic"/>
+        <RadioButton IsChecked="True" Name="yescheck" Foreground="White" HorizontalAlignment="Left" Margin="128,278,0,0" VerticalAlignment="Top" Height="23" Width="19" Background="#FFF3EFFA"/>
+        <Label Content="Да" Margin="146,275,620,139.6" Foreground="White" FontSize="16" FontFamily="Century Gothic"/>
+        <RadioButton Name="nocheck" Foreground="White" HorizontalAlignment="Left" Margin="190,278,0,0" VerticalAlignment="Top" Height="23" Width="19" Background="#FFF3EFFA"/>
+        <Label Content="Нет" Margin="208,275,555,139.6" Foreground="White" FontSize="16" FontFamily="Century Gothic"/>
+        <StackPanel Margin="0,320,547,43.6" Orientation="Horizontal">
+            <Button Name="Add" Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Добавить" Margin="25,0,0,0" Click="Add_Click">
+                <materialDesign:PackIcon Kind="Add" />
+            </Button>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Редактировать" Margin="25,0,0,0" Click="Update_Click">
+                <materialDesign:PackIcon Kind="Edit" />
+            </Button>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Удалить" Margin="25,0,0,0" Click="Delete_Click">
+                <materialDesign:PackIcon Kind="Delete" />
+            </Button>
+        </StackPanel>
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Вернуться к окну выбора функции" Margin="10,10,742,391.6" Click="Back">
+            <materialDesign:PackIcon Kind="Backburger"  Foreground="White"/>
+        </Button>
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
+            <materialDesign:PackIcon Kind="ExitToApp" Foreground="White"/>
+        </Button>
+        <Button Name="WindMin"
+  Style="{StaticResource MaterialDesignIconButton}" ToolTip="Свернуть окно" Margin="694,10,58,391.6" Click="WindMin_Click">
+            <materialDesign:PackIcon Kind="WindowMinimize" Foreground="White"/>
+        </Button>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="561,88,10,0" TextWrapping="Wrap" Foreground="White" FontSize="22" VerticalAlignment="Top" Height="28" Width="229"/>
+        <TextBlock Name="idroomtxt" Visibility="Hidden"/>
+        <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Обновить" Margin="508,76,244,325.6" Click="Refresh_Click">
+            <materialDesign:PackIcon Kind="Refresh" />
+        </Button>
+    </Grid>
+</Window>

+ 310 - 0
HotelCalifornia/Room.xaml.cs

@@ -0,0 +1,310 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+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;
+using System.Windows.Threading;
+using System.Data;
+using System.Data.SqlClient;
+
+
+namespace HotelCalifornia
+{
+    /// <summary>
+    /// Логика взаимодействия для Room.xaml
+    /// </summary>
+    public partial class Room : Window
+    {
+        public Room()
+        {
+            InitializeComponent();
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Tick += new EventHandler(Update_Timer_Tick);
+            timer.Interval = new TimeSpan(0, 0, 1);
+            timer.Start();
+        }
+
+        //Строка подключения
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=kursah;Integrated Security=True");
+        string status = "";
+
+        private void Update_Timer_Tick(object sender, EventArgs e)
+        {
+            timetxt.Text = DateTime.Now.ToString();
+        }
+
+        //Перетаскивание окна
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            DragMove();
+        }
+
+        //Возвращение к предыдущему окну
+        private void Back(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите вернуться к предыдущему окну?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Variant variant = new Variant();
+                    this.Close();
+                    variant.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        //Закрытие окна
+        private void Close(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите выйти из приложения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Application.Current.Shutdown();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        //Для ввода только цифр
+        private void numbertxt_PreviewTextInput(object sender, TextCompositionEventArgs e)
+        {
+            e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
+        }
+
+        //Для ввода только цифр
+        private void telephonetxt_PreviewTextInput(object sender, TextCompositionEventArgs e)
+        {
+            e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
+        }
+
+        //Запрет пробела
+        private void numbertxt_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Space)
+            {
+                e.Handled = true;
+            }
+        }
+
+        //Запрет пробела
+        private void telephonetxt_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Space)
+            {
+                e.Handled = true;
+            }
+        }
+
+        //Добавление
+        private void Add_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                if (numbertxt.Text == "" || telephonetxt.Text == "")
+                {
+                    MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else if (numbertxt.Text.Length < 3 || telephonetxt.Text.Length < 9)
+                {
+                    MessageBox.Show("Поля не полностью заполены!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else
+                {
+                    con.Open();
+                    SqlCommand cmd = new SqlCommand("Select * from Room where Number_Room ='" + numbertxt.Text + "'", con);
+                    cmd.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter = new SqlDataAdapter();
+                    adapter.SelectCommand = cmd;
+                    DataSet dataSet = new DataSet();
+                    adapter.Fill(dataSet);
+                    if (dataSet.Tables[0].Rows.Count > 0)
+                    {
+                        MessageBox.Show("Такая комната уже есть!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                        con.Close();
+                    }
+                    else
+                    {
+                        if (yescheck.IsChecked == true)
+                            status = "1";
+                        else
+                            status = "2";
+                        string reg = "INSERT INTO Room (Number_Room,Telephone_Room,Status_Room) VALUES('" + numbertxt.Text + "','" + telephonetxt.Text + "','" + status.ToString() + "')";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(reg, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        idroomtxt.Text = "";
+                        numbertxt.Text = "";
+                        telephonetxt.Text = "";
+                        yescheck.IsChecked = true;
+                        showgrid();
+                        MessageBox.Show("Комната добавлена!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                con.Close();
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void WindMin_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
+
+        private void Update_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                if (idroomtxt.Text == "")
+                {
+                    MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else if (numbertxt.Text == "" || telephonetxt.Text == "")
+                {
+                    MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else if (numbertxt.Text.Length < 3 || telephonetxt.Text.Length < 9)
+                {
+                    MessageBox.Show("Поля не полностью заполены!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else
+                {
+                    try
+                    {
+                        if (yescheck.IsChecked == true)
+                            status = "1";
+                        else
+                            status = "2";
+                        con.Open();
+                        string sql = "Update Room set Number_Room ='" + numbertxt.Text + "', Telephone_Room = '" + telephonetxt.Text + "', Status_Room = '" + status.ToString() + "' where ID_Room = '" + idroomtxt.Text + "'";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        idroomtxt.Text = "";
+                        numbertxt.Text = "";
+                        telephonetxt.Text = "";
+                        yescheck.IsChecked = true;
+                        showgrid();
+                        MessageBox.Show("Комната изменена!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                    }
+                    catch (Exception ex)
+                    {
+                        con.Close();
+                        MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Delete_Click(object sender, RoutedEventArgs e)
+        {
+            if (idroomtxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Room WHERE ID_Room = '" + idroomtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    idroomtxt.Text = "";
+                    numbertxt.Text = "";
+                    telephonetxt.Text = "";
+                    yescheck.IsChecked = true;
+                    showgrid();
+                    MessageBox.Show("Комната удалена!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Grid_Loaded(object sender, RoutedEventArgs e)
+        {
+            showgrid();
+        }
+
+        void showgrid()
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT ID_Room, Number_Room, Telephone_Room, RoomStatus.Status From Room inner join RoomStatus on RoomStatus.ID_Status = Room.Status_Room";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("Room");
+                dataAdapter.Fill(data);
+                dataroom.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                dataroom.Columns[0].Header = "ID";
+                dataroom.Columns[1].Header = "Номер комнты";
+                dataroom.Columns[2].Header = "Телефон комнаты";
+                dataroom.Columns[3].Header = "Статус комнаты";
+                dataroom.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void dataroom_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            try
+            {
+                DataGrid gd = (DataGrid)sender;
+                DataRowView rowView = gd.SelectedItem as DataRowView;
+                if (rowView != null)
+                {
+                    idroomtxt.Text = rowView["ID_Room"].ToString();
+                    numbertxt.Text = rowView["Number_Room"].ToString();
+                    telephonetxt.Text = rowView["Telephone_Room"].ToString();
+                    status = rowView["Status"].ToString();
+                    if (status == "Свободна")
+                        yescheck.IsChecked = true;
+                    else
+                        nocheck.IsChecked = true;
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Refresh_Click(object sender, RoutedEventArgs e)
+        {
+            showgrid();
+            idroomtxt.Text = "";
+            numbertxt.Text = "";
+            telephonetxt.Text = "";
+            yescheck.IsChecked = true;
+        }
+    }
+}

+ 58 - 0
HotelCalifornia/Staff.xaml

@@ -0,0 +1,58 @@
+<Window x:Class="HotelCalifornia.Staff"
+        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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+        xmlns:local="clr-namespace:HotelCalifornia"
+        mc:Ignorable="d"
+        Title="Staff" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png">
+    <Grid Loaded="Grid_Loaded">
+        <Grid.Background>
+            <LinearGradientBrush StartPoint="0.1,0" EndPoint="0.9,1">
+                <GradientStop Color="#7E42F5" Offset="1" />
+                <GradientStop Color="#383E7A" Offset="0"/>
+            </LinearGradientBrush>
+        </Grid.Background>
+        <Label Content="Работники администрации" Foreground="White" FontSize="35" FontFamily="Century Gothic" HorizontalAlignment="Center"  Width="500" Margin="150,19,150,372.6"  />
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
+            <materialDesign:PackIcon Kind="ExitToApp" Foreground="White"/>
+        </Button>
+        <Button Name="WindMin"
+  Style="{StaticResource MaterialDesignIconButton}" ToolTip="Свернуть окно" Margin="694,10,58,391.6" Click="WindMin_Click">
+            <materialDesign:PackIcon Kind="WindowMinimize" Foreground="White"/>
+        </Button>
+        <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Вернуться к окну выбора функции" Margin="10,10,742,391.6" Click="Back">
+            <materialDesign:PackIcon Kind="Backburger"  Foreground="White"/>
+        </Button>
+        <StackPanel Margin="6,124,547,85.6" Orientation="Vertical">
+            <TextBox x:Name="familiyatxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
+                materialDesign:HintAssist.Hint="Фамилия работника" TextChanged="familiyatxt_TextChanged"/>
+            <TextBox x:Name="nametxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
+                materialDesign:HintAssist.Hint="Имя работника" TextChanged="nametxt_TextChanged"/>
+            <TextBox x:Name="otchestvotxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
+                materialDesign:HintAssist.Hint="Отчество работника" TextChanged="otchestvotxt_TextChanged"/>
+            <TextBox x:Name="logintxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
+                materialDesign:HintAssist.Hint="Логин работника" TextChanged="logintxt_TextChanged"/>
+            <TextBox x:Name="passwordtxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
+                materialDesign:HintAssist.Hint="Пароль работника" TextChanged="passwordtxt_TextChanged"/>
+        </StackPanel>
+        <StackPanel Margin="6,364,547,-0.4" Orientation="Horizontal">
+            <Button x:Name="Add" Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Добавить" Margin="25,0,0,0" Click="Add_Click">
+                <materialDesign:PackIcon Kind="Add" />
+            </Button>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Редактировать" Margin="25,0,0,0" Click="Update_Click">
+                <materialDesign:PackIcon Kind="Edit" />
+            </Button>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Удалить" Margin="25,0,0,0" Click="Delete_Click">
+                <materialDesign:PackIcon Kind="Delete" />
+            </Button>
+        </StackPanel>
+        <DataGrid Name="datastaff" IsReadOnly="True" HorizontalAlignment="Left" Height="273" Margin="258,130,0,0" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Top" Width="532" SelectionChanged="datastaff_SelectionChanged"/>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="561,88,10,0" TextWrapping="Wrap" Foreground="White" FontSize="22" VerticalAlignment="Top" Height="28" Width="229"/>
+        <TextBlock Name="idtxt" Visibility="Hidden"/>
+        <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Обновить" Margin="508,76,244,325.6" Click="Refresh_Click">
+            <materialDesign:PackIcon Kind="Refresh" />
+        </Button>
+    </Grid>
+</Window>

+ 297 - 0
HotelCalifornia/Staff.xaml.cs

@@ -0,0 +1,297 @@
+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;
+using System.Windows.Threading;
+using System.Data.SqlClient;
+using System.Data;
+
+namespace HotelCalifornia
+{
+    /// <summary>
+    /// Логика взаимодействия для Staff.xaml
+    /// </summary>
+    public partial class Staff : Window
+    {
+        public Staff()
+        {
+            InitializeComponent();
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Tick += new EventHandler(Update_Timer_Tick);
+            timer.Interval = new TimeSpan(0, 0, 1);
+            timer.Start();
+        }
+
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=kursah;Integrated Security=True");
+
+        private void Update_Timer_Tick(object sender, EventArgs e)
+        {
+            timetxt.Text = DateTime.Now.ToString();
+        }
+
+        private void Close(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите выйти из приложения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Application.Current.Shutdown();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        private void WindMin_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
+
+        private void Back(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите вернуться к предыдущему окну?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Variant variant = new Variant();
+                    this.Close();
+                    variant.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        private void datastaff_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            try
+            {
+                DataGrid gd = (DataGrid)sender;
+                DataRowView rowView = gd.SelectedItem as DataRowView;
+                if (rowView != null)
+                {
+                    idtxt.Text = rowView["ID_Administrator"].ToString();
+                    nametxt.Text = rowView["FirstName"].ToString();
+                    familiyatxt.Text = rowView["LastName"].ToString();
+                    otchestvotxt.Text = rowView["MiddleName"].ToString();
+                    logintxt.Text = rowView["Login"].ToString();
+                    passwordtxt.Text = rowView["Password"].ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Add_Click(object sender, RoutedEventArgs e)
+        {
+            if (familiyatxt.Text == "" || nametxt.Text == "" || otchestvotxt.Text == "" || logintxt.Text == "" || passwordtxt.Text == "")
+            {
+                MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd = new SqlCommand("Select * from Administrator where Login ='" + logintxt.Text + "'", con);
+                    cmd.CommandType = CommandType.Text;
+                    SqlDataAdapter adapter = new SqlDataAdapter();
+                    adapter.SelectCommand = cmd;
+                    DataSet dataSet = new DataSet();
+                    adapter.Fill(dataSet);
+                    if (dataSet.Tables[0].Rows.Count > 0)
+                    {
+                        MessageBox.Show("Такой Администратор уже создан!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                        con.Close();
+                    }
+                    else
+                    {
+                        string reg = "INSERT INTO Administrator (LastName,FirstName,MiddleName,Login,Password) VALUES('" + familiyatxt.Text + "','" + nametxt.Text + "','" + otchestvotxt.Text + "','" + logintxt.Text + "','" + passwordtxt.Text + "')";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(reg, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        showgrid();
+                        idtxt.Text = "";
+                        nametxt.Text = "";
+                        familiyatxt.Text = "";
+                        otchestvotxt.Text = "";
+                        logintxt.Text = "";
+                        passwordtxt.Text = "";
+                        MessageBox.Show("Администратор был добавлен!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Update_Click(object sender, RoutedEventArgs e)
+        {
+            if (idtxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else if (familiyatxt.Text == "" || nametxt.Text == "" || otchestvotxt.Text == "" || logintxt.Text == "" || passwordtxt.Text == "")
+            {
+                MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "Update Administrator set FirstName ='" + nametxt.Text + "', LastName = '" + familiyatxt.Text + "', MiddleName = '" + otchestvotxt.Text + "', Login = '" + logintxt.Text + "', Password = '" + passwordtxt.Text + "' where ID_Administrator = '" + idtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    idtxt.Text = "";
+                    nametxt.Text = "";
+                    familiyatxt.Text = "";
+                    otchestvotxt.Text = "";
+                    logintxt.Text = "";
+                    passwordtxt.Text = "";
+                    showgrid();
+                    MessageBox.Show("Администратор был изменен!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Delete_Click(object sender, RoutedEventArgs e)
+        {
+            if (idtxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Administrator WHERE ID_Administrator = '" + idtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    idtxt.Text = "";
+                    nametxt.Text = "";
+                    familiyatxt.Text = "";
+                    otchestvotxt.Text = "";
+                    logintxt.Text = "";
+                    passwordtxt.Text = "";
+                    showgrid();
+                    MessageBox.Show("Администратор удален!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void nametxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я')).ToArray());
+            }
+        }
+
+        private void familiyatxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я')).ToArray());
+            }
+        }
+
+        private void otchestvotxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я')).ToArray());
+            }
+        }
+
+        private void logintxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')).ToArray());
+            }
+        }
+
+        private void passwordtxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')).ToArray());
+            }
+        }
+
+        private void Grid_Loaded(object sender, RoutedEventArgs e)
+        {
+            showgrid();
+        }
+
+        void showgrid()
+        {
+            try
+            {
+                con.Open();
+                string rke = "SELECT * From Administrator";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(rke, con);
+                DataTable data = new DataTable("Administrator");
+                dataAdapter.Fill(data);
+                datastaff.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datastaff.Columns[0].Header = "ID";
+                datastaff.Columns[1].Header = "Фамилия";
+                datastaff.Columns[2].Header = "Имя";
+                datastaff.Columns[3].Header = "Отчество";
+                datastaff.Columns[4].Header = "Логин";
+                datastaff.Columns[5].Header = "Пароль";
+                datastaff.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Refresh_Click(object sender, RoutedEventArgs e)
+        {
+            showgrid();
+            idtxt.Text = "";
+            nametxt.Text = "";
+            familiyatxt.Text = "";
+            otchestvotxt.Text = "";
+            logintxt.Text = "";
+            passwordtxt.Text = "";
+        }
+    }
+}

+ 11 - 3
HotelCalifornia/Variant.xaml

@@ -21,14 +21,14 @@
         <Label Content="Резервирование" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="586,272,33,143.6" Width="181"/>
         <Label Content="Резервирование" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="586,272,33,143.6" Width="181"/>
         <StackPanel Orientation="Horizontal" Margin="0,172,0,159.6" HorizontalAlignment="Center" VerticalAlignment="Center" Width="800" Height="118">
         <StackPanel Orientation="Horizontal" Margin="0,172,0,159.6" HorizontalAlignment="Center" VerticalAlignment="Center" Width="800" Height="118">
             <Button
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="RoomGO_Click">
                 <materialDesign:PackIcon
                 <materialDesign:PackIcon
     Kind="Door"
     Kind="Door"
     Height="35"
     Height="35"
     Width="35" />
     Width="35" />
             </Button>
             </Button>
             <Button
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="StaffGO_Click">
                 <materialDesign:PackIcon
                 <materialDesign:PackIcon
     Kind="Work"
     Kind="Work"
     Height="35"
     Height="35"
@@ -44,7 +44,7 @@
             <Button
             <Button
   Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
   Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
                 <materialDesign:PackIcon
                 <materialDesign:PackIcon
-    Kind="BagSuitcase"
+    Kind="Ticket"
     Height="35"
     Height="35"
     Width="35" />
     Width="35" />
             </Button>
             </Button>
@@ -61,5 +61,13 @@
             <materialDesign:PackIcon
             <materialDesign:PackIcon
     Kind="Backburger"  Foreground="White"/>
     Kind="Backburger"  Foreground="White"/>
         </Button>
         </Button>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="314,118,257,0" TextWrapping="Wrap" Foreground="White" FontSize="22" VerticalAlignment="Top" Height="28" Width="229"/>
+        <Button Name="WindMin"
+  Style="{StaticResource MaterialDesignIconButton}"
+  ToolTip="Свернуть окно" Margin="694,10,58,391.6" Click="WindMin_Click">
+            <materialDesign:PackIcon
+    Kind="WindowMinimize" Foreground="White"/>
+        </Button>
+        <TextBlock Name="idadmintxt" Visibility="Hidden"/>
     </Grid>
     </Grid>
 </Window>
 </Window>

+ 49 - 0
HotelCalifornia/Variant.xaml.cs

@@ -11,6 +11,7 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
 using System.Windows.Shapes;
+using System.Windows.Threading;
 
 
 namespace HotelCalifornia
 namespace HotelCalifornia
 {
 {
@@ -22,6 +23,17 @@ namespace HotelCalifornia
         public Variant()
         public Variant()
         {
         {
             InitializeComponent();
             InitializeComponent();
+            //Таймер на обновление времени
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Tick += new EventHandler(Update_Timer_Tick);
+            timer.Interval = new TimeSpan(0, 0, 1);
+            timer.Start();
+        }
+
+        //Вывод даты и время в textbox
+        private void Update_Timer_Tick(object sender, EventArgs e)
+        {
+            timetxt.Text = DateTime.Now.ToString();
         }
         }
 
 
         //Перетаскивание окна
         //Перетаскивание окна
@@ -75,5 +87,42 @@ namespace HotelCalifornia
                     break;
                     break;
             }
             }
         }
         }
+
+        //Переход к окну комнат
+        private void RoomGO_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите перейти к окну комнат?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Room room = new Room();
+                    this.Close();
+                    room.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        private void WindMin_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
+
+        //Переход к окну работников
+        private void StaffGO_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите перейти к окну работников?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Staff staff = new Staff();
+                    this.Close();
+                    staff.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
     }
     }
 }
 }