Pārlūkot izejas kodu

Добавли окно клиентов, визуально оформил, осталось добавить БД

gr682_bpv 4 gadi atpakaļ
vecāks
revīzija
c2cba624e0

+ 77 - 0
HotelCalifornia/Client.xaml

@@ -0,0 +1,77 @@
+<Window x:Class="HotelCalifornia.Client"
+        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="Client" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png">
+    <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"/>
+        <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"
+  materialDesign:HintAssist.Hint="Фамилия клиента"/>
+            <TextBox Name="otchestvotxt" Margin="10,15,0,0" FontSize="18" FontFamily="Century Gothic" Foreground="White" MaxLength="25"
+  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="Белоруссия" />
+            </ComboBox>
+        </StackPanel>
+        <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>
+            <Button
+  Style="{StaticResource MaterialDesignIconButton}" Foreground="White"
+  ToolTip="Редактировать" Margin="25,0,0,0">
+                <materialDesign:PackIcon
+    Kind="Edit" />
+            </Button>
+            <Button
+  Style="{StaticResource MaterialDesignIconButton}" Foreground="White"
+  ToolTip="Удалить" Margin="25,0,0,0">
+                <materialDesign:PackIcon
+    Kind="Delete" />
+            </Button>
+        </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"/>
+        </Button>
+        <Button
+  Style="{StaticResource MaterialDesignIconButton}"
+  ToolTip="Выход из приложения" Margin="742,10,10,391.6" Click="Close">
+        <materialDesign:PackIcon
+    Kind="ExitToApp" Foreground="White"/>
+        </Button>
+    </Grid>
+</Window>

+ 63 - 0
HotelCalifornia/Client.xaml.cs

@@ -0,0 +1,63 @@
+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 HotelCalifornia
+{
+    /// <summary>
+    /// Логика взаимодействия для Client.xaml
+    /// </summary>
+    public partial class Client : Window
+    {
+        public Client()
+        {
+            InitializeComponent();
+        }
+
+        //Перетаскивание окна
+        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;
+            }
+        }
+    }
+}

+ 7 - 0
HotelCalifornia/HotelCalifornia.csproj

@@ -63,9 +63,16 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="Client.xaml.cs">
+      <DependentUpon>Client.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Variant.xaml.cs">
       <DependentUpon>Variant.xaml</DependentUpon>
     </Compile>
+    <Page Include="Client.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 5 - 1
HotelCalifornia/MainWindow.xaml.cs

@@ -24,12 +24,14 @@ namespace HotelCalifornia
         {
             InitializeComponent();        
         }
-        Variant variant = new Variant();
+ 
+        //Перетаскивание окна
         private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
         {
             DragMove();
         }
 
+        //Выход из приложения
         private void Close(object sender, RoutedEventArgs e)
         {
             MessageBoxResult result = MessageBox.Show("Вы хотите выйти из приложения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
@@ -43,6 +45,7 @@ namespace HotelCalifornia
             }                 
         }
 
+        //Авторизация пользователя
         private void Vhod(object sender, RoutedEventArgs e)
         {
             if (logintxt.Text == "" || passwordtxt.Password == "")
@@ -51,6 +54,7 @@ namespace HotelCalifornia
             }
             else
             {
+                Variant variant = new Variant();
                 this.Close();
                 variant.Show();
             }

+ 8 - 2
HotelCalifornia/Variant.xaml

@@ -7,7 +7,7 @@
         xmlns:local="clr-namespace:HotelCalifornia"
         mc:Ignorable="d"
         Title="Variant" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" Icon="image/h1.png">
-    <Grid>
+    <Grid MouseDown="Grid_MouseDown">
         <Grid.Background>
             <LinearGradientBrush StartPoint="0.1,0" EndPoint="0.9,1">
                 <GradientStop Color="#7E42F5" Offset="1" />
@@ -35,7 +35,7 @@
     Width="35" />
             </Button>
             <Button
-  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0">
+  Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="120,0,0,0" Click="KlientGO_Click">
                 <materialDesign:PackIcon
     Kind="user"
     Height="35"
@@ -55,5 +55,11 @@
             <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>
     </Grid>
 </Window>

+ 39 - 0
HotelCalifornia/Variant.xaml.cs

@@ -24,6 +24,13 @@ namespace HotelCalifornia
             InitializeComponent();
         }
 
+        //Перетаскивание окна
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            DragMove();
+        }
+
+        //Выход из приложения
         private void Close(object sender, RoutedEventArgs e)
         {
             MessageBoxResult result = MessageBox.Show("Вы хотите выйти из приложения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
@@ -36,5 +43,37 @@ namespace HotelCalifornia
                     break;
             }
         }
+        
+        //Возврат к окну авторизации
+        private void Back(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите вернуться к окну авторизации?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    MainWindow mainWindow = new MainWindow();
+                    this.Close();
+                    mainWindow.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
+
+        //Переход к окну клиентов
+        private void KlientGO_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBoxResult result = MessageBox.Show("Вы хотите перейти к окну клиентов?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (result)
+            {
+                case MessageBoxResult.Yes:
+                    Client client = new Client();
+                    this.Close();
+                    client.Show();
+                    break;
+                case MessageBoxResult.No:
+                    break;
+            }
+        }
     }
 }