Первое переключение между экранами.
This commit is contained in:
parent
09714b4501
commit
1303ba8d80
53
App.xaml
53
App.xaml
@ -12,10 +12,10 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<!-- Тень кнопки -->
|
<!-- Тень кнопки -->
|
||||||
<Border Background="{TemplateBinding Background}"
|
<Border Background="{TemplateBinding Background}"
|
||||||
CornerRadius="15"
|
CornerRadius="15"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
x:Name="ButtonBorder">
|
x:Name="ButtonBorder">
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect Color="Black" BlurRadius="10" ShadowDepth="2" Opacity="0.4" />
|
<DropShadowEffect Color="Black" BlurRadius="10" ShadowDepth="2" Opacity="0.4" />
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
@ -29,8 +29,8 @@
|
|||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
||||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||||
To="#0066CC" Duration="0:0:0.2" />
|
To="#0066CC" Duration="0:0:0.2" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</Trigger.EnterActions>
|
</Trigger.EnterActions>
|
||||||
@ -38,8 +38,8 @@
|
|||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
||||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||||
To="#004890" Duration="0:0:0.2" />
|
To="#004890" Duration="0:0:0.2" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</Trigger.ExitActions>
|
</Trigger.ExitActions>
|
||||||
@ -63,5 +63,42 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Стиль для закругленного TextBox -->
|
||||||
|
<Style x:Key="RoundedTextBoxStyle" TargetType="TextBox">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TextBox">
|
||||||
|
<Border Background="White"
|
||||||
|
CornerRadius="15"
|
||||||
|
BorderBrush="Gray"
|
||||||
|
BorderThickness="1">
|
||||||
|
<ScrollViewer Margin="5" x:Name="PART_ContentHost"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Стиль для закругленного ComboBox -->
|
||||||
|
<Style x:Key="RoundedComboBoxStyle" TargetType="ComboBox">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBox">
|
||||||
|
<Border Background="White"
|
||||||
|
CornerRadius="15"
|
||||||
|
BorderBrush="Gray"
|
||||||
|
BorderThickness="1">
|
||||||
|
<Grid>
|
||||||
|
<ToggleButton Grid.Column="2" Focusable="False"
|
||||||
|
ClickMode="Press" />
|
||||||
|
<ContentPresenter />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
2
Migrations/20241126112638_InitDB.Designer.cs
generated
2
Migrations/20241126112638_InitDB.Designer.cs
generated
@ -1,6 +1,6 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using EmployeeManager.Data;
|
using EmployeeManager.Model.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using EmployeeManager.Data;
|
using EmployeeManager.Model.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using EmployeeManager.Model;
|
using EmployeeManager.Model;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace EmployeeManager.Data
|
namespace EmployeeManager.Model.Data
|
||||||
{
|
{
|
||||||
public class ApplicationConext : DbContext
|
public class ApplicationConext : DbContext
|
||||||
{
|
{
|
@ -1,12 +1,113 @@
|
|||||||
using System;
|
using EmployeeManager.Model.Data;
|
||||||
using System.Collections.Generic;
|
using System.Data.Common;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EmployeeManager.Model
|
namespace EmployeeManager.Model
|
||||||
{
|
{
|
||||||
public static class DataWorker
|
public static class DataWorker
|
||||||
{
|
{
|
||||||
|
public static string CreatePhysicalPerson(string namePhysicalPersons, string surnamePhysicalPersons, string patronomicPhysicalPersons, DateTime birthday, string gender, string address, string telephone)
|
||||||
|
{
|
||||||
|
string result = "Возникла ошибка. Обратитесь в ЛАОД.";
|
||||||
|
|
||||||
|
using(ApplicationConext db = new ApplicationConext())
|
||||||
|
{
|
||||||
|
bool checkIsExist = db.PhysicalPersons.Any(
|
||||||
|
e => e.NamePhysicalPersons == namePhysicalPersons
|
||||||
|
&& e.SurnamePhysicalPersons == surnamePhysicalPersons
|
||||||
|
&& e.PatronomicPhysicalPersons == patronomicPhysicalPersons
|
||||||
|
&& e.Birthday == birthday
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!checkIsExist)
|
||||||
|
{
|
||||||
|
PhysicalPerson newPhysicalPerson = new PhysicalPerson
|
||||||
|
{
|
||||||
|
NamePhysicalPersons = namePhysicalPersons,
|
||||||
|
SurnamePhysicalPersons = surnamePhysicalPersons,
|
||||||
|
PatronomicPhysicalPersons = patronomicPhysicalPersons,
|
||||||
|
Birthday = birthday,
|
||||||
|
Gender = gender,
|
||||||
|
Address = address,
|
||||||
|
Telephone = telephone
|
||||||
|
};
|
||||||
|
db.PhysicalPersons.Add(newPhysicalPerson);
|
||||||
|
db.SaveChanges();
|
||||||
|
result = "Физическое лицо добавлено.";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string CreateEmployee(string nameJob, DateTime startJob, DateTime? endJob, string? partTimeJob, float bid, PhysicalPerson? physicalPersons)
|
||||||
|
{
|
||||||
|
string result = "Возникла ошибка. Обратитесь в ЛАОД.";
|
||||||
|
|
||||||
|
using (ApplicationConext db = new ApplicationConext())
|
||||||
|
{
|
||||||
|
|
||||||
|
Employee newEmployee = new Employee
|
||||||
|
{
|
||||||
|
NameJob = nameJob,
|
||||||
|
StartJob = startJob,
|
||||||
|
EndJob = endJob,
|
||||||
|
PartTimeJob = partTimeJob,
|
||||||
|
Bid = bid,
|
||||||
|
PhysicalPersonsId = physicalPersons.Id
|
||||||
|
|
||||||
|
};
|
||||||
|
db.Employees.Add(newEmployee);
|
||||||
|
db.SaveChanges();
|
||||||
|
result = "Работник добавлен.";
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string DeletePhysicalPerson(PhysicalPerson physicalPerson)
|
||||||
|
{
|
||||||
|
string result = "Возникла ошибка. Обратитесь в ЛАОД.";
|
||||||
|
|
||||||
|
using(ApplicationConext db = new ApplicationConext())
|
||||||
|
{
|
||||||
|
db.PhysicalPersons.Remove(physicalPerson);
|
||||||
|
db.SaveChanges();
|
||||||
|
result = "Физическое лицо удалено.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string EditPhysicalPerson(PhysicalPerson oldPhysicalPerson, string newNamePhysicalPersons, string newSurnamePhysicalPersons, string newPatronomicPhysicalPersons, DateTime newBirthday, string newGender, string newAddress, string newTelephone)
|
||||||
|
{
|
||||||
|
string result = "Возникла ошибка. Обратитесь в ЛАОД.";
|
||||||
|
|
||||||
|
using (ApplicationConext db = new ApplicationConext())
|
||||||
|
{
|
||||||
|
PhysicalPerson physicalPerson = db.PhysicalPersons.FirstOrDefault(e => e.Id == oldPhysicalPerson.Id);
|
||||||
|
|
||||||
|
physicalPerson.SurnamePhysicalPersons = newSurnamePhysicalPersons;
|
||||||
|
physicalPerson.NamePhysicalPersons = newNamePhysicalPersons;
|
||||||
|
physicalPerson.PatronomicPhysicalPersons = newPatronomicPhysicalPersons;
|
||||||
|
physicalPerson.Birthday = newBirthday;
|
||||||
|
physicalPerson.Gender = newGender;
|
||||||
|
physicalPerson.Address = newAddress;
|
||||||
|
physicalPerson.Telephone = newTelephone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<PhysicalPerson> GetAllPhysicalPerson()
|
||||||
|
{
|
||||||
|
using (ApplicationConext db = new ApplicationConext())
|
||||||
|
{
|
||||||
|
var result = db.PhysicalPersons.ToList();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
35
Model/RelayCommand.cs
Normal file
35
Model/RelayCommand.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace EmployeeManager.Model
|
||||||
|
{
|
||||||
|
public class RelayCommand : ICommand
|
||||||
|
{
|
||||||
|
private Action<object> _execute;
|
||||||
|
private Func<object, bool> _canExecute;
|
||||||
|
public event EventHandler CanExecuteChanged
|
||||||
|
{
|
||||||
|
add { CommandManager.RequerySuggested += value; }
|
||||||
|
remove { CommandManager.RequerySuggested -= value; }
|
||||||
|
}
|
||||||
|
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute;
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return _canExecute == null || _canExecute(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
_execute(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
<!-- Кнопка 1 -->
|
<!-- Кнопка 1 -->
|
||||||
<Button Content="Работа с сотрудниками" Width="200" Height="50" Margin="0,10"
|
<Button Content="Работа с сотрудниками" Width="200" Height="50" Margin="0,10"
|
||||||
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||||
Style="{StaticResource RoundedButtonStyle}"/>
|
Style="{StaticResource RoundedButtonStyle}" Command="{Binding OpenPhysicalPersoManagementWindow}"/>
|
||||||
<!-- Кнопка 2 -->
|
<!-- Кнопка 2 -->
|
||||||
<Button Content="Работа с физ. лицами" Width="200" Height="50" Margin="0,10"
|
<Button Content="Работа с физ. лицами" Width="200" Height="50" Margin="0,10"
|
||||||
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Text;
|
using EmployeeManager.ViewModel;
|
||||||
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
@ -19,6 +20,7 @@ namespace EmployeeManager.View
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
DataContext = new DataManageViewModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
78
View/PhysicalPerson/AddPhysicalPersonWindow.xaml
Normal file
78
View/PhysicalPerson/AddPhysicalPersonWindow.xaml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<Window x:Class="EmployeeManager.View.PhysicalPerson.AddPhysicalPersonWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="Добавление физического лица"
|
||||||
|
Height="600" Width="400"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Background="#0D2D4F">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<!-- Заголовок окна -->
|
||||||
|
<TextBlock Text="Добавление физического лица"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||||
|
FontSize="18" FontWeight="Bold"
|
||||||
|
Foreground="#FFFFFF"
|
||||||
|
Margin="0,20,0,0" />
|
||||||
|
|
||||||
|
<!-- Стек элементов для ввода данных -->
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<!-- Поле для имени -->
|
||||||
|
<TextBox x:Name="NameTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите имя" />
|
||||||
|
|
||||||
|
<!-- Поле для фамилии -->
|
||||||
|
<TextBox x:Name="SurnameTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите фамилию" />
|
||||||
|
|
||||||
|
<!-- Поле для отчества -->
|
||||||
|
<TextBox x:Name="PatronomicTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите отчество" />
|
||||||
|
|
||||||
|
<!-- Поле для выбора даты рождения -->
|
||||||
|
<DatePicker x:Name="BirthdayPicker"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Выберите дату рождения" />
|
||||||
|
|
||||||
|
<!-- Поле для выбора пола -->
|
||||||
|
<ComboBox x:Name="GenderComboBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedComboBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Выберите пол">
|
||||||
|
<ComboBoxItem>Мужской</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Женский</ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<!-- Поле для адреса -->
|
||||||
|
<TextBox x:Name="AddressTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите адрес" />
|
||||||
|
|
||||||
|
<!-- Поле для телефона -->
|
||||||
|
<TextBox x:Name="TelephoneTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите номер телефона" />
|
||||||
|
|
||||||
|
<!-- Кнопка для добавления физического лица -->
|
||||||
|
<Button Content="Добавить физическое лицо"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Margin="0,10"
|
||||||
|
Style="{StaticResource RoundedButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
@ -15,11 +15,11 @@ using System.Windows.Shapes;
|
|||||||
namespace EmployeeManager.View.PhysicalPerson
|
namespace EmployeeManager.View.PhysicalPerson
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Логика взаимодействия для WorkInPhysicalPerson.xaml
|
/// Логика взаимодействия для AddPhysicalPersonWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class WorkInPhysicalPerson : Window
|
public partial class AddPhysicalPersonWindow : Window
|
||||||
{
|
{
|
||||||
public WorkInPhysicalPerson()
|
public AddPhysicalPersonWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
44
View/PhysicalPerson/PhysicalPersoManagementWindow.xaml
Normal file
44
View/PhysicalPerson/PhysicalPersoManagementWindow.xaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<Window x:Class="EmployeeManager.View.PhysicalPerson.PhysicalPersoManagementWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="Управление физическими лицами"
|
||||||
|
Height="300" Width="400"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Background="#0D2D4F">
|
||||||
|
<Grid>
|
||||||
|
<!-- Заголовок окна -->
|
||||||
|
<TextBlock Text="Управление физическими лицами"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||||
|
FontSize="18" FontWeight="Bold"
|
||||||
|
Foreground="#FFFFFF"
|
||||||
|
Margin="0,20,0,0" />
|
||||||
|
|
||||||
|
<!-- Стек кнопок -->
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<!-- Кнопка "Удаление физического лица" -->
|
||||||
|
<Button Content="Удаление физического лица"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Margin="0,0,0,10"
|
||||||
|
Style="{StaticResource RoundedButtonStyle}" />
|
||||||
|
|
||||||
|
<!-- Кнопка "Добавление физического лица" -->
|
||||||
|
<Button Content="Добавление физического лица"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Margin="0,0,0,10"
|
||||||
|
Style="{StaticResource RoundedButtonStyle}"
|
||||||
|
Command="{Binding OpenAddPhysicalPersonWindow}"/>
|
||||||
|
|
||||||
|
<!-- Кнопка "Редактирование физического лица" -->
|
||||||
|
<Button Content="Редактирование физического лица"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Margin="0,0,0,10"
|
||||||
|
Style="{StaticResource RoundedButtonStyle}" />
|
||||||
|
|
||||||
|
<!-- Кнопка "Просмотр физических лиц" -->
|
||||||
|
<Button Content="Просмотр физических лиц"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
29
View/PhysicalPerson/PhysicalPersoManagementWindow.xaml.cs
Normal file
29
View/PhysicalPerson/PhysicalPersoManagementWindow.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using EmployeeManager.ViewModel;
|
||||||
|
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 EmployeeManager.View.PhysicalPerson
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для PhysicalPersoManagementWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PhysicalPersoManagementWindow : Window
|
||||||
|
{
|
||||||
|
public PhysicalPersoManagementWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = new DataManageViewModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
<Window x:Class="EmployeeManager.View.PhysicalPerson.WorkInPhysicalPerson"
|
|
||||||
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:EmployeeManager.View.PhysicalPerson"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="WorkInPhysicalPerson" Height="450" Width="800">
|
|
||||||
<Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
26
View/TextBoxPlaceholderConverter.cs
Normal file
26
View/TextBoxPlaceholderConverter.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace EmployeeManager.View
|
||||||
|
{
|
||||||
|
public class TextBoxPlaceholderConverter : IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string text = values[0] as string;
|
||||||
|
bool isFocused = (bool)values[1];
|
||||||
|
return string.IsNullOrEmpty(text) && !isFocused ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,89 @@
|
|||||||
using System;
|
using EmployeeManager.Model;
|
||||||
|
using EmployeeManager.View.PhysicalPerson;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace EmployeeManager.ViewModel
|
namespace EmployeeManager.ViewModel
|
||||||
{
|
{
|
||||||
internal class DataManageViewModel
|
public class DataManageViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private List<PhysicalPerson> allPhysicalPeoples = DataWorker.GetAllPhysicalPerson();
|
||||||
|
public List<PhysicalPerson> AllPhysicalPeoples
|
||||||
|
{
|
||||||
|
get { return allPhysicalPeoples; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
allPhysicalPeoples = value;
|
||||||
|
NotifyPropertyChanged("AllPhysicalPeoples");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private RelayCommand openPhysicalPersoManagementWindow;
|
||||||
|
public RelayCommand OpenPhysicalPersoManagementWindow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return openPhysicalPersoManagementWindow ?? new RelayCommand(obj =>
|
||||||
|
{
|
||||||
|
OpenPhysicalPersoManagementWindowMethod();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RelayCommand openAddPhysicalPersonWindow;
|
||||||
|
public RelayCommand OpenAddPhysicalPersonWindow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return openAddPhysicalPersonWindow ?? new RelayCommand(obj =>
|
||||||
|
{
|
||||||
|
OpenAddPhysicalPersonWindowMethod();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void OpenPhysicalPersoManagementWindowMethod()
|
||||||
|
{
|
||||||
|
PhysicalPersoManagementWindow newPhysicalPersoManagementWindow = new PhysicalPersoManagementWindow();
|
||||||
|
SetCenterPositionAndOpen(newPhysicalPersoManagementWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenAddPhysicalPersonWindowMethod()
|
||||||
|
{
|
||||||
|
AddPhysicalPersonWindow newAddPhysicalPersonWindow = new AddPhysicalPersonWindow();
|
||||||
|
SetCenterPositionAndOpen(newAddPhysicalPersonWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetCenterPositionAndOpen(Window window)
|
||||||
|
{
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
|
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||||
|
window.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
private void NotifyPropertyChanged(String propertyName)
|
||||||
|
{
|
||||||
|
if (PropertyChanged != null)
|
||||||
|
{
|
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user