Beispiel #1
0
        public StructureAndLocationResultDto DeleteCoefficients(StructureAndLocationDto structureAndLocationDto)
        {
            EmployeeMembershipCoefficientsRepository.Delete(structureAndLocationDto.Id, structureAndLocationDto.UserId);

            var result = new StructureAndLocationResultDto();

            result.Success = true;

            return(result);
        }
Beispiel #2
0
        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);
        }