Теперь работает переключение между страницами и добавление физического лица.
This commit is contained in:
parent
4b004a2628
commit
ca42b880f1
EmployeeManagmentBusinessLogic/BusinessLogic
EmployeeManagmentContracts
BusinessLogicContracts
ViewModels
EmployeeManagmentDataBaseImplement
Implements
Migrations
Models
EmployeeManagmentDataModels/Models
EmployeeManagmentView
App.xamlApp.xaml.csEmployeesWindow.xamlEmployeesWindow.xaml.csMainWindow.xamlMainWindow.xaml.cs
PhysicalPerson
AddPhysicalPersonWindow.xamlAddPhysicalPersonWindow.xaml.csPhysicalPersonManagementWindow.xamlPhysicalPersonManagementWindow.xaml.cs
SalariesWindow.xamlSalariesWindow.xaml.csVacationsWindow.xamlVacationsWindow.xaml.cs@ -9,115 +9,68 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using EmployeeManagmentContracts.StoragesContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using EmployeeManagmentDataBaseImplement.Implements;
|
||||||
|
|
||||||
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class PhisicalPersonLogic : IPhisicalPersonLogic
|
public class PhisicalPersonLogic : IPhisicalPersonLogic
|
||||||
{
|
{
|
||||||
private readonly EmployeeManagementDbContext _context;
|
private readonly ILogger<PhisicalPersonLogic> _logger;
|
||||||
|
private readonly IPhisicalPersonStorage _phisicalPersonStorage;
|
||||||
|
|
||||||
public PhisicalPersonLogic(EmployeeManagementDbContext context)
|
public PhisicalPersonLogic(ILogger<PhisicalPersonLogic> logger, IPhisicalPersonStorage phisicalPersonStorage)
|
||||||
{
|
{
|
||||||
_context = context;
|
_logger = logger;
|
||||||
|
_phisicalPersonStorage = phisicalPersonStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateOrUpdate(PhisicalPersonBindingModel model)
|
public List<PhisicalPersonViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
PhisicalPerson? person = _context.PhysicalPersons
|
return _phisicalPersonStorage.GetFullList();
|
||||||
.FirstOrDefault(p => p.Id == model.Id);
|
}
|
||||||
|
|
||||||
if (person == null)
|
public List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model)
|
||||||
|
{
|
||||||
|
return _phisicalPersonStorage.GetFilteredList(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhisicalPersonViewModel? GetElement(int id)
|
||||||
|
{
|
||||||
|
return _phisicalPersonStorage.GetElement(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(PhisicalPersonViewModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(model.Name) || string.IsNullOrWhiteSpace(model.Surname))
|
||||||
{
|
{
|
||||||
// Создание нового
|
throw new ArgumentException("Имя и фамилия обязательны для заполнения.");
|
||||||
person = new PhisicalPerson
|
|
||||||
{
|
|
||||||
Name = model.Name,
|
|
||||||
Surname = model.Surname,
|
|
||||||
Patronymic = model.Patronomic,
|
|
||||||
Birthday = model.Birthday,
|
|
||||||
Gender = model.Gender,
|
|
||||||
Address = model.Address,
|
|
||||||
Telephone = model.Telephone
|
|
||||||
};
|
|
||||||
_context.PhysicalPersons.Add(person);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Обновление существующего
|
|
||||||
person.Name = model.Name;
|
|
||||||
person.Surname = model.Surname;
|
|
||||||
person.Patronymic = model.Patronomic;
|
|
||||||
person.Birthday = model.Birthday;
|
|
||||||
person.Gender = model.Gender;
|
|
||||||
person.Address = model.Address;
|
|
||||||
person.Telephone = model.Telephone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.SaveChanges();
|
_phisicalPersonStorage.Insert(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(PhisicalPersonViewModel model)
|
||||||
|
{
|
||||||
|
var element = _phisicalPersonStorage.GetElement(model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Элемент не найден.");
|
||||||
|
}
|
||||||
|
|
||||||
|
_phisicalPersonStorage.Update(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
var person = _context.PhysicalPersons.FirstOrDefault(p => p.Id == id);
|
var element = _phisicalPersonStorage.GetElement(id);
|
||||||
if (person != null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
_context.PhysicalPersons.Remove(person);
|
throw new ArgumentException("Элемент не найден.");
|
||||||
_context.SaveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhisicalPersonViewModel? GetPhisicalPersonById(int id)
|
|
||||||
{
|
|
||||||
var person = _context.PhysicalPersons
|
|
||||||
.Where(p => p.Id == id)
|
|
||||||
.Select(p => new PhisicalPersonViewModel
|
|
||||||
{
|
|
||||||
Id = p.Id,
|
|
||||||
Name = p.Name,
|
|
||||||
Surname = p.Surname,
|
|
||||||
Patronomic = p.Patronymic,
|
|
||||||
Birthday = p.Birthday,
|
|
||||||
Gender = p.Gender,
|
|
||||||
Address = p.Address,
|
|
||||||
Telephone = p.Telephone
|
|
||||||
})
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
return person;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PhisicalPersonViewModel> GetPhisicalPersons(PhisicalPersonSearchModel model)
|
|
||||||
{
|
|
||||||
var query = _context.PhysicalPersons.AsQueryable();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.Name))
|
|
||||||
{
|
|
||||||
query = query.Where(p => p.Name.Contains(model.Name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.Surname))
|
_phisicalPersonStorage.Delete(id);
|
||||||
{
|
|
||||||
query = query.Where(p => p.Surname.Contains(model.Surname));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.Patronomic))
|
|
||||||
{
|
|
||||||
query = query.Where(p => p.Patronymic.Contains(model.Patronomic));
|
|
||||||
}
|
|
||||||
|
|
||||||
return query
|
|
||||||
.Select(p => new PhisicalPersonViewModel
|
|
||||||
{
|
|
||||||
Id = p.Id,
|
|
||||||
Name = p.Name,
|
|
||||||
Surname = p.Surname,
|
|
||||||
Patronomic = p.Patronymic,
|
|
||||||
Birthday = p.Birthday,
|
|
||||||
Gender = p.Gender,
|
|
||||||
Address = p.Address,
|
|
||||||
Telephone = p.Telephone
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,20 @@ using EmployeeManagmentContracts.BusinessLogicContracts;
|
|||||||
using EmployeeManagmentContracts.SearchModels;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
using EmployeeManagmentContracts.StoragesContracts;
|
using EmployeeManagmentContracts.StoragesContracts;
|
||||||
using EmployeeManagmentContracts.ViewModels;
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using EmployeeManagmentDataBaseImplement.Implements;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class SalaryLogic : ISalaryLogic
|
public class SalaryLogic : ISalaryLogic
|
||||||
{
|
{
|
||||||
public void CreateOrUpdate(SalaryBindingModel model)
|
private readonly ILogger _logger;
|
||||||
|
private readonly ISalaryStorage _salaryStorage;
|
||||||
|
|
||||||
|
public SalaryLogic(ILogger<SalaryLogic> logger, ISalaryStorage salaryStorage)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_logger = logger;
|
||||||
|
_salaryStorage = salaryStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@ -18,12 +24,27 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SalaryViewModel> GetSalaries(SalarySearchModel model)
|
public PhisicalPersonViewModel? GetElement(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SalaryViewModel? GetSalaryById(int id)
|
public List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PhisicalPersonViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(PhisicalPersonViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(PhisicalPersonViewModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,20 @@ using EmployeeManagmentContracts.BusinessLogicContracts;
|
|||||||
using EmployeeManagmentContracts.SearchModels;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
using EmployeeManagmentContracts.StoragesContracts;
|
using EmployeeManagmentContracts.StoragesContracts;
|
||||||
using EmployeeManagmentContracts.ViewModels;
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using EmployeeManagmentDataBaseImplement.Implements;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
public class VacationLogic : IVacationLogic
|
public class VacationLogic : IVacationLogic
|
||||||
{
|
{
|
||||||
public void CreateOrUpdate(VacationBindingModel model)
|
private readonly ILogger _logger;
|
||||||
|
private readonly IVacationStorage _vacationStorage;
|
||||||
|
|
||||||
|
public VacationLogic(ILogger<VacationLogic> logger, IVacationStorage vacationStorage)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_logger = logger;
|
||||||
|
_vacationStorage = vacationStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@ -18,12 +24,27 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VacationViewModel? GetVacationById(int id)
|
public PhisicalPersonViewModel? GetElement(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<VacationViewModel> GetVacations(VacationSearchModel model)
|
public List<PhisicalPersonViewModel> GetFilteredList(EmployeeSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PhisicalPersonViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(PhisicalPersonViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(PhisicalPersonViewModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,11 @@ namespace EmployeeManagmentContracts.BusinessLogicContracts
|
|||||||
{
|
{
|
||||||
public interface IPhisicalPersonLogic
|
public interface IPhisicalPersonLogic
|
||||||
{
|
{
|
||||||
List<PhisicalPersonViewModel> GetPhisicalPersons(PhisicalPersonSearchModel model);
|
List<PhisicalPersonViewModel> GetFullList();
|
||||||
PhisicalPersonViewModel? GetPhisicalPersonById(int id);
|
List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model);
|
||||||
void CreateOrUpdate(PhisicalPersonBindingModel model);
|
PhisicalPersonViewModel? GetElement(int id);
|
||||||
|
void Insert(PhisicalPersonViewModel model);
|
||||||
|
void Update(PhisicalPersonViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,11 @@ namespace EmployeeManagmentContracts.BusinessLogicContracts
|
|||||||
{
|
{
|
||||||
public interface ISalaryLogic
|
public interface ISalaryLogic
|
||||||
{
|
{
|
||||||
List<SalaryViewModel> GetSalaries(SalarySearchModel model);
|
List<PhisicalPersonViewModel> GetFullList();
|
||||||
SalaryViewModel? GetSalaryById(int id);
|
List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model);
|
||||||
void CreateOrUpdate(SalaryBindingModel model);
|
PhisicalPersonViewModel? GetElement(int id);
|
||||||
|
void Insert(PhisicalPersonViewModel model);
|
||||||
|
void Update(PhisicalPersonViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,11 @@ namespace EmployeeManagmentContracts.BusinessLogicContracts
|
|||||||
{
|
{
|
||||||
public interface IVacationLogic
|
public interface IVacationLogic
|
||||||
{
|
{
|
||||||
List<VacationViewModel> GetVacations(VacationSearchModel model);
|
List<PhisicalPersonViewModel> GetFullList();
|
||||||
VacationViewModel? GetVacationById(int id);
|
List<PhisicalPersonViewModel> GetFilteredList(EmployeeSearchModel model);
|
||||||
void CreateOrUpdate(VacationBindingModel model);
|
PhisicalPersonViewModel? GetElement(int id);
|
||||||
|
void Insert(PhisicalPersonViewModel model);
|
||||||
|
void Update(PhisicalPersonViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace EmployeeManagmentContracts.ViewModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Surname { get; set; } = string.Empty;
|
public string Surname { get; set; } = string.Empty;
|
||||||
public string Patronomic { get; set; } = string.Empty;
|
public string Patronymic { get; set; } = string.Empty;
|
||||||
public DateTime Birthday { get; set; }
|
public DateTime Birthday { get; set; }
|
||||||
public string Gender { get; set; } = string.Empty;
|
public string Gender { get; set; } = string.Empty;
|
||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using EmployeeManagmentContracts.SearchModels;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
using EmployeeManagmentContracts.StoragesContracts;
|
using EmployeeManagmentContracts.StoragesContracts;
|
||||||
using EmployeeManagmentContracts.ViewModels;
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using EmployeeManagmentDataBaseImplement.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -12,34 +13,117 @@ namespace EmployeeManagmentDataBaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class PhisicalPersonStorage : IPhisicalPersonStorage
|
public class PhisicalPersonStorage : IPhisicalPersonStorage
|
||||||
{
|
{
|
||||||
public void Delete(int id)
|
// Метод для получения полного списка
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhisicalPersonViewModel? GetElement(int id)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PhisicalPersonViewModel> GetFullList()
|
public List<PhisicalPersonViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
return context.PhysicalPersons
|
||||||
|
.Select(p => new PhisicalPersonViewModel
|
||||||
|
{
|
||||||
|
Id = p.Id,
|
||||||
|
Name = p.Name,
|
||||||
|
Surname = p.Surname,
|
||||||
|
Patronymic = p.Patronymic,
|
||||||
|
Birthday = p.Birthday,
|
||||||
|
Gender = p.Gender,
|
||||||
|
Address = p.Address,
|
||||||
|
Telephone = p.Telephone
|
||||||
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Метод для получения отфильтрованного списка
|
||||||
|
public List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
if (model == null) return new List<PhisicalPersonViewModel>();
|
||||||
|
|
||||||
|
return context.PhysicalPersons
|
||||||
|
.Where(p => p.Surname.Contains(model.Surname ?? string.Empty))
|
||||||
|
.Select(p => new PhisicalPersonViewModel
|
||||||
|
{
|
||||||
|
Id = p.Id,
|
||||||
|
Name = p.Name,
|
||||||
|
Surname = p.Surname,
|
||||||
|
Patronymic = p.Patronymic,
|
||||||
|
Birthday = p.Birthday,
|
||||||
|
Gender = p.Gender,
|
||||||
|
Address = p.Address,
|
||||||
|
Telephone = p.Telephone
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для получения одного элемента по ID
|
||||||
|
public PhisicalPersonViewModel? GetElement(int id)
|
||||||
|
{
|
||||||
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
var entity = context.PhysicalPersons.FirstOrDefault(p => p.Id == id);
|
||||||
|
return entity == null ? null : new PhisicalPersonViewModel
|
||||||
|
{
|
||||||
|
Id = entity.Id,
|
||||||
|
Name = entity.Name,
|
||||||
|
Surname = entity.Surname,
|
||||||
|
Patronymic = entity.Patronymic,
|
||||||
|
Birthday = entity.Birthday,
|
||||||
|
Gender = entity.Gender,
|
||||||
|
Address = entity.Address,
|
||||||
|
Telephone = entity.Telephone
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для добавления нового физического лица
|
||||||
public void Insert(PhisicalPersonViewModel model)
|
public void Insert(PhisicalPersonViewModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
var newPerson = new PhisicalPerson
|
||||||
|
{
|
||||||
|
Name = model.Name,
|
||||||
|
Surname = model.Surname,
|
||||||
|
Patronymic = model.Patronymic,
|
||||||
|
Birthday = model.Birthday,
|
||||||
|
Gender = model.Gender,
|
||||||
|
Address = model.Address,
|
||||||
|
Telephone = model.Telephone
|
||||||
|
};
|
||||||
|
|
||||||
|
context.PhysicalPersons.Add(newPerson);
|
||||||
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Метод для обновления физического лица
|
||||||
public void Update(PhisicalPersonViewModel model)
|
public void Update(PhisicalPersonViewModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
var entity = context.PhysicalPersons.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (entity != null)
|
||||||
|
{
|
||||||
|
entity.Name = model.Name;
|
||||||
|
entity.Surname = model.Surname;
|
||||||
|
entity.Patronymic = model.Patronymic;
|
||||||
|
entity.Birthday = model.Birthday;
|
||||||
|
entity.Gender = model.Gender;
|
||||||
|
entity.Address = model.Address;
|
||||||
|
entity.Telephone = model.Telephone;
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для удаления физического лица
|
||||||
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
using var context = new EmployeeManagementDbContext();
|
||||||
|
|
||||||
|
var entity = context.PhysicalPersons.FirstOrDefault(p => p.Id == id);
|
||||||
|
if (entity != null)
|
||||||
|
{
|
||||||
|
context.PhysicalPersons.Remove(entity);
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace EmployeeManagmentDataBaseImplement.Migrations
|
namespace EmployeeManagmentDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(EmployeeManagementDbContext))]
|
[DbContext(typeof(EmployeeManagementDbContext))]
|
||||||
[Migration("20241124115213_InitMigration")]
|
[Migration("20241126175607_Init")]
|
||||||
partial class InitMigration
|
partial class Init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -46,7 +46,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
b.Property<string>("PartTimeJob")
|
b.Property<string>("PartTimeJob")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<int>("PhisicalPersonsId")
|
b.Property<int?>("PhisicalPersonsId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime?>("StartJob")
|
b.Property<DateTime?>("StartJob")
|
||||||
@ -112,7 +112,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("Data")
|
b.Property<DateTime?>("Data")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<int>("EmployeesId")
|
b.Property<int?>("EmployeesId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<bool>("Passed")
|
b.Property<bool>("Passed")
|
||||||
@ -139,7 +139,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("EmployeesId")
|
b.Property<int?>("EmployeesId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("EndData")
|
b.Property<DateTime>("EndData")
|
||||||
@ -162,9 +162,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.PhisicalPerson", "PhisicalPerson")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.PhisicalPerson", "PhisicalPerson")
|
||||||
.WithMany("Employees")
|
.WithMany("Employees")
|
||||||
.HasForeignKey("PhisicalPersonsId")
|
.HasForeignKey("PhisicalPersonsId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("PhisicalPerson");
|
b.Navigation("PhisicalPerson");
|
||||||
});
|
});
|
||||||
@ -173,9 +171,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
||||||
.WithMany("Salaries")
|
.WithMany("Salaries")
|
||||||
.HasForeignKey("EmployeesId")
|
.HasForeignKey("EmployeesId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
||||||
@ -184,9 +180,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
||||||
.WithMany("Vacations")
|
.WithMany("Vacations")
|
||||||
.HasForeignKey("EmployeesId")
|
.HasForeignKey("EmployeesId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace EmployeeManagmentDataBaseImplement.Migrations
|
namespace EmployeeManagmentDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitMigration : Migration
|
public partial class Init : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -42,7 +42,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
EndJob = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
EndJob = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
PartTimeJob = table.Column<string>(type: "text", nullable: true),
|
PartTimeJob = table.Column<string>(type: "text", nullable: true),
|
||||||
Bid = table.Column<float>(type: "real", nullable: false),
|
Bid = table.Column<float>(type: "real", nullable: false),
|
||||||
PhisicalPersonsId = table.Column<int>(type: "integer", nullable: false)
|
PhisicalPersonsId = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -51,8 +51,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
name: "FK_Employees_PhysicalPersons_PhisicalPersonsId",
|
name: "FK_Employees_PhysicalPersons_PhisicalPersonsId",
|
||||||
column: x => x.PhisicalPersonsId,
|
column: x => x.PhisicalPersonsId,
|
||||||
principalTable: "PhysicalPersons",
|
principalTable: "PhysicalPersons",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id");
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
@ -66,7 +65,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
Premium = table.Column<float>(type: "real", nullable: true),
|
Premium = table.Column<float>(type: "real", nullable: true),
|
||||||
Data = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
Data = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
Passed = table.Column<bool>(type: "boolean", nullable: false),
|
Passed = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
EmployeesId = table.Column<int>(type: "integer", nullable: false)
|
EmployeesId = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -75,8 +74,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
name: "FK_Salaries_Employees_EmployeesId",
|
name: "FK_Salaries_Employees_EmployeesId",
|
||||||
column: x => x.EmployeesId,
|
column: x => x.EmployeesId,
|
||||||
principalTable: "Employees",
|
principalTable: "Employees",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id");
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
@ -88,7 +86,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
StartData = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
StartData = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
EndData = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
EndData = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
Passed = table.Column<bool>(type: "boolean", nullable: false),
|
Passed = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
EmployeesId = table.Column<int>(type: "integer", nullable: false)
|
EmployeesId = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -97,8 +95,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
name: "FK_Vacations_Employees_EmployeesId",
|
name: "FK_Vacations_Employees_EmployeesId",
|
||||||
column: x => x.EmployeesId,
|
column: x => x.EmployeesId,
|
||||||
principalTable: "Employees",
|
principalTable: "Employees",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id");
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
@ -43,7 +43,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
b.Property<string>("PartTimeJob")
|
b.Property<string>("PartTimeJob")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<int>("PhisicalPersonsId")
|
b.Property<int?>("PhisicalPersonsId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime?>("StartJob")
|
b.Property<DateTime?>("StartJob")
|
||||||
@ -109,7 +109,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("Data")
|
b.Property<DateTime?>("Data")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<int>("EmployeesId")
|
b.Property<int?>("EmployeesId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<bool>("Passed")
|
b.Property<bool>("Passed")
|
||||||
@ -136,7 +136,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("EmployeesId")
|
b.Property<int?>("EmployeesId")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("EndData")
|
b.Property<DateTime>("EndData")
|
||||||
@ -159,9 +159,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.PhisicalPerson", "PhisicalPerson")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.PhisicalPerson", "PhisicalPerson")
|
||||||
.WithMany("Employees")
|
.WithMany("Employees")
|
||||||
.HasForeignKey("PhisicalPersonsId")
|
.HasForeignKey("PhisicalPersonsId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("PhisicalPerson");
|
b.Navigation("PhisicalPerson");
|
||||||
});
|
});
|
||||||
@ -170,9 +168,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
||||||
.WithMany("Salaries")
|
.WithMany("Salaries")
|
||||||
.HasForeignKey("EmployeesId")
|
.HasForeignKey("EmployeesId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
||||||
@ -181,9 +177,7 @@ namespace EmployeeManagmentDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
b.HasOne("EmployeeManagmentDataBaseImplement.Models.Employee", "Employee")
|
||||||
.WithMany("Vacations")
|
.WithMany("Vacations")
|
||||||
.HasForeignKey("EmployeesId")
|
.HasForeignKey("EmployeesId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,7 @@ namespace EmployeeManagmentDataBaseImplement.Models
|
|||||||
public float Bid { get; set; }
|
public float Bid { get; set; }
|
||||||
|
|
||||||
[ForeignKey("PhisicalPerson")]
|
[ForeignKey("PhisicalPerson")]
|
||||||
public int PhisicalPersonsId { get; set; }
|
public int? PhisicalPersonsId { get; set; }
|
||||||
public PhisicalPerson? PhisicalPerson { get; set; }
|
public PhisicalPerson? PhisicalPerson { get; set; }
|
||||||
|
|
||||||
public List<Salary> Salaries { get; set; } = new();
|
public List<Salary> Salaries { get; set; } = new();
|
||||||
|
@ -21,7 +21,7 @@ namespace EmployeeManagmentDataBaseImplement.Models
|
|||||||
public bool Passed { get; set; }
|
public bool Passed { get; set; }
|
||||||
|
|
||||||
[ForeignKey("Employee")]
|
[ForeignKey("Employee")]
|
||||||
public int EmployeesId { get; set; }
|
public int? EmployeesId { get; set; }
|
||||||
public Employee? Employee { get; set; }
|
public Employee? Employee { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace EmployeeManagmentDataBaseImplement.Models
|
|||||||
public bool Passed { get; set; }
|
public bool Passed { get; set; }
|
||||||
|
|
||||||
[ForeignKey("Employee")]
|
[ForeignKey("Employee")]
|
||||||
public int EmployeesId { get; set; }
|
public int? EmployeesId { get; set; }
|
||||||
public Employee? Employee { get; set; }
|
public Employee? Employee { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,6 @@ namespace EmployeeManagmentDataModels.Models
|
|||||||
DateTime? EndJob { get; set; }
|
DateTime? EndJob { get; set; }
|
||||||
string? PartTimeJob { get; set; }
|
string? PartTimeJob { get; set; }
|
||||||
float Bid { get; set; }
|
float Bid { get; set; }
|
||||||
int PhisicalPersonsId { get; set; }
|
int? PhisicalPersonsId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ namespace EmployeeManagmentDataModels.Models
|
|||||||
float? Premium { get; set; }
|
float? Premium { get; set; }
|
||||||
DateTime? Data { get; set; }
|
DateTime? Data { get; set; }
|
||||||
bool Passed { get; set; }
|
bool Passed { get; set; }
|
||||||
int EmployeesId { get; set; }
|
int? EmployeesId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ namespace EmployeeManagmentDataModels.Models
|
|||||||
DateTime StartData { get; set; }
|
DateTime StartData { get; set; }
|
||||||
DateTime EndData { get; set; }
|
DateTime EndData { get; set; }
|
||||||
bool Passed { get; set; }
|
bool Passed { get; set; }
|
||||||
int EmployeesId { get; set; }
|
int? EmployeesId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,101 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
<!-- Стиль для закругленных кнопок -->
|
||||||
|
<Style x:Key="RoundedButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Grid>
|
||||||
|
<!-- Тень кнопки -->
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="15"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
x:Name="ButtonBorder">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Color="Black" BlurRadius="10" ShadowDepth="2" Opacity="0.4" />
|
||||||
|
</Border.Effect>
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<!-- Анимация цвета при наведении -->
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
||||||
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||||
|
To="#0066CC" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<ColorAnimation Storyboard.TargetName="ButtonBorder"
|
||||||
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||||
|
To="#004890" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
|
||||||
|
<!-- Анимация сжатия при нажатии -->
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter Property="RenderTransform" TargetName="ButtonBorder">
|
||||||
|
<Setter.Value>
|
||||||
|
<ScaleTransform ScaleX="0.95" ScaleY="0.95" />
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter TargetName="ButtonBorder" Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect Color="Black" BlurRadius="15" ShadowDepth="0" Opacity="0.6" />
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</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>
|
||||||
|
@ -47,11 +47,11 @@ namespace EmployeeManagmentView
|
|||||||
|
|
||||||
services.AddTransient<IPhisicalPersonLogic, PhisicalPersonLogic>();
|
services.AddTransient<IPhisicalPersonLogic, PhisicalPersonLogic>();
|
||||||
services.AddTransient<IEmployeeLogic, EmployeeLogic>();
|
services.AddTransient<IEmployeeLogic, EmployeeLogic>();
|
||||||
|
services.AddTransient<ISalaryLogic, SalaryLogic>();
|
||||||
|
services.AddTransient<IVacationLogic, VacationLogic>();
|
||||||
|
|
||||||
services.AddTransient<MainWindow>();
|
services.AddTransient<MainWindow>();
|
||||||
services.AddTransient<EmployeesWindow>();
|
|
||||||
services.AddTransient<SalariesWindow>();
|
|
||||||
services.AddTransient<VacationsWindow>();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<Window x:Class="EmployeeManagmentView.EmployeesWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="Employees" Height="450" Width="800">
|
|
||||||
<Grid>
|
|
||||||
<TextBlock Text="Список сотрудников" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,29 +0,0 @@
|
|||||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
|
||||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
|
||||||
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 EmployeeManagmentView
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для EmployeesWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class EmployeesWindow : Window
|
|
||||||
{
|
|
||||||
public EmployeesWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +1,26 @@
|
|||||||
<Window x:Class="EmployeeManagmentView.MainWindow"
|
<Window x:Class="EmployeeManagmentView.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
Title="Отдел кадров УлГТУ" Height="450" Width="800" Background="#0D2D4F">
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="Employee Management System"
|
|
||||||
Height="450" Width="800">
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel>
|
<!-- Заголовок -->
|
||||||
<TextBlock Text="Система управления сотрудниками"
|
<TextBlock Text="Отдел кадров УлГТУ"
|
||||||
FontSize="24"
|
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||||
FontWeight="Bold"
|
FontSize="24" FontWeight="Bold"
|
||||||
Margin="10"/>
|
Foreground="#FFFFFF" Margin="0,20,0,0" />
|
||||||
<Button Content="Просмотр сотрудников"
|
|
||||||
Width="200"
|
<!-- Центральный StackPanel -->
|
||||||
Height="40"
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,40">
|
||||||
Margin="10"
|
<!-- Кнопка 1 -->
|
||||||
Click="ViewEmployees_Click"/>
|
<Button Content="Работа с сотрудниками" Width="200" Height="50" Margin="0,10"
|
||||||
<Button Content="Управление зарплатами"
|
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||||
Width="200"
|
Style="{StaticResource RoundedButtonStyle}"/>
|
||||||
Height="40"
|
<!-- Кнопка 2 -->
|
||||||
Margin="10"
|
<Button Content="Работа с физ. лицами" Width="200" Height="50" Margin="0,10"
|
||||||
Click="ManageSalaries_Click"/>
|
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||||
<Button Content="Управление отпусками"
|
Style="{StaticResource RoundedButtonStyle}" Click="OpenPhysicalPersonManagementWindow"/>
|
||||||
Width="200"
|
|
||||||
Height="40"
|
|
||||||
Margin="10"
|
|
||||||
Click="ManageVacations_Click"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
@ -1,6 +1,7 @@
|
|||||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
||||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||||
using EmployeeManagmentContracts.ViewModels;
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using EmployeeManagmentView.PhysicalPerson;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace EmployeeManagmentView
|
namespace EmployeeManagmentView
|
||||||
@ -9,33 +10,22 @@ namespace EmployeeManagmentView
|
|||||||
{
|
{
|
||||||
|
|
||||||
private readonly IEmployeeLogic _employeeLogic;
|
private readonly IEmployeeLogic _employeeLogic;
|
||||||
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||||
|
|
||||||
// Constructor with Dependency Injection
|
// Constructor with Dependency Injection
|
||||||
public MainWindow(IEmployeeLogic employeeLogic)
|
public MainWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
|
||||||
{
|
{
|
||||||
_employeeLogic = employeeLogic;
|
_employeeLogic = employeeLogic;
|
||||||
|
_phisicalPersonLogic = phisicalPersonLogic;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ViewEmployees_Click(object sender, RoutedEventArgs e)
|
private void OpenPhysicalPersonManagementWindow(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Логика для открытия окна просмотра сотрудников
|
|
||||||
var employeesWindow = new EmployeesWindow();
|
var physicalPersonWindow = new PhysicalPersonManagementWindow(_phisicalPersonLogic);
|
||||||
employeesWindow.Show();
|
physicalPersonWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ManageSalaries_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
// Логика для открытия окна управления зарплатами
|
|
||||||
var salariesWindow = new SalariesWindow();
|
|
||||||
salariesWindow.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ManageVacations_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
// Логика для открытия окна управления отпусками
|
|
||||||
var vacationsWindow = new VacationsWindow();
|
|
||||||
vacationsWindow.Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
<Window x:Class="EmployeeManagmentView.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="Выберите дату рождения" />
|
||||||
|
|
||||||
|
<!-- Поле для выбора пола -->
|
||||||
|
<TextBox x:Name="GenderTextBox"
|
||||||
|
Width="250" Height="40"
|
||||||
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
|
Margin="0,10"
|
||||||
|
ToolTip="Введите пол" />
|
||||||
|
|
||||||
|
<!-- Поле для адреса -->
|
||||||
|
<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}"
|
||||||
|
Click="SaveButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
@ -0,0 +1,65 @@
|
|||||||
|
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
||||||
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||||
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
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 EmployeeManagmentView.PhysicalPerson
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для AddPhysicalPersonWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class AddPhysicalPersonWindow : Window
|
||||||
|
{
|
||||||
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||||
|
|
||||||
|
public AddPhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
||||||
|
{
|
||||||
|
_phisicalPersonLogic = phisicalPersonLogic;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Создаем модель и заполняем её значениями из элементов интерфейса
|
||||||
|
var model = new PhisicalPersonViewModel
|
||||||
|
{
|
||||||
|
Name = NameTextBox.Text,
|
||||||
|
Surname = SurnameTextBox.Text,
|
||||||
|
Patronymic = PatronomicTextBox.Text,
|
||||||
|
Birthday = BirthdayPicker.SelectedDate.Value.ToUniversalTime(), // Проверка на null не нужна, так как поле обязательное
|
||||||
|
Gender = GenderTextBox.Text,
|
||||||
|
Address = AddressTextBox.Text,
|
||||||
|
Telephone = TelephoneTextBox.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
// Вызываем метод Insert из бизнес-логики для добавления данных в базу
|
||||||
|
_phisicalPersonLogic.Insert(model);
|
||||||
|
|
||||||
|
// Показываем сообщение об успешном добавлении
|
||||||
|
MessageBox.Show("Данные успешно сохранены!");
|
||||||
|
|
||||||
|
// Закрываем окно
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// В случае ошибки показываем сообщение об ошибке
|
||||||
|
MessageBox.Show($"Ошибка: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<Window x:Class="EmployeeManagmentView.PhysicalPerson.PhysicalPersonManagementWindow"
|
||||||
|
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}"
|
||||||
|
Click="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>
|
@ -0,0 +1,38 @@
|
|||||||
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||||
|
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 EmployeeManagmentView.PhysicalPerson
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для PhysicalPersonManagementWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PhysicalPersonManagementWindow : Window
|
||||||
|
{
|
||||||
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||||
|
|
||||||
|
// Constructor with Dependency Injection
|
||||||
|
public PhysicalPersonManagementWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
||||||
|
{
|
||||||
|
_phisicalPersonLogic = phisicalPersonLogic;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenAddPhysicalPersonWindow(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var physicalPersonWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
|
||||||
|
physicalPersonWindow.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
<Window x:Class="EmployeeManagmentView.SalariesWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="Salaries" Height="450" Width="800">
|
|
||||||
<Grid>
|
|
||||||
<TextBlock Text="Управление зарплатами" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,27 +0,0 @@
|
|||||||
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 EmployeeManagmentView
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для SalariesWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class SalariesWindow : Window
|
|
||||||
{
|
|
||||||
public SalariesWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
<Window x:Class="EmployeeManagmentView.VacationsWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="Vacations" Height="450" Width="800">
|
|
||||||
<Grid>
|
|
||||||
<TextBlock Text="Управление отпусками" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,27 +0,0 @@
|
|||||||
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 EmployeeManagmentView
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для VacationsWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class VacationsWindow : Window
|
|
||||||
{
|
|
||||||
public VacationsWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user