public static void CreateJobPosition(IJobPositionRepository jobPositionRepository, string name, string dictionaryName) { var jobPosition = new JobPosition(jobPositionRepository.GetNextId(), name, dictionaryName); jobPositionRepository.Add(jobPosition); JobPositions.Add(jobPosition); }
public static JobPosition CreateJobPosition(IJobPositionRepository jobPositionRepository, PMSAdmin.Domain.Model.JobPositions.JobPosition adminJobPosition, JobPosition parent, Job job, Unit unit, Dictionary <string, List <string> > indexValues) { var jobPosition = new JobPosition(Period, new SharedJobPosition(new SharedJobPositionId(adminJobPosition.Id.Id), adminJobPosition.Name, adminJobPosition.DictionaryName), parent, job, unit); jobPositionRepository.Add(jobPosition); JobPositions.Add(jobPosition, indexValues); return(jobPosition); }
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); } }
public async Task <CreateJobPositionResult> Handle(CreateJobPosition command) { var jobPositionId = Guid.NewGuid(); var entity = new JobPositionEntity { Id = jobPositionId, Template = new TemplateEntity { Questions = new List <QuestionEntity>() } }; entity.Update(command.JobPosition); _jobPositionRepository.Add(entity); await _unitOfWork.SaveChangesAsync(); return(new CreateJobPositionResult { JobPositionId = jobPositionId }); }
public JobPosition AddJobPosition(string name, string dictionaryName, Guid transferId) { try { using (var scope = new TransactionScope()) { var id = jobPositionRep.GetNextId(); var jobPosition = new JobPosition(id, name, dictionaryName); jobPosition.TransferId = transferId; jobPositionRep.Add(jobPosition); scope.Complete(); return(jobPosition); } } catch (Exception exp) { var res = jobPositionRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }