瀏覽代碼

половина функционала админа по ПО сделана

Oleg Kireev 3 年之前
父節點
當前提交
723fbdfbbc

+ 78 - 5
Hotel_Course_Project/AdminPage.xaml

@@ -24,9 +24,9 @@
 
                     <Button x:Name="AddStaffBtn" Click="AddStaffBtn_Click">Добавить</Button>
 
-                    <StackPanel Grid.Column="1" Orientation="Horizontal">
+                    <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
                         <TextBlock VerticalAlignment="Center">Сортировка</TextBlock>
-                        <ComboBox VerticalAlignment="Center" Name="SortStaffCB" SelectionChanged="ComboBox_SelectionChanged">
+                        <ComboBox VerticalAlignment="Center" Name="SortStaffCB" SelectionChanged="SortStaffCB_SelectionChanged">
                             <ComboBoxItem IsSelected="True" Name="activeS">Активные пользователи</ComboBoxItem>
                             <ComboBoxItem Name="nonActiveS">Удалённые пользователи</ComboBoxItem>
                         </ComboBox>
@@ -48,7 +48,82 @@
                             <DataGridTemplateColumn>
                                 <DataGridTemplateColumn.CellTemplate>
                                     <DataTemplate>
-                                        <Button x:Name="PersSelectBtn" Click="PersSelectBtn_Click">Выбрать</Button>
+                                        <Button x:Name="StaffSelectBtn" Click="StaffSelectBtn_Click">Выбрать</Button>
+                                    </DataTemplate>
+                                </DataGridTemplateColumn.CellTemplate>
+                            </DataGridTemplateColumn>
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+            <TabItem Header="Клиенты">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="40"></RowDefinition>
+                        <RowDefinition></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="100"></ColumnDefinition>
+                        <ColumnDefinition></ColumnDefinition>
+                        <ColumnDefinition></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+
+                    <Button x:Name="AddClientfBtn" Click="AddClientBtn_Click">Добавить</Button>
+
+                    <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
+                        <TextBlock VerticalAlignment="Center">Сортировка</TextBlock>
+                        <ComboBox VerticalAlignment="Center" Name="SortClientCB" SelectionChanged="SortClientCB_SelectionChanged">
+                            <ComboBoxItem IsSelected="True" Name="activeC">Активные клиенты</ComboBoxItem>
+                            <ComboBoxItem Name="nonActiveC">Удалённые клиенты</ComboBoxItem>
+                        </ComboBox>
+                    </StackPanel>
+
+                    <StackPanel Grid.Column="2" Orientation="Horizontal">
+                        <TextBlock VerticalAlignment="Center">Поиск</TextBlock>
+                        <TextBox  Name="ClientSeacrhTB" TextChanged="ClientSeacrhTB_TextChanged" VerticalAlignment="Center" Width="100"></TextBox>
+                        <Button Name="ClientSrchBtn" Click="ClientSrchBtn_Click">Поиск</Button>
+                    </StackPanel>
+
+
+                    <DataGrid x:Name="ClientList" Grid.Row="1" Grid.ColumnSpan="3" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True" >
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="Фамилия" Binding="{Binding LName}"></DataGridTextColumn>
+                            <DataGridTextColumn Header="Имя" Binding="{Binding FName}"></DataGridTextColumn>
+                            <DataGridTextColumn Header="Отчество" Binding="{Binding MName}"></DataGridTextColumn>
+                            <DataGridTemplateColumn>
+                                <DataGridTemplateColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <Button x:Name="ClientSelectBtn" Click="ClientSelectBtn_Click">Выбрать</Button>
+                                    </DataTemplate>
+                                </DataGridTemplateColumn.CellTemplate>
+                            </DataGridTemplateColumn>
+                        </DataGrid.Columns>
+                    </DataGrid>
+                </Grid>
+            </TabItem>
+            <TabItem Header="Комнаты">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="40"></RowDefinition>
+                        <RowDefinition></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition></ColumnDefinition>
+                        <ColumnDefinition></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+
+                    <Button x:Name="AddRoomBtn" Click="AddRoomBtn_Click">Добавить</Button>
+
+                    <DataGrid x:Name="RoomList" Grid.Row="1" Grid.ColumnSpan="2" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True">
+                        <DataGrid.Columns>
+                            <DataGridTextColumn Header="Номер Комнаты" Binding="{Binding NumRoom}"></DataGridTextColumn>
+                            <DataGridTextColumn Header="Кол-во мест" Binding="{Binding CountOfSeats}"></DataGridTextColumn>
+                            <DataGridTextColumn Header="Дневная полата" Binding="{Binding CostPerDay}"></DataGridTextColumn>
+                            <DataGridTextColumn Header="Статус комнаты" Binding="{Binding RoomStatus.Name}"></DataGridTextColumn>
+                            <DataGridTemplateColumn>
+                                <DataGridTemplateColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <Button x:Name="SelectRoomBtn" Click="SelectRoomBtn_Click">Выбрать</Button>
                                     </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                             </DataGridTemplateColumn>
@@ -56,8 +131,6 @@
                     </DataGrid>
                 </Grid>
             </TabItem>
-            <TabItem Header="Клиенты"></TabItem>
-            <TabItem Header="Комнаты"></TabItem>
             <TabItem Header="История Платежей"></TabItem>
             <TabItem Header="Прочее"></TabItem>
         </TabControl>

+ 84 - 5
Hotel_Course_Project/AdminPage.xaml.cs

@@ -29,7 +29,7 @@ namespace Hotel_Course_Project
 
         private void Page_Loaded(object sender, RoutedEventArgs e)
         {
-            StaffList.ItemsSource = null;
+            #region условия для выводва работников
             if (SortStaffCB.SelectedItem == activeS)
             {
                 StaffList.ItemsSource = DataBase.db.Staff.Where(item => item.Id_PersStatus == 1).ToList();
@@ -38,22 +38,53 @@ namespace Hotel_Course_Project
             {
                 StaffList.ItemsSource = DataBase.db.Staff.Where(item => item.Id_PersStatus == 2).ToList();
             }
+            #endregion
+            #region Условия для выводва клиентов
+            if (SortClientCB.SelectedItem == activeC)
+            {
+                ClientList.ItemsSource = DataBase.db.Client.Where(item => item.Id_PersStatus == 1).ToList();
+            }
+            else
+            {
+                ClientList.ItemsSource = DataBase.db.Client.Where(item => item.Id_PersStatus == 2).ToList();
+            }
+            #endregion
+
+            RoomList.ItemsSource = DataBase.db.Room.ToList();
         }
 
+        #region Обработчики кнопок добавления
         private void AddStaffBtn_Click(object sender, RoutedEventArgs e)
         {
             PChanger.MainFrame.Navigate(new StaffChangeOrAddPage(null));
             Page_Loaded(sender, e);
         }
+        private void AddClientBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PChanger.MainFrame.Navigate(new ClientChangeOrAddPage(null));
+            Page_Loaded(sender, e);
+        }
 
-        private void PersSelectBtn_Click(object sender, RoutedEventArgs e)
+        #endregion
+
+        #region Обработчики  кнопок выбора
+        private void StaffSelectBtn_Click(object sender, RoutedEventArgs e)
         {
             Staff staff = (sender as Button).DataContext as Staff;
             PChanger.MainFrame.Navigate(new StaffChangeOrAddPage(staff));
             Page_Loaded(sender, e);
         }
+        private void ClientSelectBtn_Click(object sender, RoutedEventArgs e)
+        {
+            Client client = (sender as Button).DataContext as Client;
+            PChanger.MainFrame.Navigate(new ClientChangeOrAddPage(client));
+            Page_Loaded(sender, e);
+        }
+        #endregion
+
+        #region Обработчики выбора в сортировке
 
-        private void ComboBox_SelectionChanged(object sender, RoutedEventArgs e)
+        private void SortStaffCB_SelectionChanged(object sender, RoutedEventArgs e)
         {
             if (StaffList != null)
             {
@@ -61,12 +92,23 @@ namespace Hotel_Course_Project
             }
         }
 
+        private void SortClientCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if (ClientList != null)
+            {
+                Page_Loaded(sender, e);
+            }
+        }
+
+        #endregion
+
+        #region Обработчики кнопок поиска
         private void StaffSrchBtn_Click(object sender, RoutedEventArgs e)
         {
             var seacrhed = DataBase.db.Staff.Where(item => (item.LName + " " + item.FName + " " + item.MName + " " + item.Login + " " + item.Password).Contains(StaffSeacrhTB.Text)).ToList();
             if (SortStaffCB.SelectedItem == activeS)
             {
-                StaffList.ItemsSource = seacrhed.Where(item => item.Id_PersStatus ==1).ToList() ;
+                StaffList.ItemsSource = seacrhed.Where(item => item.Id_PersStatus == 1).ToList();
             }
             else
             {
@@ -74,12 +116,49 @@ namespace Hotel_Course_Project
             }
         }
 
+        private void ClientSrchBtn_Click(object sender, RoutedEventArgs e)
+        {
+            var seacrhed = DataBase.db.Client.Where(item => (item.LName + " " + item.FName + " " + item.MName).Contains(ClientSeacrhTB.Text)).ToList();
+            if (SortClientCB.SelectedItem == activeC)
+            {
+                ClientList.ItemsSource = seacrhed.Where(item => item.Id_PersStatus == 1).ToList();
+            }
+            else
+            {
+                ClientList.ItemsSource = seacrhed.Where(item => item.Id_PersStatus == 2).ToList();
+            }
+        }
+        #endregion
+
+        #region Обработичики изменений видов сортировки
         private void StaffSeacrhTB_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if(StaffSeacrhTB.Text == "")
+            if (StaffSeacrhTB.Text == "")
             {
                 Page_Loaded(sender, e);
             }
         }
+        private void ClientSeacrhTB_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (ClientSeacrhTB.Text == "")
+            {
+                Page_Loaded(sender, e);
+            }
+        }
+        #endregion
+
+        private void AddRoomBtn_Click(object sender, RoutedEventArgs e)
+        {
+            RoomAddOrChangeWindow roomAddOrChange = new RoomAddOrChangeWindow(null);
+            roomAddOrChange.ShowDialog();
+            Page_Loaded(sender, e);
+        }
+
+        private void SelectRoomBtn_Click(object sender, RoutedEventArgs e)
+        {
+            Room room = (sender as Button).DataContext as Room;
+            RoomAddOrChangeWindow roomAddOrChange = new RoomAddOrChangeWindow(room);
+            Page_Loaded(sender, e);
+        }
     }
 }

+ 5 - 1
Hotel_Course_Project/AuthorizationWindow.xaml.cs

@@ -27,7 +27,11 @@ namespace Hotel_Course_Project
         private void AuthBtn_Click(object sender, RoutedEventArgs e)
         {
             var user = DataBase.db.Staff.SingleOrDefault(x => x.Login == Login.Text && x.Password == Password.Password);
-            if (user != null)
+            if (user != null && user.Id_PersStatus == 2)
+            {
+                MessageBox.Show("Данный пользователь удалён из базы данных");
+            }
+            else if (user != null && user.Id_PersStatus == 1)
             {
                 MainWindow mainWindow = new MainWindow(user);
                 mainWindow.Show();

+ 37 - 0
Hotel_Course_Project/ClientChangeOrAddPage.xaml

@@ -0,0 +1,37 @@
+<Page x:Class="Hotel_Course_Project.ClientChangeOrAddPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:Hotel_Course_Project"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="ClientChangeOrAddPage">
+
+    <Grid>
+
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="4*"></ColumnDefinition>
+            <ColumnDefinition Width="3*"></ColumnDefinition>
+            <ColumnDefinition Width="3*"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="0.2*"></RowDefinition>
+            <RowDefinition Height="0.2*"></RowDefinition>
+            <RowDefinition Height="0.2*"></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition Height="0.2*"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">Фамилия</TextBlock>
+        <TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">Имя</TextBlock>
+        <TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">Отчество</TextBlock>
+
+        <TextBox Grid.Row="0" Grid.Column="2" x:Name="CLName" Text="{Binding LName}"></TextBox>
+        <TextBox Grid.Row="1" Grid.Column="2" x:Name="CFName" Text="{Binding FName}"></TextBox>
+        <TextBox Grid.Row="2" Grid.Column="2" x:Name="CMName" Text="{Binding MName}"></TextBox>
+        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Фотография паспорта</TextBlock>
+        <Image x:Name="CPassportPhoto" Grid.RowSpan="4" Grid.Row="1" Source="{Binding Passport}" MouseLeftButtonDown="CPassportPhoto_MouseLeftButtonDown"></Image>
+        <Button Grid.Row="6" Grid.Column="1" x:Name="ClientDeleteOrRestoreBtn" Click="ClientDeleteOrRestoreBtn_Click"></Button>
+        <Button Grid.Row="6" Grid.Column="2" x:Name="ClientChangeOrAddBtn" Click="ClientChangeOrAddBtn_Click"></Button>
+    </Grid>
+</Page>

+ 137 - 0
Hotel_Course_Project/ClientChangeOrAddPage.xaml.cs

@@ -0,0 +1,137 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Hotel_Course_Project
+{
+    /// <summary>
+    /// Логика взаимодействия для ClientChangeOrAddPage.xaml
+    /// </summary>
+    public partial class ClientChangeOrAddPage : Page
+    {
+        public Client _client;
+        public int idClient;
+        public byte[] PassportImage;
+        public string FilePath;
+        public ClientChangeOrAddPage(Client client)
+        {
+            InitializeComponent();
+            DataContext = client;
+            _client = client;
+            if (DataContext != null)
+            {
+
+                ClientChangeOrAddBtn.Content = "Изменить данные";
+                this.Title = "Информация о клиенте";
+                idClient = client.Id;
+                ClientDeleteOrRestoreBtn.Visibility = Visibility.Visible;
+                if (client.Id_PersStatus == 1)
+                {
+                    ClientDeleteOrRestoreBtn.Content = "Удалить клиента";
+                }
+                else
+                {
+                    ClientDeleteOrRestoreBtn.Content = "Востановить клиента";
+                }
+            }
+            else
+            {
+                ClientChangeOrAddBtn.Content = "Добавить клиента";
+                this.Title = "Окно добавления клиента";
+                ClientDeleteOrRestoreBtn.Visibility = Visibility.Collapsed;
+            }
+            if (client == null || client.Passport == null)
+            {
+                CPassportPhoto.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/PersDefaultPhoto.png"));
+            }
+
+        }
+
+        private void ClientChangeOrAddBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (DataContext == null)
+            {
+            }
+            if (CLName.Text == null || CFName.Text == null)
+            {
+                MessageBox.Show("Ключевые поля не были заполнены!");
+                return;
+            }
+            else if (CPassportPhoto == null)
+            {
+                MessageBox.Show("Фотография паспорта не была загружена!");
+                return;
+            }
+            else
+            {
+                if (DataContext == null)
+                {
+                    Client client = new Client()
+                    {
+                        LName = CLName.Text,
+                        FName = CFName.Text,
+                        MName = CMName.Text,
+                        Passport = PassportImage,
+                        Id_PersStatus = 1
+                    };
+                    DataBase.db.Client.Add(client);
+                    var lastId = DataBase.db.Client.OrderByDescending(item => item.Id).FirstOrDefault().Id;
+                    DataBase.db.SaveChanges();
+                    MessageBox.Show("Клиент добавлен в базу.");
+                }
+                else
+                {
+                    MessageBox.Show("Данные по клиенту изменены.");
+                    _client.Passport = PassportImage;
+                    DataBase.db.SaveChanges();
+                }
+                PChanger.MainFrame.GoBack();
+            }
+        }
+
+        private void ClientDeleteOrRestoreBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (_client.Id_PersStatus == 1)
+            {
+                _client.Id_PersStatus = 2;
+                MessageBox.Show("Статус пользователя изменился на <удалён>");
+            }
+            else
+            {
+                _client.Id_PersStatus = 1;
+                MessageBox.Show("Статус пользователя восстановлен");
+            }
+            DataBase.db.SaveChanges();
+            PChanger.MainFrame.GoBack();
+        }
+
+        private void CPassportPhoto_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            if (openFileDialog.ShowDialog() == true)
+            {
+                FilePath = openFileDialog.FileName;
+                string uriString = $"{FilePath}";
+                BitmapImage bitimage = new BitmapImage(new Uri(@uriString));
+                CPassportPhoto.Source = bitimage;
+                PassportImage = SomeMethods.ConvertBitmapImageToByte(bitimage);
+            }
+            else
+            {
+                FilePath = string.Empty;
+            }
+        }
+    }
+}

+ 14 - 0
Hotel_Course_Project/Hotel_Course_Project.csproj

@@ -70,6 +70,9 @@
     <Compile Include="Client.cs">
       <DependentUpon>ModelDB.tt</DependentUpon>
     </Compile>
+    <Compile Include="ClientChangeOrAddPage.xaml.cs">
+      <DependentUpon>ClientChangeOrAddPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="DataBase.cs" />
     <Compile Include="HostelsPage.xaml.cs">
       <DependentUpon>HostelsPage.xaml</DependentUpon>
@@ -95,6 +98,9 @@
     <Compile Include="Room.cs">
       <DependentUpon>ModelDB.tt</DependentUpon>
     </Compile>
+    <Compile Include="RoomAddOrChangeWindow.xaml.cs">
+      <DependentUpon>RoomAddOrChangeWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="RoomStatus.cs">
       <DependentUpon>ModelDB.tt</DependentUpon>
     </Compile>
@@ -119,6 +125,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="ClientChangeOrAddPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="HostelsPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -138,6 +148,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="RoomAddOrChangeWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="StaffChangeOrAddPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 4 - 4
Hotel_Course_Project/ModelDB.edmx

@@ -58,14 +58,14 @@
           <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
           <Property Name="NumRoom" Type="int" Nullable="false" />
           <Property Name="CostPerDay" Type="money" />
-          <Property Name="CountOfseats" Type="int" />
+          <Property Name="CountOfSeats" Type="int" />
           <Property Name="Id_RoomStatus" Type="int" />
         </EntityType>
         <EntityType Name="RoomStatus">
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="int" Nullable="false" />
+          <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
           <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
         </EntityType>
         <EntityType Name="Staff">
@@ -295,10 +295,10 @@
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="NumRoom" Type="Int32" Nullable="false" />
           <Property Name="CostPerDay" Type="Decimal" Precision="19" Scale="4" />
-          <Property Name="CountOfseats" Type="Int32" />
           <Property Name="Id_RoomStatus" Type="Int32" />
           <NavigationProperty Name="Order" Relationship="Self.FK_Order_Room" FromRole="Room" ToRole="Order" />
           <NavigationProperty Name="RoomStatus" Relationship="Self.FK_Room_RoomStatus" FromRole="Room" ToRole="RoomStatus" />
+          <Property Name="CountOfSeats" Type="Int32" />
         </EntityType>
         <EntityType Name="RoomStatus">
           <Key>
@@ -561,10 +561,10 @@
           <EntitySetMapping Name="Room">
             <EntityTypeMapping TypeName="gr692_kovModel.Room">
               <MappingFragment StoreEntitySet="Room">
+                <ScalarProperty Name="CountOfSeats" ColumnName="CountOfSeats" />
                 <ScalarProperty Name="Id" ColumnName="Id" />
                 <ScalarProperty Name="NumRoom" ColumnName="NumRoom" />
                 <ScalarProperty Name="CostPerDay" ColumnName="CostPerDay" />
-                <ScalarProperty Name="CountOfseats" ColumnName="CountOfseats" />
                 <ScalarProperty Name="Id_RoomStatus" ColumnName="Id_RoomStatus" />
               </MappingFragment>
             </EntityTypeMapping>

+ 1 - 1
Hotel_Course_Project/ModelDB.edmx.diagram

@@ -4,7 +4,7 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="7b379ebd51334675b3099ff3e8b1d4e0" Name="Diagram1" ZoomLevel="82">
+      <Diagram DiagramId="7b379ebd51334675b3099ff3e8b1d4e0" Name="Diagram1" ZoomLevel="94">
         <EntityTypeShape EntityType="gr692_kovModel.Client" Width="1.5" PointX="3" PointY="5.625" IsExpanded="true" />
         <EntityTypeShape EntityType="gr692_kovModel.Order" Width="1.5" PointX="5.25" PointY="1" IsExpanded="true" />
         <EntityTypeShape EntityType="gr692_kovModel.Room" Width="1.5" PointX="3" PointY="1.5" IsExpanded="true" />

+ 1 - 1
Hotel_Course_Project/Room.cs

@@ -23,8 +23,8 @@ namespace Hotel_Course_Project
         public int Id { get; set; }
         public int NumRoom { get; set; }
         public Nullable<decimal> CostPerDay { get; set; }
-        public Nullable<int> CountOfseats { get; set; }
         public Nullable<int> Id_RoomStatus { get; set; }
+        public Nullable<int> CountOfSeats { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<Order> Order { get; set; }

+ 34 - 0
Hotel_Course_Project/RoomAddOrChangeWindow.xaml

@@ -0,0 +1,34 @@
+<Window x:Class="Hotel_Course_Project.RoomAddOrChangeWindow"
+        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="RoomAddWindow" Height="350" Width="250" WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition></ColumnDefinition>
+            <ColumnDefinition></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+
+        <TextBlock Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center">Номер комнаты</TextBlock>
+        <TextBlock Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center">Вместимость</TextBlock>
+        <TextBlock Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center">Дневная оплата</TextBlock>
+        <TextBlock Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center">Состояние комнаты</TextBlock>
+
+        <TextBox x:Name="RNum" Grid.Row="0" Grid.Column="1" Text="{Binding NumRoom}"></TextBox>
+        <TextBox x:Name="RRoominess" Grid.Row="1" Grid.Column="1" Text="{Binding CountOfSeats}"></TextBox>
+        <TextBox x:Name="RCostPerDay" Grid.Row="2" Grid.Column="1" Text="{Binding CostPerDay}"></TextBox>
+        <ComboBox x:Name="RStatus" Grid.Row="3" Grid.Column="1" SelectedItem="{Binding RoomStatus}" DisplayMemberPath="Name" ItemsSource="{Binding Id_RoomStatus.RoomStatus.Id.Name}"></ComboBox>
+        <Button x:Name="CancelBtn" Click="CancelBtn_Click">Отмена</Button>
+        <Button x:Name="AddBtn" Click="AddBtn_Click">Добавить</Button>
+    </Grid>
+</Window>

+ 40 - 0
Hotel_Course_Project/RoomAddOrChangeWindow.xaml.cs

@@ -0,0 +1,40 @@
+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>
+    /// Логика взаимодействия для RoomAddOrChangeWindow.xaml
+    /// </summary>
+    public partial class RoomAddOrChangeWindow : Window
+    {
+        public RoomAddOrChangeWindow(Room room)
+        {
+            InitializeComponent();
+            Room _room = room;
+            DataContext = _room;
+            RStatus.SelectedItem = DataBase.db.RoomStatus.Where(item => item.Name == "Доступна").ToString();
+        }
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = false;
+        }
+
+        private void AddBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = true;
+        }
+
+    }
+}