Esempio n. 1
0
        public JobPosition AssignJobPosition(PeriodId periodId, SharedJobPositionId sharedJobPositionId,
                                             SharedJobPositionId parentSharedJobPositionId, JobId jobId, UnitId unitId)
        {
            using (var tr = new TransactionScope())
            {
                var period            = periodRep.GetById(periodId);
                var sharedJobPosition = pmsAdminService.GetSharedJobPosition(sharedJobPositionId);
                var job  = jobRepository.GetById(jobId);
                var unit = unitRep.GetBy(unitId);

                JobPosition parent = null;
                if (parentSharedJobPositionId != null)
                {
                    parent = jobPositionRep.GetBy(new JobPositionId(periodId, parentSharedJobPositionId));
                }

                var jobPosition = new JobPosition(period, sharedJobPosition, parent, job, unit);
                jobPositionRep.Add(jobPosition);
                tr.Complete();
                return(jobPosition);
            }
        }
Esempio n. 2
0
        private EmployeeJobPositionsDTO mapToEmployeeJobPositionDTO(Employee employee)
        {
            //todo:(LOW)Must convert to Mapper
            var employeeJobPosition = new EmployeeJobPositionsDTO
            {
                EmployeeNo = employee.Id.EmployeeNo,
                PeriodId   = employee.Id.PeriodId.Id
            };

            employeeJobPosition.EmployeeJobPositionAssignmentList = new List <EmployeeJobPositionAssignmentDTO>();
            foreach (var itm in employee.JobPositions)
            {
                var employeeJobPositionAssignmentDTO = new EmployeeJobPositionAssignmentDTO
                {
                    JobPositionName   = converter.GetSharedJobPosition(itm.JobPositionId.SharedJobPositionId).Name,
                    JobPositionId     = itm.JobPositionId.SharedJobPositionId.Id,
                    FromDate          = itm.FromDate,
                    ToDate            = itm.ToDate,
                    WorkTimePercent   = itm.WorkTimePercent,
                    JobPositionWeight = itm.JobPositionWeight,
                    ActionCodes       = new List <int>
                    {
                        (int)ActionType.ModifyEmployeeJobCustomFields,
                    }
                };
                employeeJobPositionAssignmentDTO.CustomFieldValueList = new List <CustomFieldValueDTO>();
                foreach (var employeeJobCustomFieldValue in itm.EmployeeJobCustomFieldValues)
                {
                    employeeJobPositionAssignmentDTO.CustomFieldValueList.Add(new CustomFieldValueDTO
                    {
                        Id    = employeeJobCustomFieldValue.JobCustomFieldId.SharedJobCustomFieldId.Id,
                        Value = employeeJobCustomFieldValue.JobCustomFieldValue
                    });
                }
                employeeJobPosition.EmployeeJobPositionAssignmentList.Add(employeeJobPositionAssignmentDTO);
            }
            return(employeeJobPosition);
        }