public void Handle(AddDeductionsSalaryCommand command) { var employee = new B_Employee(); employee.SetId(command.SalaryDeductionsDto.EmployeeId); var value = new B_SalaryDeductions() { Employee = employee, Amount = command.SalaryDeductionsDto.Amount, FromDate = command.SalaryDeductionsDto.FromDate, ToDate = command.SalaryDeductionsDto.ToDate, SalaryDeductionsType = (SalaryDeductionsType)command.SalaryDeductionsDto.SalaryDeductionsType, ContractNumber = command.SalaryDeductionsDto.ContractNumber, FirstInstallmentCapital = command.SalaryDeductionsDto.FirstInstallmentCapital, FirstInstallmentInterest = command.SalaryDeductionsDto.FirstInstallmentInterest, MonthlyCycle = command.SalaryDeductionsDto.MonthlyCycle, RegistrationNumber = command.SalaryDeductionsDto.RegistrationNumber }; SalaryDeductionsRepository.Save(value, command.SalaryDeductionsDto.UserId); command.ReturnValue = value.Id; command.Success = true; }
public EditAllocationStructureResultDto EditAllocationStructure(EditAllocationStructureResultDto editAllocationStructureResultDto) { var employeeMembership = EmployeeMembershipRepository.Load(editAllocationStructureResultDto.EmployeeMembershipId); var section = new B_Section(); var organizationalCell = new B_OrganizationalCell(); var organizationalUnit = new B_OrganizationalUnit(); var employee = new B_Employee(); section.SetId(editAllocationStructureResultDto.SectionId); organizationalUnit.SetId(editAllocationStructureResultDto.OrganizationalUnitId); organizationalCell.SetId(editAllocationStructureResultDto.OrganizationalCellId); employee.SetId(editAllocationStructureResultDto.DirectSupervisorId); if (editAllocationStructureResultDto.SectionId == 0) { section = null; } if (editAllocationStructureResultDto.OrganizationalCellId == 0) { organizationalCell = null; } if (editAllocationStructureResultDto.OrganizationalUnitId == 0) { organizationalUnit = null; } if (editAllocationStructureResultDto.DirectSupervisorId == 0) { employee = null; } employeeMembership.Position = editAllocationStructureResultDto.Position; employeeMembership.Section = section; employeeMembership.OrganizationalCell = organizationalCell; employeeMembership.OrganizationalUnit = organizationalUnit; employeeMembership.DirectSupervisor = employee; EmployeeMembershipRepository.SaveAndFlush(employeeMembership, editAllocationStructureResultDto.UserId); editAllocationStructureResultDto.Success = true; return(editAllocationStructureResultDto); }
public StructureAndLocationResultDto SaveCoefficients(StructureAndLocationDto structureAndLocationDto) { B_EmployeeMembershipCoefficients coefficients; B_OrganizationalUnit organizationalUnit = new B_OrganizationalUnit(); B_OrganizationalCell organizationalCell = new B_OrganizationalCell(); B_Silo silo = new B_Silo(); organizationalUnit.SetId(structureAndLocationDto.OrganizationalUnitId); organizationalCell.SetId(structureAndLocationDto.OrganizationalCellId); silo.SetId(structureAndLocationDto.SiloId); if (structureAndLocationDto.Id == 0) { var employee = new B_Employee(); employee.SetId(structureAndLocationDto.EmployeeId); coefficients = new B_EmployeeMembershipCoefficients() { Employee = employee, FromDate = DateTime.Now, }; } else { coefficients = EmployeeMembershipCoefficientsRepository.Load(structureAndLocationDto.Id); } coefficients.OrganizationalUnit = organizationalUnit; coefficients.OrganizationalCell = organizationalCell; coefficients.Silo = silo; coefficients.Coefficient = (float)structureAndLocationDto.Coefficient; EmployeeMembershipCoefficientsRepository.SaveAndFlush(coefficients, structureAndLocationDto.UserId); var result = new StructureAndLocationResultDto(); result.Success = true; result.Id = coefficients.Id; return(result); }
public int AddDeductionsSalary(SalaryDeductionsDto salaryDeductionsDto) { var employee = new B_Employee(); employee.SetId(salaryDeductionsDto.EmployeeId); var value = new B_SalaryDeductions() { Employee = employee, Amount = salaryDeductionsDto.Amount, FromDate = salaryDeductionsDto.FromDate, ToDate = salaryDeductionsDto.ToDate, SalaryDeductionsType = (SalaryDeductionsType)salaryDeductionsDto.SalaryDeductionsType, ContractNumber = salaryDeductionsDto.ContractNumber, FirstInstallmentCapital = salaryDeductionsDto.FirstInstallmentCapital, FirstInstallmentInterest = salaryDeductionsDto.FirstInstallmentInterest, MonthlyCycle = salaryDeductionsDto.MonthlyCycle, RegistrationNumber = salaryDeductionsDto.RegistrationNumber }; SalaryDeductionsRepository.SaveAndFlush(value, salaryDeductionsDto.UserId); return(value.Id); }