Browse Source

Добавьте файлы проекта.

gr682_bpv 3 years ago
parent
commit
c35f60443b

+ 25 - 0
Inventory.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29102.190
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory", "Inventory\Inventory.csproj", "{F9126F22-F595-409C-82FF-91637587BFA5}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F9126F22-F595-409C-82FF-91637587BFA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F9126F22-F595-409C-82FF-91637587BFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F9126F22-F595-409C-82FF-91637587BFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F9126F22-F595-409C-82FF-91637587BFA5}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CAC98B9E-115E-45E5-ADA6-A95A8B20E182}
+	EndGlobalSection
+EndGlobal

+ 6 - 0
Inventory/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+</configuration>

+ 16 - 0
Inventory/App.xaml

@@ -0,0 +1,16 @@
+<Application x:Class="Inventory.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:Inventory"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </Application.Resources>
+</Application>

+ 17 - 0
Inventory/App.xaml.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Inventory
+{
+    /// <summary>
+    /// Логика взаимодействия для App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

BIN
Inventory/Image/dialog.png


BIN
Inventory/Image/kabinet.png


BIN
Inventory/Image/logo.png


BIN
Inventory/Image/oboryd.png


BIN
Inventory/Image/person.png


+ 141 - 0
Inventory/Inventory.csproj

@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F9126F22-F595-409C-82FF-91637587BFA5}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>Inventory</RootNamespace>
+    <AssemblyName>Inventory</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MaterialDesignColors, Version=2.0.1.2556, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MaterialDesignColors.2.0.1\lib\net452\MaterialDesignColors.dll</HintPath>
+    </Reference>
+    <Reference Include="MaterialDesignThemes.Wpf, Version=4.1.0.2556, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MaterialDesignThemes.4.1.0\lib\net452\MaterialDesignThemes.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Compile Include="SystemAdminWindow.xaml.cs">
+      <DependentUpon>SystemAdminWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Osnova.xaml.cs">
+      <DependentUpon>Osnova.xaml</DependentUpon>
+    </Compile>
+    <Page Include="MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="SystemAdminWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Osnova.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\logo.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\dialog.png" />
+    <Resource Include="Image\person.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\oboryd.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\kabinet.png" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets'))" />
+  </Target>
+</Project>

+ 31 - 0
Inventory/MainWindow.xaml

@@ -0,0 +1,31 @@
+<Window x:Class="Inventory.MainWindow"
+        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:Inventory"
+        mc:Ignorable="d"
+        Title="MainWindow" WindowStartupLocation="CenterScreen" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" Height="450" Width="350" Icon="Image/logo.png">
+    <Grid MouseDown="Grid_MouseDown" KeyDown="Grid_KeyDown" >
+        <Border BorderThickness="0" Background="#516DF6" CornerRadius="35"/>
+        <Border BorderThickness="0" Background="#F6F8FC" CornerRadius="35" Margin="10,181,10,10"/>
+        <Image Source="Image/logo.png" Margin="82,0,86,300"/>
+        <Label Content="Инвентаризация" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="24" Foreground="#F6F8FC" Width="210" Margin="70,137,70,275"/>
+        <StackPanel Orientation="Vertical" Margin="50,212,46,42">
+            <Label Content="Авторизация" HorizontalAlignment="Center" FontWeight="Bold" Margin="0,0,0,0" FontFamily="Century Gothic" FontSize="20"/>
+            <StackPanel Orientation="Horizontal" Margin="0,15,0,0">
+                <materialDesign:PackIcon Margin="0,0,0,0" Kind="User" Height="35" Width="35"/>
+                <TextBox x:Name="logintxt" Margin="5,0,0,0" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Введите логин" materialDesign:TextFieldAssist.UnderlineBrush="Black" FontSize="18" MaxLength="15" Width="214" TextChanged="Logintxt_TextChanged"/>
+            </StackPanel>
+            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                <materialDesign:PackIcon Margin="0,0,0,0" Kind="Password" Height="35" Width="35"/>
+                <PasswordBox x:Name="passwordpsw" Margin="5,0,0,0" FontFamily="Century Gothic" materialDesign:TextFieldAssist.UnderlineBrush="Black" Foreground="Black" materialDesign:HintAssist.Hint="Введите пароль" FontSize="18" MaxLength="15" Width="214" PreviewKeyDown="Passwordpsw_PreviewKeyDown" PreviewTextInput="Passwordpsw_PreviewTextInput"/>
+            </StackPanel>
+            <Button x:Name="Vhod" Margin="0,25,0,0" materialDesign:ButtonAssist.CornerRadius="10" HorizontalAlignment="Center" FontSize="18" Background="#516DF6" BorderThickness="0" FontFamily="Century Gothic" Content="Войти" Height="31" Width="111" Click="Vhod_Click"/>
+        </StackPanel>
+        <Button x:Name="Exit" Style="{StaticResource MaterialDesignFloatingActionButton}" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Margin="299,10,10,396" Height="Auto" Width="Auto" Click="Exit_Click">
+            <materialDesign:PackIcon BorderThickness="0" Kind="ExitToApp" Foreground="#F6F8FC" Height="30" Width="30" materialDesign:RippleAssist.Feedback="Transparent"/>
+        </Button>
+    </Grid>
+</Window>

+ 138 - 0
Inventory/MainWindow.xaml.cs

@@ -0,0 +1,138 @@
+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.Data.SqlClient;
+using System.Data;
+using System.Windows.Shapes;
+using System.Text.RegularExpressions;
+
+namespace Inventory
+{
+    /// <summary>
+    /// Логика взаимодействия для MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+        }
+
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=Inventory;Integrated Security=True");
+
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            try
+            {
+                DragMove();
+            }
+            catch
+            {
+            }
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        public void vhod()
+        {
+            if (logintxt.Text == "" || passwordpsw.Password == "")
+            {
+                MessageBox.Show("Пустые поля!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    SqlCommand cmd = new SqlCommand("SELECT * FROM [User] WHERE Login = '" + logintxt.Text + "' and Password = '" + passwordpsw.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)
+                    {
+                        string idrole = dataSet.Tables[0].Rows[0]["ID_Role"].ToString();
+                        if (idrole.ToString() == "1")
+                        {
+                            con.Close();
+                            Osnova osnova = new Osnova();
+                            osnova.Show();
+                            this.Close();
+                        }
+                        else
+                        {
+                            con.Close();
+                            SystemAdminWindow system = new SystemAdminWindow();
+                            system.Show();
+                            this.Close();
+                        }
+                    }
+                    else
+                    {
+                        con.Close();
+                        logintxt.Text = "";
+                        passwordpsw.Password = "";
+                        MessageBox.Show("Неправильный логин/пароль!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                    con.Close();
+                }
+            }
+        }
+
+        private void Vhod_Click(object sender, RoutedEventArgs e)
+        {
+            vhod();
+        }
+
+        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 Passwordpsw_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Space)
+            {
+                e.Handled = true;
+            }
+        }
+
+        private void Passwordpsw_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 Grid_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Enter)
+            {
+                vhod();
+            }
+        }
+    }
+}

+ 113 - 0
Inventory/Osnova.xaml

@@ -0,0 +1,113 @@
+<Window x:Class="Inventory.SystemAdminWindow"
+        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:Inventory"
+        mc:Ignorable="d"
+        Title="SystemAdminWindow"  WindowStartupLocation="CenterScreen" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" Icon="Image/logo.png" Height="600" Width="1000" Loaded="Window_Loaded">
+    <Grid MouseDown="Grid_MouseDown">
+        <Border BorderThickness="0" Background="#516DF6" CornerRadius="35"/>
+        <Border BorderThickness="0" Background="#F6F8FC" BorderBrush="Black" CornerRadius="35" Margin="16,86,694,54"/>
+        <Label Content="Инвентаризация" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="36" Foreground="#F6F8FC" Width="307" Margin="117,16,576,538" Height="46"/>
+        <Grid Margin="16,120,694,237">
+            <StackPanel Orientation="Vertical" VerticalAlignment="Top" Margin="0,0,0,-175" Height="275">
+                <Button Uid="0" Content="Главная" FontFamily="Century Gothic" materialDesign:RippleAssist.Feedback="#516DF6" Height="50" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black" Click="Button_Click" Margin="0,0,-0.4,0"/>
+                <Button Uid="1" Content="Кабинеты" FontFamily="Century Gothic" materialDesign:RippleAssist.Feedback="#516DF6" Height="50" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black" Click="Button_Click" Margin="0,0,-0.4,0"/>
+                <Button Uid="2" Content="Оборудование" FontFamily="Century Gothic" materialDesign:RippleAssist.Feedback="#516DF6" Height="50" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black" Click="Button_Click" Margin="0,0,-0.4,0"/>
+                <Button Uid="3" Content="Учёт" FontFamily="Century Gothic" materialDesign:RippleAssist.Feedback="#516DF6" Height="50" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black" Click="Button_Click" Margin="0,0,-0.4,0"/>
+                <Button Uid="4" Content="Настройки" FontFamily="Century Gothic" materialDesign:RippleAssist.Feedback="#516DF6" Height="50" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black" Click="Button_Click" Margin="0,0,-0.4,0"/>
+            </StackPanel>
+        </Grid>
+        <Grid x:Name="GridCursor" Width="8" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="298,120,0,0" RenderTransformOrigin="0.5,0.5" Height="50">
+        </Grid>
+        <Image Source="Image/logo.png" Margin="50,399,733,76"/>
+        <Button Content="{materialDesign:PackIcon Backburger, Size=50}" Background="Transparent" BorderThickness="0" Height="Auto" Margin="10,10,914,527" Click="Back"/>
+        <Button Content="{materialDesign:PackIcon ExitToApp, Size=50}" Background="Transparent" BorderThickness="0" Height="Auto" Margin="904,10,10,527" Click="Exit"/>
+        <Button Content="{materialDesign:PackIcon Kind=WindowMinimize, Size=50}" Background="Transparent" BorderThickness="0" Height="Auto" Margin="818,10,96,527" Click="Minimized"/>
+        <TextBlock Name="timetxt" HorizontalAlignment="Center" FontFamily="Century Gothic" Margin="517,23,210,0" TextWrapping="Wrap" Foreground="White" FontSize="28" VerticalAlignment="Top" Height="46" Width="273"/>
+
+        <Grid x:Name="gridglav" Visibility="Visible">
+            <Image HorizontalAlignment="Left" Height="299" Margin="398,230,0,0" Source="Image/person.png" VerticalAlignment="Top" Width="352"/>
+            <Image HorizontalAlignment="Left" Height="211" Margin="501,87,0,0" VerticalAlignment="Top" Width="284" Source="Image/dialog.png"/>
+            <Label Name="labelpriv" Foreground="Black" HorizontalContentAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Century Gothic" FontSize="15" Margin="501,140,215,424" Width="284" Height="36" FontWeight="Bold"/>
+        </Grid>
+        <Grid x:Name="gridoborot" Visibility="Hidden">
+            <TextBlock x:Name="idoborodtxt" Visibility="Hidden"/>
+            <Border Background="White" BorderThickness="0" BorderBrush="Black" CornerRadius="35" Margin="330,86,10,54"/>
+            <Label Content="Оборудование" HorizontalContentAlignment="Center" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="36" Foreground="Black" Width="307" Margin="515,96,178,458" Height="46"/>
+            <TextBox x:Name="oborydname" Margin="345,201,285,354" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Наименование оборудования" materialDesign:TextFieldAssist.UnderlineBrush="Black" FontSize="18" MaxLength="25" TextChanged="Rus_TextChanged" KeyDown="oborydname_KeyDown"/>
+            <Border Background="Black" Margin="330,181,10,418"/>
+            <TextBox x:Name="poiskoboryd" Margin="735,201,95,354" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Поиск" materialDesign:TextFieldAssist.UnderlineBrush="Black" MaxLength="25" FontSize="18" TextChanged="poiskoboryd_TextChanged"/>
+            <Image Source="Image/oboryd.png" Margin="356,284,270,30"/>
+            <StackPanel Margin="356,267,285,263" Orientation="Horizontal">
+                <Button x:Name="AddOborot" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="50,0,0,0" Click="Addoborod">
+                    <materialDesign:PackIcon Kind="Add" Width="30" Height="30"/>
+                </Button>
+                <Button x:Name="UpdateOborot" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0" Click="Updateoborod">
+                    <materialDesign:PackIcon Kind="Edit"  Width="30" Height="30" />
+                </Button>
+                <Button x:Name="DeleteOborot" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0" Click="Deleteoborod">
+                    <materialDesign:PackIcon Kind="Delete"  Width="30" Height="30" />
+                </Button>
+            </StackPanel>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" Margin="926,201,26,351" materialDesign:RippleAssist.Feedback="#516DF6" Click="Refreshoborod">
+                <materialDesign:PackIcon Kind="Refresh" Height="30" Width="30"/>
+            </Button>
+            <DataGrid Name="dataoborod" HorizontalAlignment="Left" IsReadOnly="True" BorderThickness="1" BorderBrush="Black" Height="241" Margin="735,267,0,0" VerticalAlignment="Top" Width="239" SelectionChanged="dataoborod_SelectionChanged"/>
+        </Grid>
+
+        <Grid x:Name="gridkabinet" Visibility="Hidden">
+            <TextBlock x:Name="idkabinettxt" Visibility="Hidden"/>
+            <Border Background="White" BorderThickness="0" BorderBrush="Black" CornerRadius="35" Margin="330,86,10,54"/>
+            <Label Content="Кабинеты" HorizontalContentAlignment="Center" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="36" Foreground="Black" Width="307" Margin="515,96,178,458" Height="46"/>
+            <Border Background="Black" Margin="330,181,10,418"/>
+            <TextBox x:Name="kabinetname" Margin="345,201,285,354" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Наименование кабинета" materialDesign:TextFieldAssist.UnderlineBrush="Black" FontSize="18" MaxLength="25" TextChanged="Rus_TextChanged" KeyDown="kabinetname_KeyDown"/>
+            <TextBox x:Name="poiskabinet" Margin="735,201,95,354" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Поиск" materialDesign:TextFieldAssist.UnderlineBrush="Black" MaxLength="25" FontSize="18" TextChanged="poiskabinet_TextChanged"/>
+            <Image Source="Image/kabinet.png" Margin="373,321,324,54"/>
+            <StackPanel Margin="356,267,285,263" Orientation="Horizontal">
+                <Button x:Name="AddKabinet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="50,0,0,0" Click="AddKabinet_Click">
+                    <materialDesign:PackIcon Kind="Add" Width="30" Height="30"/>
+                </Button>
+                <Button x:Name="UpdateKabinet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0" Click="UpdateKabinet_Click">
+                    <materialDesign:PackIcon Kind="Edit"  Width="30" Height="30" />
+                </Button>
+                <Button x:Name="DeleteKabinet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0" Click="DeleteKabinet_Click">
+                    <materialDesign:PackIcon Kind="Delete"  Width="30" Height="30" />
+                </Button>
+            </StackPanel>
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" Margin="926,201,26,351" materialDesign:RippleAssist.Feedback="#516DF6" Click="RefreshKabinet">
+                <materialDesign:PackIcon Kind="Refresh" Height="30" Width="30"/>
+            </Button>
+            <DataGrid Name="datakabinet" HorizontalAlignment="Left" IsReadOnly="True" BorderThickness="1" BorderBrush="Black" Height="241" Margin="735,267,0,0" VerticalAlignment="Top" Width="239" SelectionChanged="datakabinet_SelectionChanged"/>
+        </Grid>
+
+        <Grid Name="gridychet" Visibility="Hidden">
+            <TextBlock x:Name="idychettxt" Visibility="Hidden"/>
+            <Border Background="White" BorderThickness="0" BorderBrush="Black" CornerRadius="35" Margin="330,86,10,54"/>
+            <Label Content="Учёт" HorizontalContentAlignment="Center" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="36" Foreground="Black" Width="307" Margin="515,96,178,458" Height="46"/>
+            <Label Content="Сортировать по:" HorizontalContentAlignment="Left" HorizontalAlignment="Center" FontFamily="Century Gothic" VerticalAlignment="Center" FontSize="24" Foreground="Black" Width="207" Margin="348,216,445,338" Height="46"/>
+            <Border Background="Black" Margin="330,267,10,332"/>
+            <ComboBox Name="combocabinet" Margin="348,281,377,283" Height="36" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Кабинет" FontSize="18" materialDesign:TextFieldAssist.UnderlineBrush="Black"/>
+            <ComboBox Name="combooboryd" Margin="348,335,377,229" Height="36" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Оборудование" FontSize="18" materialDesign:TextFieldAssist.UnderlineBrush="Black"/>
+            <TextBox x:Name="kolvoychet" Margin="348,390,377,165" FontFamily="Century Gothic" Foreground="Black" materialDesign:HintAssist.Hint="Количество оборудования" materialDesign:TextFieldAssist.UnderlineBrush="Black" FontSize="18" MaxLength="5"/>
+            <StackPanel Margin="348,447,377,83" Orientation="Horizontal">
+                <Button x:Name="Addychet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="20,0,0,0">
+                    <materialDesign:PackIcon Kind="Add" Width="30" Height="30"/>
+                </Button>
+                <Button x:Name="Updateychet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0">
+                    <materialDesign:PackIcon Kind="Edit"  Width="30" Height="30" />
+                </Button>
+                <Button x:Name="Deleteychet" Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" materialDesign:RippleAssist.Feedback="#516DF6" Margin="45,0,0,0">
+                    <materialDesign:PackIcon Kind="Delete"  Width="30" Height="30" />
+                </Button>
+            </StackPanel>
+
+            <Button Style="{StaticResource MaterialDesignIconButton}" Foreground="Black" Margin="926,201,26,351" materialDesign:RippleAssist.Feedback="#516DF6">
+                <materialDesign:PackIcon Kind="Refresh" Height="30" Width="30"/>
+            </Button>
+            <DataGrid Name="dataychet" HorizontalAlignment="Left" IsReadOnly="True" BorderThickness="1" BorderBrush="Black" Height="252" Margin="632,281,0,0" VerticalAlignment="Top" Width="346" SelectionChanged="datakabinet_SelectionChanged"/>
+        </Grid>
+    </Grid>
+</Window>

+ 645 - 0
Inventory/Osnova.xaml.cs

@@ -0,0 +1,645 @@
+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 Inventory
+{
+    /// <summary>
+    /// Логика взаимодействия для SystemAdminWindow.xaml
+    /// </summary>
+    public partial class SystemAdminWindow : Window
+    {
+        public SystemAdminWindow()
+        {
+            InitializeComponent();
+        }
+
+        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=Inventory;Integrated Security=True");
+
+        public void time()
+        {
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Tick += new EventHandler(Update_Timer_Tick);
+            timer.Interval = new TimeSpan(0, 0, 1);
+            timer.Start();
+        }
+
+        void privet()
+        {
+            string[] randoms = new string[5];
+            randoms[0] = "Привет!";
+            randoms[1] = "Как дела?";
+            randoms[2] = "Давно не виделись!";
+            randoms[3] = "Здравствуй!";
+            randoms[4] = "Добро пожаловать!";
+            Random r = new Random();
+            string randsror = randoms[r.Next(0, randoms.Length - 1)];
+            labelpriv.Content = randsror.ToString();
+        }
+
+        private void Update_Timer_Tick(object sender, EventArgs e)
+        {
+            timetxt.Text = DateTime.Now.ToString();
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            int index = int.Parse(((Button)e.Source).Uid);
+
+            GridCursor.Margin = new Thickness(298, 120 + (50 * index), 0, 0);
+
+
+            switch (index)
+            {
+                case 0:
+                    gridglav.Visibility = Visibility.Visible;
+                    gridoborot.Visibility = Visibility.Hidden;
+                    gridkabinet.Visibility = Visibility.Hidden;
+                    gridychet.Visibility = Visibility.Hidden;
+                    GridCursor.Margin = new Thickness(298, 120 + (50 * 0), 0, 0);
+                    privet();
+                    break;
+                case 1:
+                    if (gridkabinet.Visibility == Visibility.Visible)
+                    {
+                        gridkabinet.Visibility = Visibility.Hidden;
+                        gridoborot.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Visible;
+                        privet();
+                        GridCursor.Margin = new Thickness(298, 120 + (50 * 0), 0, 0);
+                    }
+                    else
+                    {
+                        gridkabinet.Visibility = Visibility.Visible;
+                        gridychet.Visibility = Visibility.Hidden;
+                        gridoborot.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Hidden;
+                    }
+                    break;
+                case 2:             
+                    if (gridoborot.Visibility == Visibility.Visible)
+                    {
+                        gridoborot.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Visible;
+                        privet();
+                        GridCursor.Margin = new Thickness(298, 120 + (50 * 0), 0, 0);
+                    }
+                    else
+                    {
+                        gridoborot.Visibility = Visibility.Visible;
+                        gridychet.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Hidden;
+                        gridkabinet.Visibility = Visibility.Hidden;
+                    }
+                    break;
+                case 3:
+                    if (gridychet.Visibility == Visibility.Visible)
+                    {
+                        gridychet.Visibility = Visibility.Hidden;
+                        gridoborot.Visibility = Visibility.Hidden;
+                        gridkabinet.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Visible;
+                        privet();
+                        GridCursor.Margin = new Thickness(298, 120 + (50 * 0), 0, 0);
+                    }
+                    else
+                    {
+                        gridychet.Visibility = Visibility.Visible;
+                        gridoborot.Visibility = Visibility.Hidden;
+                        gridglav.Visibility = Visibility.Hidden;
+                        gridkabinet.Visibility = Visibility.Hidden;
+                    }
+                    break;
+            }
+        }
+
+        private void Back(object sender, RoutedEventArgs e)
+        {
+            MainWindow mainWindow = new MainWindow();
+            mainWindow.Show();
+            this.Close();
+        }
+
+        private void Exit(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        private void Minimized(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
+
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            try
+            {
+                DragMove();
+            }
+            catch
+            {
+            }
+        }
+
+        private void Window_Loaded(object sender, RoutedEventArgs e)
+        {
+            time();
+            privet();
+            showdatagridoborod();
+            showdatagridkabinet();
+            showdatagridrecord();
+            fillcombocabinet();
+            fillcombooboryd();
+        }
+
+        public void showdatagridoborod()
+        {
+            try
+            {
+                con.Open();
+                string sql = "SELECT * FROM Equipment";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                DataTable data = new DataTable("Equipment");
+                dataAdapter.Fill(data);
+                dataoborod.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                dataoborod.Columns[1].Header = "Наименование оборудования";
+                dataoborod.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        public void addoborod()
+        {
+            if (oborydname.Text == "")
+            {
+                MessageBox.Show("Заполните поле наименования оборудования!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "INSERT INTO Equipment (EquipmentName) VALUES('" + oborydname.Text + "')";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreshoborod();
+                    fillcombooboryd();
+                    MessageBox.Show("Оборудование добавлено!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Addoborod(object sender, RoutedEventArgs e)
+        {
+            addoborod();
+        }
+
+        private void Updateoborod(object sender, RoutedEventArgs e)
+        {
+            if (idoborodtxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else if (oborydname.Text == "")
+            {
+                MessageBox.Show("Заполните поле наименования оборудования!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "Update Equipment set EquipmentName ='" + oborydname.Text + "' WHERE ID_Equipment = '" + idoborodtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreshoborod();
+                    fillcombooboryd();
+                    MessageBox.Show("Наименование оборудования обновлено!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Deleteoborod(object sender, RoutedEventArgs e)
+        {
+            if (idoborodtxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Equipment WHERE ID_Equipment = '" + idoborodtxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreshoborod();
+                    fillcombooboryd();
+                    MessageBox.Show("Оборудование удалено!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        public void refreshoborod()
+        {
+            poiskoboryd.Text = "";
+            oborydname.Text = "";
+            idoborodtxt.Text = "";
+            showdatagridoborod();
+        }
+
+        private void Refreshoborod(object sender, RoutedEventArgs e)
+        {
+            refreshoborod();
+        }
+
+        private void dataoborod_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            try
+            {
+                DataGrid gd = (DataGrid)sender;
+                DataRowView rowView = gd.SelectedItem as DataRowView;
+                if (rowView != null)
+                {
+                    idoborodtxt.Text = rowView["ID_Equipment"].ToString();
+                    oborydname.Text = rowView["EquipmentName"].ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void poiskoboryd_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (poiskoboryd.Text == "")
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "SELECT * FROM Equipment";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    DataTable data = new DataTable("Equipment");
+                    dataAdapter.Fill(data);
+                    dataoborod.ItemsSource = data.DefaultView;
+                    dataAdapter.Update(data);
+                    con.Close();
+                    dataoborod.Columns[1].Header = "Наименование оборудования";
+                    dataoborod.Columns[0].Visibility = Visibility.Collapsed;
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+            else if (sender is TextBox textBox)
+            {
+                try
+                {
+                    textBox.Text = new string
+                  (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я') || (ch >= ' ')).ToArray());
+                    con.Open();
+                    string sql = "SELECT * FROM Equipment WHERE EquipmentName Like '"+poiskoboryd.Text+"%'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    DataTable data = new DataTable("Equipment");
+                    dataAdapter.Fill(data);
+                    dataoborod.ItemsSource = data.DefaultView;
+                    dataAdapter.Update(data);
+                    con.Close();
+                    dataoborod.Columns[1].Header = "Наименование оборудования";
+                    dataoborod.Columns[0].Visibility = Visibility.Collapsed;
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void Rus_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (sender is TextBox textBox)
+            {
+                textBox.Text = new string
+                 (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я') || (ch >= ' ' && ch <= ' ') || (ch >= '0' && ch <= '9') || (ch >= '№' && ch <= '№')).ToArray());
+            }
+        }
+
+        private void oborydname_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Enter)
+            {
+                addoborod();
+            }    
+        }
+
+        public void showdatagridkabinet()
+        {
+            try
+            {
+                con.Open();
+                string sql = "SELECT * FROM Cabinet";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                DataTable data = new DataTable("Cabinet");
+                dataAdapter.Fill(data);
+                datakabinet.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                datakabinet.Columns[1].Header = "Наименование кабинета";
+                datakabinet.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        public void addKabinet()
+        {
+            if (kabinetname.Text == "")
+            {
+                MessageBox.Show("Заполните поле наименования оборудования!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "INSERT INTO Cabinet (CabinetName) VALUES('" + kabinetname.Text + "')";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreskabinet();
+                    fillcombocabinet();
+                    MessageBox.Show("Кабинет добавлен!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void poiskabinet_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (poiskabinet.Text == "")
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "SELECT * FROM Cabinet";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    DataTable data = new DataTable("Cabinet");
+                    dataAdapter.Fill(data);
+                    datakabinet.ItemsSource = data.DefaultView;
+                    dataAdapter.Update(data);
+                    con.Close();
+                    datakabinet.Columns[1].Header = "Наименование кабинета";
+                    datakabinet.Columns[0].Visibility = Visibility.Collapsed;
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+            else if (sender is TextBox textBox)
+            {
+                try
+                {
+                    textBox.Text = new string
+                  (textBox.Text.Where(ch => (ch >= 'А' && ch <= 'Я') || (ch >= 'а' && ch <= 'я') || (ch >= ' ')).ToArray());
+                    con.Open();
+                    string sql = "SELECT * FROM Cabinet WHERE CabinetName Like '" + poiskabinet.Text + "%'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    DataTable data = new DataTable("Cabinet");
+                    dataAdapter.Fill(data);
+                    datakabinet.ItemsSource = data.DefaultView;
+                    dataAdapter.Update(data);
+                    con.Close();
+                    datakabinet.Columns[1].Header = "Наименование кабинета";
+                    datakabinet.Columns[0].Visibility = Visibility.Collapsed;
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void kabinetname_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Enter)
+            {
+                addKabinet();
+            }
+        }
+
+        private void RefreshKabinet(object sender, RoutedEventArgs e)
+        {
+            refreskabinet();
+        }
+
+        public void refreskabinet()
+        {
+            poiskabinet.Text = "";
+            kabinetname.Text = "";
+            idkabinettxt.Text = "";
+            showdatagridkabinet();
+        }
+
+        private void AddKabinet_Click(object sender, RoutedEventArgs e)
+        {
+            addKabinet();
+        }
+
+        private void UpdateKabinet_Click(object sender, RoutedEventArgs e)
+        {
+            if (idkabinettxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else if (kabinetname.Text == "")
+            {
+                MessageBox.Show("Заполните поле наименования кабинета!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "Update Cabinet set CabinetName ='" + kabinetname.Text + "' WHERE ID_Cabinet = '" + idkabinettxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreskabinet();
+                    fillcombocabinet();
+                    MessageBox.Show("Наименование кабинета обновлено!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void DeleteKabinet_Click(object sender, RoutedEventArgs e)
+        {
+            if (idkabinettxt.Text == "")
+            {
+                MessageBox.Show("Поле не выбрано! Выберите нужное поле!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+            else
+            {
+                try
+                {
+                    con.Open();
+                    string sql = "DELETE FROM Cabinet WHERE ID_Cabinet = '" + idkabinettxt.Text + "'";
+                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                    dataAdapter.SelectCommand.ExecuteNonQuery();
+                    con.Close();
+                    refreskabinet();
+                    fillcombocabinet();
+                    MessageBox.Show("Кабинет удален!", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                catch (Exception ex)
+                {
+                    con.Close();
+                    MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+        }
+
+        private void datakabinet_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            try
+            {
+                DataGrid gd = (DataGrid)sender;
+                DataRowView rowView = gd.SelectedItem as DataRowView;
+                if (rowView != null)
+                {
+                    idkabinettxt.Text = rowView["ID_Cabinet"].ToString();
+                    kabinetname.Text = rowView["CabinetName"].ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Возникла ошибка! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+
+        public void fillcombocabinet()
+        {
+            try
+            {
+                combocabinet.Items.Clear();
+                con.Open();
+                SqlCommand sql = con.CreateCommand();
+                sql.CommandType = CommandType.Text;
+                sql.CommandText = "Select CabinetName from Cabinet";
+                sql.ExecuteNonQuery();
+                DataTable dt = new DataTable();
+                SqlDataAdapter da = new SqlDataAdapter(sql);
+                da.Fill(dt);
+                foreach (DataRow dr in dt.Rows)
+                {
+                    combocabinet.Items.Add(dr["CabinetName"].ToString());
+                }
+                con.Close();
+            }
+            catch (Exception ex)
+            {
+                con.Close();
+                MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        public void fillcombooboryd()
+        {
+            try
+            {
+                combooboryd.Items.Clear();
+                con.Open();
+                SqlCommand sql = con.CreateCommand();
+                sql.CommandType = CommandType.Text;
+                sql.CommandText = "Select EquipmentName from Equipment";
+                sql.ExecuteNonQuery();
+                DataTable dt = new DataTable();
+                SqlDataAdapter da = new SqlDataAdapter(sql);
+                da.Fill(dt);
+                foreach (DataRow dr in dt.Rows)
+                {
+                    combooboryd.Items.Add(dr["EquipmentName"].ToString());
+                }
+                con.Close();
+            }
+            catch (Exception ex)
+            {
+                con.Close();
+                MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        public void showdatagridrecord()
+        {
+            try
+            {
+                con.Open();
+                string sql = "SELECT ID_Record,Cabinet.CabinetName,Equipment.EquipmentName,Record.Quantity FROM Record inner join Cabinet on Record.ID_Cabinet = Cabinet.ID_Cabinet inner join Equipment on Record.ID_Equipment = Equipment.ID_Equipment";
+                SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, con);
+                DataTable data = new DataTable("Record");
+                dataAdapter.Fill(data);
+                dataychet.ItemsSource = data.DefaultView;
+                dataAdapter.Update(data);
+                con.Close();
+                dataychet.Columns[1].Header = "Наименование кабинета";
+                dataychet.Columns[2].Header = "Наименование оборудования";
+                dataychet.Columns[3].Header = "Количество";
+                dataychet.Columns[0].Visibility = Visibility.Collapsed;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("Ошибка с подключением к БД! " + ex.ToString(), "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+    }
+}

+ 55 - 0
Inventory/Properties/AssemblyInfo.cs

@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
+// связанные со сборкой.
+[assembly: AssemblyTitle("Inventory")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Inventory")]
+[assembly: AssemblyCopyright("Copyright ©  2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM, установите атрибут ComVisible для этого типа в значение true.
+[assembly: ComVisible(false)]
+
+//Чтобы начать создание локализуемых приложений, задайте
+//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
+//в <PropertyGroup>. Например, при использовании английского (США)
+//в своих исходных файлах установите <UICulture> в en-US.  Затем отмените преобразование в комментарий
+//атрибута NeutralResourceLanguage ниже.  Обновите "en-US" в
+//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
+                                     //(используется, если ресурс не найден на странице,
+                                     // или в словарях ресурсов приложения)
+    ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
+                                              //(используется, если ресурс не найден на странице,
+                                              // в приложении или в каких-либо словарях ресурсов для конкретной темы)
+)]
+
+
+// Сведения о версии для сборки включают четыре следующих значения:
+//
+//      Основной номер версии
+//      Дополнительный номер версии
+//      Номер сборки
+//      Номер редакции
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию 
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
Inventory/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код был создан программным средством.
+//     Версия среды выполнения: 4.0.30319.42000
+//
+//     Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
+//     код создан повторно.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Inventory.Properties
+{
+
+
+    /// <summary>
+    ///   Класс ресурсов со строгим типом для поиска локализованных строк и пр.
+    /// </summary>
+    // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
+    // класс с помощью таких средств, как ResGen или Visual Studio.
+    // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
+    // с параметром /str или заново постройте свой VS-проект.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Inventory.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   Переопределяет свойство CurrentUICulture текущего потока для всех
+        ///   подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
Inventory/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
Inventory/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Inventory.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
Inventory/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 12 - 0
Inventory/SystemAdminWindow.xaml

@@ -0,0 +1,12 @@
+<Window x:Class="Inventory.Osnova"
+        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:Inventory"
+        mc:Ignorable="d"
+        Title="Osnova" Height="450" Width="800">
+    <Grid>
+        
+    </Grid>
+</Window>

+ 27 - 0
Inventory/SystemAdminWindow.xaml.cs

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

+ 5 - 0
Inventory/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MaterialDesignColors" version="2.0.1" targetFramework="net472" />
+  <package id="MaterialDesignThemes" version="4.1.0" targetFramework="net472" />
+</packages>