Добавлены все файлы.
В некоторых файлах, основанных на интерфейсах, стоят заглушки. Создана несколько экранов, которые также являются заглушками.
This commit is contained in:
parent
ab2c31aa99
commit
1ddd362ab7
@ -8,81 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
public class EmployeeLogic : IEmployeeLogic
|
public class EmployeeLogic : IEmployeeLogic
|
||||||
{
|
{
|
||||||
private readonly IEmployeeStorage _employeeStorage;
|
|
||||||
|
|
||||||
public EmployeeLogic(IEmployeeStorage employeeStorage)
|
|
||||||
{
|
|
||||||
_employeeStorage = employeeStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<EmployeeViewModel> 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)
|
public void CreateOrUpdate(EmployeeBindingModel model)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue)
|
throw new NotImplementedException();
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
var employee = _employeeStorage.GetElement(id);
|
throw new NotImplementedException();
|
||||||
if (employee == null)
|
}
|
||||||
throw new Exception("Сотрудник не найден");
|
|
||||||
_employeeStorage.Delete(id);
|
public EmployeeViewModel? GetEmployeeById(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EmployeeViewModel> GetEmployees(EmployeeSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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<PhisicalPersonViewModel> GetPhisicalPersons(PhisicalPersonSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,66 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
public class SalaryLogic : ISalaryLogic
|
public class SalaryLogic : ISalaryLogic
|
||||||
{
|
{
|
||||||
private readonly ISalaryStorage _salaryStorage;
|
|
||||||
|
|
||||||
public SalaryLogic(ISalaryStorage salaryStorage)
|
|
||||||
{
|
|
||||||
_salaryStorage = salaryStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SalaryViewModel> 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)
|
public void CreateOrUpdate(SalaryBindingModel model)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue)
|
throw new NotImplementedException();
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
var salary = _salaryStorage.GetElement(id);
|
throw new NotImplementedException();
|
||||||
if (salary == null)
|
}
|
||||||
throw new Exception("Зарплата не найдена");
|
|
||||||
_salaryStorage.Delete(id);
|
public List<SalaryViewModel> GetSalaries(SalarySearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SalaryViewModel? GetSalaryById(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,56 +8,24 @@ namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
public class VacationLogic : IVacationLogic
|
public class VacationLogic : IVacationLogic
|
||||||
{
|
{
|
||||||
private readonly IVacationStorage _vacationStorage;
|
|
||||||
|
|
||||||
public VacationLogic(IVacationStorage vacationStorage)
|
|
||||||
{
|
|
||||||
_vacationStorage = vacationStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VacationViewModel> 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)
|
public void CreateOrUpdate(VacationBindingModel model)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue)
|
throw new NotImplementedException();
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_vacationStorage.Delete(id);
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VacationViewModel? GetVacationById(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VacationViewModel> GetVacations(VacationSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ namespace EmployeeManagmentContracts.BindingModels
|
|||||||
public DateTime? EndJob { get; set; }
|
public DateTime? EndJob { get; set; }
|
||||||
public string? PartTimeJob { get; set; }
|
public string? PartTimeJob { get; set; }
|
||||||
public float Bid { get; set; }
|
public float Bid { get; set; }
|
||||||
public int PhysicalPersonId { get; set; }
|
public int PhisicalPersonId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,8 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\EmployeeManagmentDataModels\EmployeeManagmentDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using EmployeeManagmentContracts.SearchModels;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -9,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts
|
|||||||
{
|
{
|
||||||
public interface IEmployeeStorage
|
public interface IEmployeeStorage
|
||||||
{
|
{
|
||||||
List<Employee> GetFullList();
|
List<EmployeeViewModel> GetFullList();
|
||||||
List<Employee> GetFilteredList(EmployeeSearchModel model);
|
List<EmployeeViewModel> GetFilteredList(EmployeeSearchModel model);
|
||||||
Employee? GetElement(int id);
|
EmployeeViewModel? GetElement(int id);
|
||||||
void Insert(Employee employee);
|
void Insert(EmployeeViewModel model);
|
||||||
void Update(Employee employee);
|
void Update(EmployeeViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts
|
|||||||
{
|
{
|
||||||
public interface IPhisicalPersonStorage
|
public interface IPhisicalPersonStorage
|
||||||
{
|
{
|
||||||
List<PhisicalPerson> GetFullList();
|
List<PhisicalPersonViewModel> GetFullList();
|
||||||
List<PhisicalPerson> GetFilteredList(PhisicalPersonSearchModel model);
|
List<PhisicalPersonViewModel> GetFilteredList(PhisicalPersonSearchModel model);
|
||||||
PhisicalPerson? GetElement(int id);
|
PhisicalPersonViewModel? GetElement(int id);
|
||||||
void Insert(PhisicalPerson phisicalPerson);
|
void Insert(PhisicalPersonViewModel model);
|
||||||
void Update(PhisicalPerson phisicalPerson);
|
void Update(PhisicalPersonViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts
|
|||||||
{
|
{
|
||||||
public interface ISalaryStorage
|
public interface ISalaryStorage
|
||||||
{
|
{
|
||||||
List<Salary> GetFullList();
|
List<SalaryViewModel> GetFullList();
|
||||||
List<Salary> GetFilteredList(SalarySearchModel model);
|
List<SalaryViewModel> GetFilteredList(SalarySearchModel model);
|
||||||
Salary? GetElement(int id);
|
SalaryViewModel? GetElement(int id);
|
||||||
void Insert(Salary salary);
|
void Insert(SalaryViewModel model);
|
||||||
void Update(Salary salary);
|
void Update(SalaryViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using EmployeeManagmentContracts.SearchModels;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -9,11 +10,11 @@ namespace EmployeeManagmentContracts.StoragesContracts
|
|||||||
{
|
{
|
||||||
public interface IVacationStorage
|
public interface IVacationStorage
|
||||||
{
|
{
|
||||||
List<Vacation> GetFullList();
|
List<VacationViewModel> GetFullList();
|
||||||
List<Vacation> GetFilteredList(VacationSearchModel model);
|
List<VacationViewModel> GetFilteredList(VacationSearchModel model);
|
||||||
Vacation? GetElement(int id);
|
VacationViewModel? GetElement(int id);
|
||||||
void Insert(Vacation vacation);
|
void Insert(VacationViewModel model);
|
||||||
void Update(Vacation vacation);
|
void Update(VacationViewModel model);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace EmployeeManagmentContracts.ViewModels
|
|||||||
public DateTime? EndJob { get; set; }
|
public DateTime? EndJob { get; set; }
|
||||||
public string? PartTimeJob { get; set; }
|
public string? PartTimeJob { get; set; }
|
||||||
public float Bid { get; set; }
|
public float Bid { get; set; }
|
||||||
public string PhysicalPersonName { get; set; } = string.Empty;
|
public string PhisicalPersonName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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<Employee> Employees { get; set; }
|
|
||||||
public DbSet<PhysicalPerson> PhysicalPersons { get; set; }
|
|
||||||
public DbSet<Salary> Salaries { get; set; }
|
|
||||||
public DbSet<Vacation> Vacations { get; set; }
|
|
||||||
|
|
||||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<Employee> Employees { get; set; }
|
||||||
|
public DbSet<PhisicalPerson> PhisicalPersons { get; set; }
|
||||||
|
public DbSet<Salary> Salaries { get; set; }
|
||||||
|
public DbSet<Vacation> Vacations { get; set; }
|
||||||
|
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseSqlServer("YourConnectionStringHere");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,4 +25,8 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\EmployeeManagmentContracts\EmployeeManagmentContracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,85 +1,40 @@
|
|||||||
using System;
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
using System.Collections.Generic;
|
using EmployeeManagmentContracts.StoragesContracts;
|
||||||
using System.Linq;
|
using EmployeeManagmentContracts.ViewModels;
|
||||||
using System.Text;
|
using EmployeeManagmentDataBaseImplement.Models;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EmployeeManagmentDataBaseImplement.Implements
|
namespace EmployeeManagmentDataBaseImplement.Implements
|
||||||
{
|
{
|
||||||
public class EmployeeStorage : IEmployeeStorage
|
public class EmployeeStorage : IEmployeeStorage
|
||||||
{
|
{
|
||||||
public List<Employee> GetFullList()
|
|
||||||
{
|
|
||||||
using (var context = new DatabaseContext())
|
|
||||||
{
|
|
||||||
return context.Employees.ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Employee> 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)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
throw new NotImplementedException();
|
||||||
{
|
}
|
||||||
var employee = context.Employees.FirstOrDefault(e => e.Id == id);
|
|
||||||
if (employee != null)
|
public EmployeeViewModel? GetElement(int id)
|
||||||
{
|
{
|
||||||
context.Employees.Remove(employee);
|
throw new NotImplementedException();
|
||||||
context.SaveChanges();
|
}
|
||||||
}
|
|
||||||
}
|
public List<EmployeeViewModel> GetFilteredList(EmployeeSearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EmployeeViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(EmployeeViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(EmployeeViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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<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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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<SalaryViewModel> GetFilteredList(SalarySearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SalaryViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(SalaryViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(SalaryViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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<SalaryViewModel> GetFilteredList(SalarySearchModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SalaryViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Insert(SalaryViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(SalaryViewModel model)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using EmployeeManagmentDataModels.Models;
|
||||||
|
|
||||||
namespace EmployeeManagmentDataBaseImplement.Models
|
namespace EmployeeManagmentDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
|
27
EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs
Normal file
27
EmployeeManagmentDataBaseImplement/Models/PhisicalPerson.cs
Normal file
@ -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<Employee>? Employees { get; set; }
|
||||||
|
}
|
||||||
|
}
|
12
EmployeeManagmentDataBaseImplement/Models/Salary.cs
Normal file
12
EmployeeManagmentDataBaseImplement/Models/Salary.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
EmployeeManagmentDataBaseImplement/Models/Vacation.cs
Normal file
12
EmployeeManagmentDataBaseImplement/Models/Vacation.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace EmployeeManagmentDataModels.Enums
|
namespace EmployeeManagmentDataModels.Enums
|
||||||
{
|
{
|
||||||
internal class VacationStatus
|
public enum VacationStatus
|
||||||
{
|
{
|
||||||
|
Planned, // Запланированный отпуск
|
||||||
|
Approved, // Одобренный отпуск
|
||||||
|
Taken // Отпуск использован
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
EmployeeManagmentView/EmployeesWindow.xaml
Normal file
8
EmployeeManagmentView/EmployeesWindow.xaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<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>
|
27
EmployeeManagmentView/EmployeesWindow.xaml.cs
Normal file
27
EmployeeManagmentView/EmployeesWindow.xaml.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для EmployeesWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EmployeesWindow : Window
|
||||||
|
{
|
||||||
|
public EmployeesWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
EmployeeManagmentView/SalariesWindow.xaml
Normal file
8
EmployeeManagmentView/SalariesWindow.xaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<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>
|
27
EmployeeManagmentView/SalariesWindow.xaml.cs
Normal file
27
EmployeeManagmentView/SalariesWindow.xaml.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для SalariesWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SalariesWindow : Window
|
||||||
|
{
|
||||||
|
public SalariesWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
EmployeeManagmentView/VacationsWindow.xaml
Normal file
8
EmployeeManagmentView/VacationsWindow.xaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<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>
|
27
EmployeeManagmentView/VacationsWindow.xaml.cs
Normal file
27
EmployeeManagmentView/VacationsWindow.xaml.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для VacationsWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class VacationsWindow : Window
|
||||||
|
{
|
||||||
|
public VacationsWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user