Добавил несколько элементов, настройка структуру. Осталось соедение базы данных.
This commit is contained in:
parent
33cfabdffa
commit
8f5c5c1b0a
@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeManagmentView", "Em
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeManagmentContracts", "EmployeeManagmentContracts\EmployeeManagmentContracts.csproj", "{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeManagmentContracts", "EmployeeManagmentContracts\EmployeeManagmentContracts.csproj", "{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeManagmentBusinessLogic", "EmployeeManagmentBusinessLogic\EmployeeManagmentBusinessLogic.csproj", "{00B118F5-6A3C-4606-8947-88D0288AEFDB}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeManagmentDataModels", "EmployeeManagmentDataModels\EmployeeManagmentDataModels.csproj", "{C5293211-E924-4CFA-9DE5-69003D8C9F48}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -21,6 +25,14 @@ Global
|
|||||||
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{81DBCB6A-C1AD-4DC2-A016-C0ACB64AE2A7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{00B118F5-6A3C-4606-8947-88D0288AEFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{00B118F5-6A3C-4606-8947-88D0288AEFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{00B118F5-6A3C-4606-8947-88D0288AEFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{00B118F5-6A3C-4606-8947-88D0288AEFDB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C5293211-E924-4CFA-9DE5-69003D8C9F48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C5293211-E924-4CFA-9DE5-69003D8C9F48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C5293211-E924-4CFA-9DE5-69003D8C9F48}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C5293211-E924-4CFA-9DE5-69003D8C9F48}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
var employee = _employeeStorage.GetElement(id);
|
||||||
|
if (employee == null)
|
||||||
|
throw new Exception("Сотрудник не найден");
|
||||||
|
_employeeStorage.Delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
73
EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs
Normal file
73
EmployeeManagmentBusinessLogic/BusinessLogic/SalaryLogic.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
var salary = _salaryStorage.GetElement(id);
|
||||||
|
if (salary == null)
|
||||||
|
throw new Exception("Зарплата не найдена");
|
||||||
|
_salaryStorage.Delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
_vacationStorage.Delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class EmployeeBindingModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public string NameJob { get; set; } = string.Empty;
|
||||||
|
public DateTime StartJob { get; set; }
|
||||||
|
public DateTime? EndJob { get; set; }
|
||||||
|
public string? PartTimeJob { get; set; }
|
||||||
|
public float Bid { get; set; }
|
||||||
|
public int PhysicalPersonId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class SalaryBindingModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public int CountHours { get; set; }
|
||||||
|
public float PriceHour { get; set; }
|
||||||
|
public float? Premium { get; set; }
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
public bool Passed { get; set; }
|
||||||
|
public int EmployeeId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using EmployeeManagmentContracts.BindingModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.BusinessLogicContracts
|
||||||
|
{
|
||||||
|
public interface IEmployeeLogic
|
||||||
|
{
|
||||||
|
List<EmployeeViewModel> GetEmployees(EmployeeSearchModel model);
|
||||||
|
EmployeeViewModel? GetEmployeeById(int id);
|
||||||
|
void CreateOrUpdate(EmployeeBindingModel model);
|
||||||
|
void Delete(int id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using EmployeeManagmentContracts.BindingModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.BusinessLogicContracts
|
||||||
|
{
|
||||||
|
public interface ISalaryLogic
|
||||||
|
{
|
||||||
|
List<SalaryViewModel> GetSalaries(SalarySearchModel model);
|
||||||
|
SalaryViewModel? GetSalaryById(int id);
|
||||||
|
void CreateOrUpdate(SalaryBindingModel model);
|
||||||
|
void Delete(int id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
namespace EmployeeManagmentContracts
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class EmployeeSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public string? NameJob { get; set; }
|
||||||
|
public DateTime? StartDateFrom { get; set; }
|
||||||
|
public DateTime? StartDateTo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class VacationSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public int? EmployeeId { get; set; }
|
||||||
|
public DateTime? StartData { get; set; }
|
||||||
|
public DateTime? EndData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using EmployeeManagmentContracts.SearchModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IEmployeeStorage
|
||||||
|
{
|
||||||
|
List<Employee> GetFullList();
|
||||||
|
List<Employee> GetFilteredList(EmployeeSearchModel model);
|
||||||
|
Employee? GetElement(int id);
|
||||||
|
void Insert(Employee employee);
|
||||||
|
void Update(Employee employee);
|
||||||
|
void Delete(int id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface ISalaryStorage
|
||||||
|
{
|
||||||
|
List<Salary> GetFullList();
|
||||||
|
List<Salary> GetFilteredList(SalarySearchModel model);
|
||||||
|
Salary? GetElement(int id);
|
||||||
|
void Insert(Salary salary);
|
||||||
|
void Update(Salary salary);
|
||||||
|
void Delete(int id);
|
||||||
|
}
|
||||||
|
}
|
20
EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs
Normal file
20
EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class EmployeeViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string NameJob { get; set; } = string.Empty;
|
||||||
|
public DateTime StartJob { get; set; }
|
||||||
|
public DateTime? EndJob { get; set; }
|
||||||
|
public string? PartTimeJob { get; set; }
|
||||||
|
public float Bid { get; set; }
|
||||||
|
public string PhysicalPersonName { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
EmployeeManagmentContracts/ViewModels/SalaryViewModel.cs
Normal file
19
EmployeeManagmentContracts/ViewModels/SalaryViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class SalaryViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CountHours { get; set; }
|
||||||
|
public float PriceHour { get; set; }
|
||||||
|
public float? Premium { get; set; }
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
public bool Passed { get; set; }
|
||||||
|
public string EmployeeName { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
15
EmployeeManagmentDataModels/Enums/JobType.cs
Normal file
15
EmployeeManagmentDataModels/Enums/JobType.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Enums
|
||||||
|
{
|
||||||
|
public enum JobType
|
||||||
|
{
|
||||||
|
FullTime, // Полная занятость
|
||||||
|
PartTime, // Неполная занятость
|
||||||
|
Internship // Стажировка
|
||||||
|
}
|
||||||
|
}
|
12
EmployeeManagmentDataModels/Enums/VacationStatus.cs
Normal file
12
EmployeeManagmentDataModels/Enums/VacationStatus.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Enums
|
||||||
|
{
|
||||||
|
internal class VacationStatus
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
25
EmployeeManagmentDataModels/Models/Employee.cs
Normal file
25
EmployeeManagmentDataModels/Models/Employee.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using EmployeeManagmentDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Models
|
||||||
|
{
|
||||||
|
public class Employee
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string NameJob { get; set; } = string.Empty;
|
||||||
|
public DateTime StartJob { get; set; }
|
||||||
|
public DateTime? EndJob { get; set; }
|
||||||
|
public JobType PartTimeJob { get; set; }
|
||||||
|
public decimal Bid { get; set; } // Ставка
|
||||||
|
public int PhysicalPersonId { get; set; }
|
||||||
|
|
||||||
|
// Связь с физическим лицом
|
||||||
|
public PhysicalPerson? PhysicalPerson { get; set; }
|
||||||
|
public List<Salary>? Salaries { get; set; }
|
||||||
|
public List<Vacation>? Vacations { get; set; }
|
||||||
|
}
|
||||||
|
}
|
19
EmployeeManagmentDataModels/Models/PhysicalPerson.cs
Normal file
19
EmployeeManagmentDataModels/Models/PhysicalPerson.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Models
|
||||||
|
{
|
||||||
|
public class PhysicalPerson
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public DateTime BirthDate { get; set; }
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
// Связь с сотрудниками
|
||||||
|
public List<Employee>? Employees { get; set; }
|
||||||
|
}
|
||||||
|
}
|
22
EmployeeManagmentDataModels/Models/Salary.cs
Normal file
22
EmployeeManagmentDataModels/Models/Salary.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Models
|
||||||
|
{
|
||||||
|
public class Salary
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CountHours { get; set; }
|
||||||
|
public decimal PriceHour { get; set; }
|
||||||
|
public decimal Premium { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public bool Passed { get; set; }
|
||||||
|
public int EmployeeId { get; set; }
|
||||||
|
|
||||||
|
// Связь с сотрудником
|
||||||
|
public Employee? Employee { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
EmployeeManagmentDataModels/Models/Vacation.cs
Normal file
21
EmployeeManagmentDataModels/Models/Vacation.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using EmployeeManagmentDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Models
|
||||||
|
{
|
||||||
|
public class Vacation
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime StartData { get; set; }
|
||||||
|
public DateTime EndData { get; set; }
|
||||||
|
public VacationStatus Passed { get; set; }
|
||||||
|
public int EmployeeId { get; set; }
|
||||||
|
|
||||||
|
// Связь с сотрудником
|
||||||
|
public Employee? Employee { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,31 @@
|
|||||||
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"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:EmployeeManagmentView"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="Employee Management System"
|
||||||
|
Height="450" Width="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Система управления сотрудниками"
|
||||||
|
FontSize="24"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Margin="10"/>
|
||||||
|
|
||||||
|
<Button Content="Просмотр сотрудников"
|
||||||
|
Width="200"
|
||||||
|
Height="40"
|
||||||
|
Margin="10"
|
||||||
|
Click="ViewEmployees_Click"/>
|
||||||
|
<Button Content="Управление зарплатами"
|
||||||
|
Width="200"
|
||||||
|
Height="40"
|
||||||
|
Margin="10"
|
||||||
|
Click="ManageSalaries_Click"/>
|
||||||
|
<Button Content="Управление отпусками"
|
||||||
|
Width="200"
|
||||||
|
Height="40"
|
||||||
|
Margin="10"
|
||||||
|
Click="ManageVacations_Click"/>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -20,5 +20,26 @@ namespace EmployeeManagmentView
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ViewEmployees_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// Логика для открытия окна просмотра сотрудников
|
||||||
|
var employeesWindow = new EmployeesWindow();
|
||||||
|
employeesWindow.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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user