This commit is contained in:
oreshki
2026-04-08 17:48:19 +05:00
parent 7e83e56be6
commit 28197714d5
14 changed files with 241 additions and 21 deletions

View File

@@ -103,6 +103,9 @@
<Compile Include="Models\Invoice.cs">
<DependentUpon>Model1.tt</DependentUpon>
</Compile>
<Compile Include="ViewModels\ByhalterModel.cs" />
<Compile Include="ViewModels\Laborant.cs" />
<Compile Include="ViewModels\LaborantExplorer.cs" />
<Compile Include="ViewModels\LoginViewModel.cs" />
<Compile Include="Models\Model1.Context.cs">
<AutoGen>True</AutoGen>
@@ -150,9 +153,22 @@
<Compile Include="Models\User.cs">
<DependentUpon>Model1.tt</DependentUpon>
</Compile>
<Compile Include="Views\SessionWindow.xaml.cs">
<DependentUpon>SessionWindow.xaml</DependentUpon>
</Compile>
<Page Include="Views\AdminWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ByhalterWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\LaborantExplorer.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\LaborantWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -161,15 +177,23 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="ViewModels\SessionModel.cs" />
<Compile Include="ViewModels\AdminModel.cs" />
<Compile Include="Views\AdminWindow.xaml.cs">
<DependentUpon>AdminWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ByhalterWindow.xaml.cs">
<DependentUpon>ByhalterWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\LaborantExplorer.xaml.cs">
<DependentUpon>LaborantExplorer.xaml</DependentUpon>
</Compile>
<Compile Include="Views\LaborantWindow.xaml.cs">
<DependentUpon>LaborantWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\SessionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">

View File

@@ -10,11 +10,11 @@ using Wpf.Ui.Input;
namespace Labaratory.ViewModels
{
public class SessionModel : BaseViewModel
public class AdminModel : BaseViewModel
{
public Models.User CurrentUser { get; set; }
public SessionModel(Models.User user)
public AdminModel(Models.User user)
{
CurrentUser = user;
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Labaratory.ViewModels
{
public class ByhalterModel : BaseViewModel
{
public Models.User CurrentUser { get; set; }
public ByhalterModel(Models.User user)
{
CurrentUser = user;
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Labaratory.ViewModels
{
public class Laborant : BaseViewModel
{
public Models.User CurrentUser { get; set; }
public Laborant(Models.User user)
{
CurrentUser = user;
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Labaratory.ViewModels
{
public class LaborantExplorer : BaseViewModel
{
public Models.User CurrentUser { get; set; }
public LaborantExplorer(Models.User user)
{
CurrentUser = user;
}
}
}

View File

@@ -77,13 +77,38 @@ namespace Labaratory
MessageBox.Show($"Успешный вход! Добро пожаловать, {user.Login}");
if (parameter is Window window)
{
var nextWindow = new SessionWindow();
if (user.Role.Value == 1)
{
var nextWindow = new AdminWindow();
var mainVM = new SessionModel(user);
// Привязываем VM к окну
var mainVM = new AdminModel(user);
nextWindow.DataContext = mainVM;
nextWindow.Show();
}
if (user.Role.Value == 2)
{
var nextWindow = new ByhalterWindow();
var mainVM = new ByhalterModel(user);
nextWindow.DataContext = mainVM;
nextWindow.Show();
}
if (user.Role.Value == 3)
{
var nextWindow = new Views.Laborant();
var mainVM = new ViewModels.Laborant(user);
nextWindow.DataContext = mainVM;
nextWindow.Show();
}
if (user.Role.Value == 4)
{
var nextWindow = new Views.LaborantExplorer();
var mainVM = new ViewModels.LaborantExplorer(user);
nextWindow.DataContext = mainVM;
nextWindow.Show();
}
window.Close();
}
}

View File

@@ -1,11 +1,11 @@
<Window x:Class="Labaratory.Views.SessionWindow"
<Window x:Class="Labaratory.Views.AdminWindow"
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:Labaratory.Views"
mc:Ignorable="d"
Title="SessionWindow" Height="450" Width="800">
Title="AdminWindow" Height="450" Width="800">
<Grid>
</Grid>

View File

@@ -15,11 +15,11 @@ using System.Windows.Shapes;
namespace Labaratory.Views
{
/// <summary>
/// Логика взаимодействия для SessionWindow.xaml
/// Логика взаимодействия для AdminWindow.xaml
/// </summary>
public partial class SessionWindow : Window
public partial class AdminWindow : Window
{
public SessionWindow()
public AdminWindow()
{
InitializeComponent();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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