gr682_bpv %!s(int64=4) %!d(string=hai) anos
pai
achega
e1b410abd5

+ 20 - 30
HotelCalifornia/Client.xaml

@@ -7,7 +7,7 @@
         xmlns:local="clr-namespace:HotelCalifornia"
         mc:Ignorable="d"
         Title="Client" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png">
-    <Grid MouseDown="Grid_MouseDown">
+    <Grid MouseDown="Grid_MouseDown" Loaded="Grid_Loaded">
         <Grid.Background>
             <LinearGradientBrush StartPoint="0.1,0" EndPoint="0.9,1">
                 <GradientStop Color="#7E42F5" Offset="1" />
@@ -15,44 +15,30 @@
             </LinearGradientBrush>
         </Grid.Background>
         <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">
+        <StackPanel Margin="6,134,547,91.6" Orientation="Vertical">
             <TextBox Name="familiatxt" Margin="10,0,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
-  materialDesign:HintAssist.Hint="Фамилия клиента"/>
-            <TextBox Name="nametxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
-  materialDesign:HintAssist.Hint="Имя клиента"/>
+  materialDesign:HintAssist.Hint="Фамилия клиента" TextChanged="familiatxt_TextChanged"/>
+            <TextBox Name="nametxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
+  materialDesign:HintAssist.Hint="Имя клиента" TextChanged="nametxt_TextChanged"/>
             <TextBox Name="otchestvotxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="15"
-  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
-    Content="Россия" />
-                <ComboBoxItem
-    Content="США" />
-                <ComboBoxItem
-    Content="Украина" />
-                <ComboBoxItem
-    Content="Швеция" />
-                <ComboBoxItem
-    Content="Казахстан" />
-                <ComboBoxItem
-    Content="Белоруссия" />
-                <ComboBoxItem
-    Content="Другая..." />
-            </ComboBox>
-            
+  materialDesign:HintAssist.Hint="Отчество клиента" TextChanged="otchestvotxt_TextChanged"/>
+            <TextBox Name="telephonetxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="11"
+  materialDesign:HintAssist.Hint="Телефон клиента" TextChanged="telephonetxt_TextChanged"/>
+            <TextBox Name="passporttxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="10"
+  materialDesign:HintAssist.Hint="Серия и номер клиента"  materialDesign:HintAssist.HelperText="Без пробелов" TextChanged="passporttxt_TextChanged"/>
         </StackPanel>
-        <StackPanel Margin="0,320,547,43.6" Orientation="Horizontal">
-            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Добавить" Margin="25,0,0,0">
+        <StackPanel Margin="10,364,537,-0.4" Orientation="Horizontal">
+            <Button 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">
+            <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">
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="White" ToolTip="Удалить" Margin="25,0,0,0" Click="Delete_Click">
                 <materialDesign:PackIcon Kind="Delete" />
             </Button>
         </StackPanel>
-        <DataGrid IsReadOnly="True" HorizontalAlignment="Left" Height="257" Margin="293,134,0,0" VerticalAlignment="Top" Width="497" />
+        <DataGrid Name="dataclient" IsReadOnly="True" HorizontalAlignment="Left" Height="257" Margin="290,134,0,0" VerticalAlignment="Top" Width="497" SelectionChanged="dataclient_SelectionChanged" />
         <Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Вернуться к окну выбора функции" Margin="10,10,742,391.6" Click="Back">
             <materialDesign:PackIcon Kind="Backburger"  Foreground="White"/>
         </Button>
@@ -65,6 +51,10 @@
             <materialDesign:PackIcon
     Kind="WindowMinimize" Foreground="White"/>
         </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"/>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="561,87,10,0" TextWrapping="Wrap" Foreground="White" FontSize="22" VerticalAlignment="Top" Height="28" Width="229"/>
+        <TextBlock Name="idclienttxt" 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>

+ 222 - 0
HotelCalifornia/Client.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Data.SqlClient;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -12,6 +13,7 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
 using System.Windows.Threading;
+using System.Data;
 
 namespace HotelCalifornia
 {
@@ -29,6 +31,8 @@ namespace HotelCalifornia
             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();
@@ -74,5 +78,223 @@ namespace HotelCalifornia
         {
             this.WindowState = WindowState.Minimized;
         }
+
+        private void familiatxt_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 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 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 telephonetxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= '0' && ch <= '9')).ToArray());
+            }
+        }
+
+        private void passporttxt_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+               (textBox.Text.Where(ch => (ch >= '0' && ch <= '9')).ToArray());
+            }
+        }
+
+        private void Add_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                if (nametxt.Text == "" || familiatxt.Text=="" || telephonetxt.Text == "" || otchestvotxt.Text == "" || passporttxt.Text == "")
+                {
+                    MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else if (passporttxt.Text.Length < 10 || telephonetxt.Text.Length < 11)
+                {
+                    MessageBox.Show("Поле номер телефона и паспорт не полностью заполнены!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else
+                {
+                    con.Open();
+                        string reg = "INSERT INTO Client (LastName_Client,FirstName_Client,MiddleName_Client,Telephone_Client,Passport) VALUES('" + familiatxt.Text + "','" + nametxt.Text + "','" + otchestvotxt.Text + "','" + telephonetxt.Text + "','" + passporttxt.Text + "')";
+                        SqlDataAdapter dataAdapter = new SqlDataAdapter(reg, con);
+                        dataAdapter.SelectCommand.ExecuteNonQuery();
+                        con.Close();
+                        idclienttxt.Text = "";
+                        nametxt.Text = "";
+                        familiatxt.Text = "";
+                        otchestvotxt.Text = "";
+                        telephonetxt.Text = "";
+                        passporttxt.Text = "";
+                        showgrid();
+                        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 (idclienttxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else if (familiatxt.Text == "" || nametxt.Text == "" || otchestvotxt.Text == "" || telephonetxt.Text == "" || passporttxt.Text == "")
+            {
+                MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else if (passporttxt.Text.Length < 10 || telephonetxt.Text.Length < 11)
+            {
+                MessageBox.Show("Поля не полностью заполены!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "Update Client set LastName_Client ='" + familiatxt.Text + "', FirstName_Client = '" + nametxt.Text + "', MiddleName_Client = '" + otchestvotxt.Text + "', Telephone_Client = '" + telephonetxt.Text + "', Passport = '" + passporttxt.Text + "' where ID_Client = '" + idclienttxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    idclienttxt.Text = "";
+                    nametxt.Text = "";
+                    familiatxt.Text = "";
+                    otchestvotxt.Text = "";
+                    telephonetxt.Text = "";
+                    passporttxt.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 (idclienttxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Client WHERE ID_Client = '" + idclienttxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    idclienttxt.Text = "";
+                    nametxt.Text = "";
+                    familiatxt.Text = "";
+                    otchestvotxt.Text = "";
+                    telephonetxt.Text = "";         
+                    passporttxt.Text = "";
+                    showgrid();
+                    MessageBox.Show("Клиент удален!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        void showgrid()
+        {
+            try
+            {
+                con.Open();
+                string sql = "SELECT ID_Client, LastName_Client, FirstName_Client, MiddleName_Client, Telephone_Client, Passport From Client";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                DataTable data = new DataTable("Client");
+                dataAdapter.Fill(data);
+                dataclient.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                dataclient.Columns[0].Header = "ID";
+                dataclient.Columns[1].Header = "Фамилия";
+                dataclient.Columns[2].Header = "Имя";
+                dataclient.Columns[3].Header = "Отчество";
+                dataclient.Columns[4].Header = "Телефон";
+                dataclient.Columns[5].Header = "Паспорт";
+                dataclient.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                con.Close();
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Grid_Loaded(object sender, RoutedEventArgs e)
+        {
+            showgrid();
+        }
+
+        private void dataclient_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            try
+            {
+                DataGrid gd = (DataGrid)sender;
+                DataRowView rowView = gd.SelectedItem as DataRowView;
+                if (rowView != null)
+                {
+                    idclienttxt.Text = rowView["ID_Client"].ToString();
+                    familiatxt.Text = rowView["LastName_Client"].ToString();
+                    nametxt.Text = rowView["FirstName_Client"].ToString();
+                    otchestvotxt.Text = rowView["MiddleName_Client"].ToString();
+                    telephonetxt.Text = rowView["Telephone_Client"].ToString();
+                    passporttxt.Text = rowView["Passport"].ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void Refresh_Click(object sender, RoutedEventArgs e)
+        {
+            idclienttxt.Text = "";
+            nametxt.Text = "";
+            familiatxt.Text = "";
+            otchestvotxt.Text = "";
+            telephonetxt.Text = "";
+            passporttxt.Text = "";
+            showgrid();
+        }
     }
 }

+ 54 - 0
HotelCalifornia/ClientRoom.xaml

@@ -0,0 +1,54 @@
+<Window x:Class="HotelCalifornia.ClientRoom"
+        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="ClientRoom" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png" Loaded="Window_Loaded">
+    <Grid MouseDown="Grid_MouseDown">
+        <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="148,54,148,336.6"/>
+        <Button
+  Style="{StaticResource MaterialDesignIconButton}"
+  ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
+            <materialDesign:PackIcon
+    Kind="ExitToApp" Foreground="White"/>
+        </Button>
+        <Button
+  Style="{StaticResource MaterialDesignIconButton}"
+  ToolTip="Вернуться к окну авторизации" Margin="10,10,742,391.6" Click="Back">
+            <materialDesign:PackIcon
+    Kind="Backburger"  Foreground="White"/>
+        </Button>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="561,110,10,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>
+        <DataGrid Name="dataclientroom" IsReadOnly="True" HorizontalAlignment="Left" Height="257" Margin="293,138,0,0" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Top" Width="497" SelectionChanged="dataClientRoom_SelectionChanged"/>
+        <ComboBox Name="roomcombo" Margin="10,138,534,263.6" FontSize="18" FontFamily="Century Gothic" Foreground="White" Style="{StaticResource MaterialDesignFloatingHintComboBox}"
+             materialDesign:ColorZoneAssist.Mode="Inverted" materialDesign:HintAssist.Hint="Комната" Height="48"/>
+        <ComboBox Name="clientcombo" Margin="10,204,534,197.6" FontSize="18" FontFamily="Century Gothic" Foreground="White" Style="{StaticResource MaterialDesignFloatingHintComboBox}"
+             materialDesign:ColorZoneAssist.Mode="Inverted" materialDesign:HintAssist.Hint="Клиент" Height="48"/>
+        <StackPanel Margin="10,292,537,71.6" Orientation="Horizontal">
+            <Button 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>
+    </Grid>
+</Window>

+ 123 - 0
HotelCalifornia/ClientRoom.xaml.cs

@@ -0,0 +1,123 @@
+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;
+using System.Data.SqlClient;
+
+namespace HotelCalifornia
+{
+    /// <summary>
+    /// Логика взаимодействия для ClientRoom.xaml
+    /// </summary>
+    public partial class ClientRoom : Window
+    {
+        public ClientRoom()
+        {
+            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 Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            DragMove();
+        }
+
+        private void Close(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        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 dataClientRoom_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
+
+        private void Add_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void Update_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void Delete_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void Window_Loaded(object sender, RoutedEventArgs e)
+        {
+            fillroomcombo();
+        }
+
+        void fillroomcombo()
+        {
+
+            try
+            {
+                roomcombo.Items.Clear();
+                con.Open();
+                SqlCommand sql = con.CreateCommand();
+                sql.CommandType = CommandType.Text;
+                sql.CommandText = "Select Number_Room from Room";
+                sql.ExecuteNonQuery();
+                DataTable dt = new DataTable();
+                SqlDataAdapter da = new SqlDataAdapter(sql);
+                da.Fill(dt);
+                foreach (DataRow dr in dt.Rows)
+                {
+                    roomcombo.Items.Add(dr["Number_Room"].ToString());
+                }
+                con.Close();
+            }
+            catch (Exception ex)
+            {
+                con.Close();
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+    }
+}

+ 7 - 0
HotelCalifornia/HotelCalifornia.csproj

@@ -66,6 +66,9 @@
     <Compile Include="Client.xaml.cs">
       <DependentUpon>Client.xaml</DependentUpon>
     </Compile>
+    <Compile Include="ClientRoom.xaml.cs">
+      <DependentUpon>ClientRoom.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Room.xaml.cs">
       <DependentUpon>Room.xaml</DependentUpon>
     </Compile>
@@ -79,6 +82,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="ClientRoom.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 2 - 1
HotelCalifornia/MainWindow.xaml.cs

@@ -85,8 +85,9 @@ namespace HotelCalifornia
                     }
                 }
             }
-            catch (Exception ex)
+            catch (Exception ex)           
             {
+                con.Close();
                 MessageBox.Show("Возникла ошибка! " + ex.ToString(),"Ошибка",MessageBoxButton.OK, MessageBoxImage.Error);
             }       
         }

+ 16 - 8
HotelCalifornia/Variant.xaml

@@ -15,34 +15,42 @@
             </LinearGradientBrush>
         </Grid.Background>
         <Label Content="Выберите нужную функцию" Foreground="White" FontSize="35" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="148,54,148,336.6"/>
-        <Label Content="Комнаты" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="100,272,604,143.6"/>
-        <Label Content="Работники" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="266,272,418,143.6" Width="116"/>
-        <Label Content="Клиенты" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="454,272,253,143.6" Width="93"/>
-        <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="60,272,644,143.6"/>
+        <Label Content="Работники" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="196,272,488,143.6" Width="116"/>
+        <Label Content="Клиенты" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="352,272,355,143.6" Width="93"/>
+        <Label Content="Резервирование" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="620,272,-1,143.6" Width="181"/>
+        <Label Content="Заселение" Foreground="White" FontSize="20" FontFamily="Century Gothic" HorizontalAlignment="Center" Margin="484,272,189,143.6" Width="127"/>
         <StackPanel Orientation="Horizontal" Margin="0,172,0,159.6" HorizontalAlignment="Center" VerticalAlignment="Center" Width="800" Height="118">
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="RoomGO_Click">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="80,0,0,0" Click="RoomGO_Click">
                 <materialDesign:PackIcon
     Kind="Door"
     Height="35"
     Width="35" />
             </Button>
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="StaffGO_Click">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="90,0,0,0" Click="StaffGO_Click">
                 <materialDesign:PackIcon
     Kind="Work"
     Height="35"
     Width="35" />
             </Button>
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="KlientGO_Click">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="90,0,0,0" Click="KlientGO_Click">
                 <materialDesign:PackIcon
     Kind="user"
     Height="35"
     Width="35" />
             </Button>
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="90,0,0,0" Click="ZaselenieGO_Click">
+                <materialDesign:PackIcon
+    Kind="Bed"
+    Height="35"
+    Width="35" />
+            </Button>
+            <Button
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="100,0,0,0">
                 <materialDesign:PackIcon
     Kind="Ticket"
     Height="35"

+ 15 - 0
HotelCalifornia/Variant.xaml.cs

@@ -124,5 +124,20 @@ namespace HotelCalifornia
                     break;
             }
         }
+
+        private void ZaselenieGO_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите перейти к окну заселения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    ClientRoom clientRoom = new ClientRoom();
+                    this.Close();
+                    clientRoom.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
     }
 }