From 1ddd362ab7a724cd8273dd6f7d2e2df55ef9c2a4 Mon Sep 17 00:00:00 2001 From: maksim Date: Tue, 12 Nov 2024 22:10:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B2=D1=81=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D1=8B.=20=D0=92=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D1=85=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=D1=85,=20=D0=BE?= =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81?= =?UTF-8?q?=D0=B0=D1=85,=20=D1=81=D1=82=D0=BE=D1=8F=D1=82=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B3=D0=BB=D1=83=D1=88=D0=BA=D0=B8.=20=D0=A1=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B0=20=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BA=D0=BE=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=D0=B6=D0=B5=20=D1=8F=D0=B2=D0=BB=D1=8F=D1=8E=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D0=B7=D0=B0=D0=B3=D0=BB=D1=83=D1=88=D0=BA=D0=B0=D0=BC?= =?UTF-8?q?=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/EmployeeLogic.cs | 81 ++------------ .../BusinessLogic/PhisicalPersonLogic.cs | 35 ++++++ .../BusinessLogic/SalaryLogic.cs | 66 ++--------- .../BusinessLogic/VacationLogic.cs | 56 ++-------- .../BindingModels/EmployeeBindingModel.cs | 2 +- .../EmployeeManagmentContracts.csproj | 4 + .../StoragesContracts/IEmployeeStorage.cs | 11 +- .../IPhisicalPersonStorage.cs | 14 ++- .../StoragesContracts/ISalaryStorage.cs | 14 ++- .../StoragesContracts/IVacationStorage.cs | 11 +- .../ViewModels/EmployeeViewModel.cs | 2 +- .../DatabaseContext.cs | 24 ---- .../EmployeeManagementDbContext .cs | 23 ++++ .../EmployeeManagmentDataBaseImplement.csproj | 4 + .../Implements/EmployeeStorage.cs | 105 +++++------------- .../Implements/PhisicalPersonStorage.cs | 45 ++++++++ .../Implements/SalaryStorage.cs | 44 ++++++++ .../Implements/VacationStorage.cs | 44 ++++++++ .../Models/Employee.cs | 1 + .../Models/PhisicalPerson.cs | 27 +++++ .../Models/Salary.cs | 12 ++ .../Models/Vacation.cs | 12 ++ .../Enums/VacationStatus.cs | 5 +- EmployeeManagmentView/EmployeesWindow.xaml | 8 ++ EmployeeManagmentView/EmployeesWindow.xaml.cs | 27 +++++ EmployeeManagmentView/SalariesWindow.xaml | 8 ++ EmployeeManagmentView/SalariesWindow.xaml.cs | 27 +++++ EmployeeManagmentView/VacationsWindow.xaml | 8 ++ EmployeeManagmentView/VacationsWindow.xaml.cs | 27 +++++ 29 files changed, 456 insertions(+), 291 deletions(-) create mode 100644 EmployeeManagmentBusinessLogic/BusinessLogic/PhisicalPersonLogic.cs delete mode 100644 EmployeeManagmentDataBaseImplement/DatabaseContext.cs create mode 100644 EmployeeManagmentDataBaseImplement/EmployeeManagementDbContext .cs create mode 100644 EmployeeManagmentDataBaseImplement/Implements/PhisicalPersonStorage.cs create mode 100644 EmployeeManagmentDataBaseImplement/Implements/SalaryStorage.cs create mode 100644 EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs create mode 100644 EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs create mode 100644 EmployeeManagmentDataBaseImplement/Models/Salary.cs create mode 100644 EmployeeManagmentDataBaseImplement/Models/Vacation.cs create mode 100644 EmployeeManagmentView/EmployeesWindow.xaml create mode 100644 EmployeeManagmentView/EmployeesWindow.xaml.cs create mode 100644 EmployeeManagmentView/SalariesWindow.xaml create mode 100644 EmployeeManagmentView/SalariesWindow.xaml.cs create mode 100644 EmployeeManagmentView/VacationsWindow.xaml create mode 100644 EmployeeManagmentView/VacationsWindow.xaml.cs diff --git a/EmployeeManagmentBusinessLogic/BusinessLogic/EmployeeLogic.cs b/EmployeeManagmentBusinessLogic/BusinessLogic/EmployeeLogic.cs index 3885678..375f04e 100644 --- a/EmployeeManagmentBusinessLogic/BusinessLogic/EmployeeLogic.cs +++ b/EmployeeManagmentBusinessLogic/BusinessLogic/EmployeeLogic.cs @@ -8,81 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic { public class EmployeeLogic : IEmployeeLogic { - private readonly IEmployeeStorage _employeeStorage; - - public EmployeeLogic(IEmployeeStorage employeeStorage) - { - _employeeStorage = employeeStorage; - } - - public List GetEmployees(EmployeeSearchModel model) - { - var employees = model == null ? _employeeStorage.GetFullList() : _employeeStorage.GetFilteredList(model); - return employees.Select(e => new EmployeeViewModel - { - Id = e.Id, - NameJob = e.NameJob, - StartJob = e.StartJob, - EndJob = e.EndJob, - PartTimeJob = e.PartTimeJob, - Bid = e.Bid, - PhysicalPersonName = e.PhysicalPerson.Name - }).ToList(); - } - - public EmployeeViewModel? GetEmployeeById(int id) - { - var employee = _employeeStorage.GetElement(id); - return employee != null ? new EmployeeViewModel - { - Id = employee.Id, - NameJob = employee.NameJob, - StartJob = employee.StartJob, - EndJob = employee.EndJob, - PartTimeJob = employee.PartTimeJob, - Bid = employee.Bid, - PhysicalPersonName = employee.PhysicalPerson.Name - } : null; - } - public void CreateOrUpdate(EmployeeBindingModel model) { - if (model.Id.HasValue) - { - var existingEmployee = _employeeStorage.GetElement(model.Id.Value); - if (existingEmployee == null) - throw new Exception("Сотрудник не найден"); - - existingEmployee.NameJob = model.NameJob; - existingEmployee.StartJob = model.StartJob; - existingEmployee.EndJob = model.EndJob; - existingEmployee.PartTimeJob = model.PartTimeJob; - existingEmployee.Bid = model.Bid; - existingEmployee.PhysicalPersonId = model.PhysicalPersonId; - - _employeeStorage.Update(existingEmployee); - } - else - { - var newEmployee = new Employee - { - NameJob = model.NameJob, - StartJob = model.StartJob, - EndJob = model.EndJob, - PartTimeJob = model.PartTimeJob, - Bid = model.Bid, - PhysicalPersonId = model.PhysicalPersonId - }; - _employeeStorage.Insert(newEmployee); - } + throw new NotImplementedException(); } public void Delete(int id) { - var employee = _employeeStorage.GetElement(id); - if (employee == null) - throw new Exception("Сотрудник не найден"); - _employeeStorage.Delete(id); + throw new NotImplementedException(); + } + + public EmployeeViewModel? GetEmployeeById(int id) + { + throw new NotImplementedException(); + } + + public List GetEmployees(EmployeeSearchModel model) + { + throw new NotImplementedException(); } } } diff --git a/EmployeeManagmentBusinessLogic/BusinessLogic/PhisicalPersonLogic.cs b/EmployeeManagmentBusinessLogic/BusinessLogic/PhisicalPersonLogic.cs new file mode 100644 index 0000000..7f947bd --- /dev/null +++ b/EmployeeManagmentBusinessLogic/BusinessLogic/PhisicalPersonLogic.cs @@ -0,0 +1,35 @@ +using EmployeeManagmentContracts.BindingModels; +using EmployeeManagmentContracts.BusinessLogicContracts; +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentBusinessLogic.BusinessLogic +{ + public class PhisicalPersonLogic : IPhisicalPersonLogic + { + public void CreateOrUpdate(PhisicalPersonBindingModel model) + { + throw new NotImplementedException(); + } + + public void Delete(int id) + { + throw new NotImplementedException(); + } + + public PhisicalPersonViewModel? GetPhisicalPersonById(int id) + { + throw new NotImplementedException(); + } + + public List GetPhisicalPersons(PhisicalPersonSearchModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs b/EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs index 7278009..245c06b 100644 --- a/EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs +++ b/EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs @@ -8,66 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic { public class SalaryLogic : ISalaryLogic { - private readonly ISalaryStorage _salaryStorage; - - public SalaryLogic(ISalaryStorage salaryStorage) - { - _salaryStorage = salaryStorage; - } - - public List GetSalaries(SalarySearchModel model) - { - var salaries = model == null ? _salaryStorage.GetFullList() : _salaryStorage.GetFilteredList(model); - return salaries.Select(s => new SalaryViewModel - { - Id = s.Id, - CountHours = s.CountHours, - PriceHour = s.PriceHour, - Premium = s.Premium, - Date = s.Date, - Passed = s.Passed, - EmployeeName = s.Employee.NameJob - }).ToList(); - } - public void CreateOrUpdate(SalaryBindingModel model) { - if (model.Id.HasValue) - { - var existingSalary = _salaryStorage.GetElement(model.Id.Value); - if (existingSalary == null) - throw new Exception("Зарплата не найдена"); - - existingSalary.CountHours = model.CountHours; - existingSalary.PriceHour = model.PriceHour; - existingSalary.Premium = model.Premium; - existingSalary.Date = model.Date; - existingSalary.Passed = model.Passed; - existingSalary.EmployeeId = model.EmployeeId; - - _salaryStorage.Update(existingSalary); - } - else - { - var newSalary = new Salary - { - CountHours = model.CountHours, - PriceHour = model.PriceHour, - Premium = model.Premium, - Date = model.Date, - Passed = model.Passed, - EmployeeId = model.EmployeeId - }; - _salaryStorage.Insert(newSalary); - } + throw new NotImplementedException(); } public void Delete(int id) { - var salary = _salaryStorage.GetElement(id); - if (salary == null) - throw new Exception("Зарплата не найдена"); - _salaryStorage.Delete(id); + throw new NotImplementedException(); + } + + public List GetSalaries(SalarySearchModel model) + { + throw new NotImplementedException(); + } + + public SalaryViewModel? GetSalaryById(int id) + { + throw new NotImplementedException(); } } } diff --git a/EmployeeManagmentBusinessLogic/BusinessLogic/VacationLogic.cs b/EmployeeManagmentBusinessLogic/BusinessLogic/VacationLogic.cs index d0a640e..2fc1f7a 100644 --- a/EmployeeManagmentBusinessLogic/BusinessLogic/VacationLogic.cs +++ b/EmployeeManagmentBusinessLogic/BusinessLogic/VacationLogic.cs @@ -8,56 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic { public class VacationLogic : IVacationLogic { - private readonly IVacationStorage _vacationStorage; - - public VacationLogic(IVacationStorage vacationStorage) - { - _vacationStorage = vacationStorage; - } - - public List GetVacations(VacationSearchModel model) - { - return _vacationStorage.GetFilteredList(model).Select(v => new VacationViewModel - { - Id = v.Id, - StartData = v.StartData, - EndData = v.EndData, - Passed = v.Passed, - EmployeeName = v.Employee.NameJob - }).ToList(); - } - public void CreateOrUpdate(VacationBindingModel model) { - if (model.Id.HasValue) - { - var existingVacation = _vacationStorage.GetElement(model.Id.Value); - if (existingVacation == null) - throw new Exception("Отпуск не найден"); - - existingVacation.StartData = model.StartData; - existingVacation.EndData = model.EndData; - existingVacation.Passed = model.Passed; - existingVacation.EmployeeId = model.EmployeeId; - - _vacationStorage.Update(existingVacation); - } - else - { - var newVacation = new Vacation - { - StartData = model.StartData, - EndData = model.EndData, - Passed = model.Passed, - EmployeeId = model.EmployeeId - }; - _vacationStorage.Insert(newVacation); - } + throw new NotImplementedException(); } public void Delete(int id) { - _vacationStorage.Delete(id); + throw new NotImplementedException(); + } + + public VacationViewModel? GetVacationById(int id) + { + throw new NotImplementedException(); + } + + public List GetVacations(VacationSearchModel model) + { + throw new NotImplementedException(); } } } diff --git a/EmployeeManagmentContracts/BindingModels/EmployeeBindingModel.cs b/EmployeeManagmentContracts/BindingModels/EmployeeBindingModel.cs index 47b4f46..574614b 100644 --- a/EmployeeManagmentContracts/BindingModels/EmployeeBindingModel.cs +++ b/EmployeeManagmentContracts/BindingModels/EmployeeBindingModel.cs @@ -14,6 +14,6 @@ namespace EmployeeManagmentContracts.BindingModels public DateTime? EndJob { get; set; } public string? PartTimeJob { get; set; } public float Bid { get; set; } - public int PhysicalPersonId { get; set; } + public int PhisicalPersonId { get; set; } } } diff --git a/EmployeeManagmentContracts/EmployeeManagmentContracts.csproj b/EmployeeManagmentContracts/EmployeeManagmentContracts.csproj index fa71b7a..555f5a4 100644 --- a/EmployeeManagmentContracts/EmployeeManagmentContracts.csproj +++ b/EmployeeManagmentContracts/EmployeeManagmentContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/EmployeeManagmentContracts/StoragesContracts/IEmployeeStorage.cs b/EmployeeManagmentContracts/StoragesContracts/IEmployeeStorage.cs index eab9abd..169488b 100644 --- a/EmployeeManagmentContracts/StoragesContracts/IEmployeeStorage.cs +++ b/EmployeeManagmentContracts/StoragesContracts/IEmployeeStorage.cs @@ -1,4 +1,5 @@ using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; @@ -9,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts { public interface IEmployeeStorage { - List GetFullList(); - List GetFilteredList(EmployeeSearchModel model); - Employee? GetElement(int id); - void Insert(Employee employee); - void Update(Employee employee); + List GetFullList(); + List GetFilteredList(EmployeeSearchModel model); + EmployeeViewModel? GetElement(int id); + void Insert(EmployeeViewModel model); + void Update(EmployeeViewModel model); void Delete(int id); } } diff --git a/EmployeeManagmentContracts/StoragesContracts/IPhisicalPersonStorage.cs b/EmployeeManagmentContracts/StoragesContracts/IPhisicalPersonStorage.cs index cc7738f..b590410 100644 --- a/EmployeeManagmentContracts/StoragesContracts/IPhisicalPersonStorage.cs +++ b/EmployeeManagmentContracts/StoragesContracts/IPhisicalPersonStorage.cs @@ -1,4 +1,6 @@ -using System; +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.ViewModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts { public interface IPhisicalPersonStorage { - List GetFullList(); - List GetFilteredList(PhisicalPersonSearchModel model); - PhisicalPerson? GetElement(int id); - void Insert(PhisicalPerson phisicalPerson); - void Update(PhisicalPerson phisicalPerson); + List GetFullList(); + List GetFilteredList(PhisicalPersonSearchModel model); + PhisicalPersonViewModel? GetElement(int id); + void Insert(PhisicalPersonViewModel model); + void Update(PhisicalPersonViewModel model); void Delete(int id); } } diff --git a/EmployeeManagmentContracts/StoragesContracts/ISalaryStorage.cs b/EmployeeManagmentContracts/StoragesContracts/ISalaryStorage.cs index 90765bf..55700e1 100644 --- a/EmployeeManagmentContracts/StoragesContracts/ISalaryStorage.cs +++ b/EmployeeManagmentContracts/StoragesContracts/ISalaryStorage.cs @@ -1,4 +1,6 @@ -using System; +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.ViewModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts { public interface ISalaryStorage { - List GetFullList(); - List GetFilteredList(SalarySearchModel model); - Salary? GetElement(int id); - void Insert(Salary salary); - void Update(Salary salary); + List GetFullList(); + List GetFilteredList(SalarySearchModel model); + SalaryViewModel? GetElement(int id); + void Insert(SalaryViewModel model); + void Update(SalaryViewModel model); void Delete(int id); } } diff --git a/EmployeeManagmentContracts/StoragesContracts/IVacationStorage.cs b/EmployeeManagmentContracts/StoragesContracts/IVacationStorage.cs index 725beea..889981c 100644 --- a/EmployeeManagmentContracts/StoragesContracts/IVacationStorage.cs +++ b/EmployeeManagmentContracts/StoragesContracts/IVacationStorage.cs @@ -1,4 +1,5 @@ using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; @@ -9,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts { public interface IVacationStorage { - List GetFullList(); - List GetFilteredList(VacationSearchModel model); - Vacation? GetElement(int id); - void Insert(Vacation vacation); - void Update(Vacation vacation); + List GetFullList(); + List GetFilteredList(VacationSearchModel model); + VacationViewModel? GetElement(int id); + void Insert(VacationViewModel model); + void Update(VacationViewModel model); void Delete(int id); } } diff --git a/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs b/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs index d81da75..54b3965 100644 --- a/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs +++ b/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs @@ -14,7 +14,7 @@ namespace EmployeeManagmentContracts.ViewModels public DateTime? EndJob { get; set; } public string? PartTimeJob { get; set; } public float Bid { get; set; } - public string PhysicalPersonName { get; set; } = string.Empty; + public string PhisicalPersonName { get; set; } = string.Empty; } } diff --git a/EmployeeManagmentDataBaseImplement/DatabaseContext.cs b/EmployeeManagmentDataBaseImplement/DatabaseContext.cs deleted file mode 100644 index 311f9ec..0000000 --- a/EmployeeManagmentDataBaseImplement/DatabaseContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EmployeeManagmentDataBaseImplement -{ - public class DatabaseContext : DbContext - { - public DbSet Employees { get; set; } - public DbSet PhysicalPersons { get; set; } - public DbSet Salaries { get; set; } - public DbSet Vacations { get; set; } - - public DatabaseContext(DbContextOptions options) : base(options) { } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - } - } -} diff --git a/EmployeeManagmentDataBaseImplement/EmployeeManagementDbContext .cs b/EmployeeManagmentDataBaseImplement/EmployeeManagementDbContext .cs new file mode 100644 index 0000000..9b8f004 --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/EmployeeManagementDbContext .cs @@ -0,0 +1,23 @@ +using EmployeeManagmentDataBaseImplement.Models; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement +{ + public class EmployeeManagementDbContext : DbContext + { + public DbSet Employees { get; set; } + public DbSet PhisicalPersons { get; set; } + public DbSet Salaries { get; set; } + public DbSet Vacations { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSqlServer("YourConnectionStringHere"); + } + } +} diff --git a/EmployeeManagmentDataBaseImplement/EmployeeManagmentDataBaseImplement.csproj b/EmployeeManagmentDataBaseImplement/EmployeeManagmentDataBaseImplement.csproj index 1b121e1..27a75c4 100644 --- a/EmployeeManagmentDataBaseImplement/EmployeeManagmentDataBaseImplement.csproj +++ b/EmployeeManagmentDataBaseImplement/EmployeeManagmentDataBaseImplement.csproj @@ -25,4 +25,8 @@ + + + + diff --git a/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs index 7d6de22..f3b66dd 100644 --- a/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs +++ b/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs @@ -1,85 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.StoragesContracts; +using EmployeeManagmentContracts.ViewModels; +using EmployeeManagmentDataBaseImplement.Models; namespace EmployeeManagmentDataBaseImplement.Implements { public class EmployeeStorage : IEmployeeStorage { - public List GetFullList() - { - using (var context = new DatabaseContext()) - { - return context.Employees.ToList(); - } - } - - public List GetFilteredList(EmployeeSearchModel searchModel) - { - using (var context = new DatabaseContext()) - { - return context.Employees - .Where(e => searchModel.Name != null && e.Name.Contains(searchModel.Name)) - .ToList(); - } - } - - public Employee? GetElement(EmployeeSearchModel searchModel) - { - using (var context = new DatabaseContext()) - { - return context.Employees.FirstOrDefault(e => e.Id == searchModel.Id); - } - } - - public void Insert(EmployeeBindingModel model) - { - using (var context = new DatabaseContext()) - { - var newEmployee = new Employee - { - Name = model.Name, - StartJob = model.StartJob, - EndJob = model.EndJob, - PartTimeJob = model.PartTimeJob, - Bid = model.Bid, - PhysicalPersonsId = model.PhysicalPersonsId - }; - context.Employees.Add(newEmployee); - context.SaveChanges(); - } - } - - public void Update(EmployeeBindingModel model) - { - using (var context = new DatabaseContext()) - { - var employee = context.Employees.FirstOrDefault(e => e.Id == model.Id); - if (employee == null) - return; - - employee.Name = model.Name; - employee.StartJob = model.StartJob; - employee.EndJob = model.EndJob; - employee.PartTimeJob = model.PartTimeJob; - employee.Bid = model.Bid; - context.SaveChanges(); - } - } - public void Delete(int id) { - using (var context = new DatabaseContext()) - { - var employee = context.Employees.FirstOrDefault(e => e.Id == id); - if (employee != null) - { - context.Employees.Remove(employee); - context.SaveChanges(); - } - } + throw new NotImplementedException(); + } + + public EmployeeViewModel? GetElement(int id) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(EmployeeSearchModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public void Insert(EmployeeViewModel model) + { + throw new NotImplementedException(); + } + + public void Update(EmployeeViewModel model) + { + throw new NotImplementedException(); } } } diff --git a/EmployeeManagmentDataBaseImplement/Implements/PhisicalPersonStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/PhisicalPersonStorage.cs new file mode 100644 index 0000000..d9b2d4a --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Implements/PhisicalPersonStorage.cs @@ -0,0 +1,45 @@ + +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.StoragesContracts; +using EmployeeManagmentContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Implements +{ + public class PhisicalPersonStorage : IPhisicalPersonStorage + { + public void Delete(int id) + { + throw new NotImplementedException(); + } + + public PhisicalPersonViewModel? GetElement(int id) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(PhisicalPersonSearchModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public void Insert(PhisicalPersonViewModel model) + { + throw new NotImplementedException(); + } + + public void Update(PhisicalPersonViewModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/EmployeeManagmentDataBaseImplement/Implements/SalaryStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/SalaryStorage.cs new file mode 100644 index 0000000..0856077 --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Implements/SalaryStorage.cs @@ -0,0 +1,44 @@ +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.StoragesContracts; +using EmployeeManagmentContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Implements +{ + public class SalaryStorage : ISalaryStorage + { + public void Delete(int id) + { + throw new NotImplementedException(); + } + + public SalaryViewModel? GetElement(int id) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(SalarySearchModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public void Insert(SalaryViewModel model) + { + throw new NotImplementedException(); + } + + public void Update(SalaryViewModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs new file mode 100644 index 0000000..ddca03c --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs @@ -0,0 +1,44 @@ +using EmployeeManagmentContracts.SearchModels; +using EmployeeManagmentContracts.StoragesContracts; +using EmployeeManagmentContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Implements +{ + public class VacationStorage : ISalaryStorage + { + public void Delete(int id) + { + throw new NotImplementedException(); + } + + public SalaryViewModel? GetElement(int id) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(SalarySearchModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public void Insert(SalaryViewModel model) + { + throw new NotImplementedException(); + } + + public void Update(SalaryViewModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/EmployeeManagmentDataBaseImplement/Models/Employee.cs b/EmployeeManagmentDataBaseImplement/Models/Employee.cs index ee3b1ae..b3127ab 100644 --- a/EmployeeManagmentDataBaseImplement/Models/Employee.cs +++ b/EmployeeManagmentDataBaseImplement/Models/Employee.cs @@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; +using EmployeeManagmentDataModels.Models; namespace EmployeeManagmentDataBaseImplement.Models { diff --git a/EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs b/EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs new file mode 100644 index 0000000..4f91348 --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Models +{ + public class PhisicalPerson + { + [Key] + public int Id { get; set; } + [Required] + public string Name { get; set; } = string.Empty; + [Required] + public string Surname { get; set; } = string.Empty; + public string? Patronymic { get; set; } + 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; + + // Связь с сотрудниками + public List? Employees { get; set; } + } +} diff --git a/EmployeeManagmentDataBaseImplement/Models/Salary.cs b/EmployeeManagmentDataBaseImplement/Models/Salary.cs new file mode 100644 index 0000000..f779912 --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Models/Salary.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Models +{ + public class Salary + { + } +} diff --git a/EmployeeManagmentDataBaseImplement/Models/Vacation.cs b/EmployeeManagmentDataBaseImplement/Models/Vacation.cs new file mode 100644 index 0000000..bce5880 --- /dev/null +++ b/EmployeeManagmentDataBaseImplement/Models/Vacation.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EmployeeManagmentDataBaseImplement.Models +{ + public class Vacation + { + } +} diff --git a/EmployeeManagmentDataModels/Enums/VacationStatus.cs b/EmployeeManagmentDataModels/Enums/VacationStatus.cs index b0aeb1a..f15f7d4 100644 --- a/EmployeeManagmentDataModels/Enums/VacationStatus.cs +++ b/EmployeeManagmentDataModels/Enums/VacationStatus.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace EmployeeManagmentDataModels.Enums { - internal class VacationStatus + public enum VacationStatus { + Planned, // Запланированный отпуск + Approved, // Одобренный отпуск + Taken // Отпуск использован } } diff --git a/EmployeeManagmentView/EmployeesWindow.xaml b/EmployeeManagmentView/EmployeesWindow.xaml new file mode 100644 index 0000000..d7487bb --- /dev/null +++ b/EmployeeManagmentView/EmployeesWindow.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/EmployeeManagmentView/EmployeesWindow.xaml.cs b/EmployeeManagmentView/EmployeesWindow.xaml.cs new file mode 100644 index 0000000..0c77d29 --- /dev/null +++ b/EmployeeManagmentView/EmployeesWindow.xaml.cs @@ -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 EmployeeManagmentView +{ + /// + /// Логика взаимодействия для EmployeesWindow.xaml + /// + public partial class EmployeesWindow : Window + { + public EmployeesWindow() + { + InitializeComponent(); + } + } +} diff --git a/EmployeeManagmentView/SalariesWindow.xaml b/EmployeeManagmentView/SalariesWindow.xaml new file mode 100644 index 0000000..2e4b01d --- /dev/null +++ b/EmployeeManagmentView/SalariesWindow.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/EmployeeManagmentView/SalariesWindow.xaml.cs b/EmployeeManagmentView/SalariesWindow.xaml.cs new file mode 100644 index 0000000..757b4fa --- /dev/null +++ b/EmployeeManagmentView/SalariesWindow.xaml.cs @@ -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 EmployeeManagmentView +{ + /// + /// Логика взаимодействия для SalariesWindow.xaml + /// + public partial class SalariesWindow : Window + { + public SalariesWindow() + { + InitializeComponent(); + } + } +} diff --git a/EmployeeManagmentView/VacationsWindow.xaml b/EmployeeManagmentView/VacationsWindow.xaml new file mode 100644 index 0000000..dca1565 --- /dev/null +++ b/EmployeeManagmentView/VacationsWindow.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/EmployeeManagmentView/VacationsWindow.xaml.cs b/EmployeeManagmentView/VacationsWindow.xaml.cs new file mode 100644 index 0000000..961887c --- /dev/null +++ b/EmployeeManagmentView/VacationsWindow.xaml.cs @@ -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 EmployeeManagmentView +{ + /// + /// Логика взаимодействия для VacationsWindow.xaml + /// + public partial class VacationsWindow : Window + { + public VacationsWindow() + { + InitializeComponent(); + } + } +}