2024-11-26 20:02:29 +04:00
|
|
|
|
using EmployeeManager.Model;
|
|
|
|
|
using EmployeeManager.View.PhysicalPerson;
|
|
|
|
|
using System;
|
2024-11-26 14:12:47 +04:00
|
|
|
|
using System.Collections.Generic;
|
2024-11-26 20:02:29 +04:00
|
|
|
|
using System.ComponentModel;
|
2024-11-26 14:12:47 +04:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2024-11-26 20:02:29 +04:00
|
|
|
|
using System.Windows;
|
2024-11-26 14:12:47 +04:00
|
|
|
|
|
|
|
|
|
namespace EmployeeManager.ViewModel
|
|
|
|
|
{
|
2024-11-26 20:02:29 +04:00
|
|
|
|
public class DataManageViewModel : INotifyPropertyChanged
|
2024-11-26 14:12:47 +04:00
|
|
|
|
{
|
2024-11-26 20:02:29 +04:00
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-26 14:12:47 +04:00
|
|
|
|
}
|
|
|
|
|
}
|