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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-26 20:35:57 +04:00
|
|
|
|
public string NamePhysicalPersons { get; set; } = string.Empty;
|
|
|
|
|
public string SurnamePhysicalPersons { get; set; } = string.Empty;
|
|
|
|
|
public string PatronomicPhysicalPersons { get; set; } = string.Empty;
|
|
|
|
|
public DateTime Birthday { get; set; }
|
|
|
|
|
public string Gender { get; set; } = string.Empty;
|
|
|
|
|
public string Address { get; set; } = string.Empty;
|
|
|
|
|
public string Telephone { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private RelayCommand addNewPhysicalPerson;
|
|
|
|
|
public RelayCommand AddNewPhysicalPerson
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return addNewPhysicalPerson ?? new RelayCommand(obj =>
|
|
|
|
|
{
|
|
|
|
|
string resultStr = "";
|
|
|
|
|
|
|
|
|
|
resultStr = DataWorker.CreatePhysicalPerson(NamePhysicalPersons, SurnamePhysicalPersons, PatronomicPhysicalPersons, Birthday, Gender, Address, Telephone);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-26 20:02:29 +04:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|