Example #1
0
        public Job AssignJob(JobId jobId, List <SharedJobCustomFieldId> customFieldIdList, IList <JobIndexForJob> jobIndexList)
        {
            using (var tr = new TransactionScope())
            {
                var period    = periodRep.GetById(jobId.PeriodId);
                var sharedJob = pmsAdminService.GetSharedJob(jobId.SharedJobId);

                var sharedJobCustomFields = pmsAdminService.GetSharedCutomFieldListForJob(jobId.SharedJobId, customFieldIdList);

                var jobCustomFields = new List <JobCustomField>();
                foreach (var sharedJobCustomField in sharedJobCustomFields)
                {
                    jobCustomFields.Add(new JobCustomField(new JobCustomFieldId(period.Id, sharedJobCustomField.Id, jobId.SharedJobId),
                                                           sharedJobCustomField
                                                           ));
                }
                var jobIndexIds = jobIndexList.Select(jj => jj.JobIndexId).ToList();
                var jobIndices  = jobIndexRep.FindJobIndices(jobIndexIds);
                //job.UpdateJobIndices(jobIndices.ToList());
                var jobJobInddices = new List <JobJobIndex>();
                foreach (var jobIndex in jobIndices)
                {
                    var jobindexForJob = jobIndexList.Single(j => j.JobIndexId == jobIndex.Id);
                    jobJobInddices.Add(new JobJobIndex(jobIndex.Id, jobindexForJob.ShowforTopLevel, jobindexForJob.ShowforSameLevel, jobindexForJob.ShowforLowLevel));
                }

                var job = new Job(period, sharedJob, jobCustomFields, jobJobInddices);
                jobRep.Add(job);
                tr.Complete();
                return(job);
            }
        }
Example #2
0
 public IEnumerable <JobIndex> FindJobIndices(IEnumerable <AbstractJobIndexId> jobIndexIds)
 {
     using (var tr = new TransactionScope())
     {
         var res = jobIndexRep.FindJobIndices(jobIndexIds);
         tr.Complete();
         return(res);
     }
 }
Example #3
0
        public List <JobIndex> GetInquiryIndices(EmployeeId inquirerEmployeeId)
        {
            var inquirer = employeeRep.GetBy(inquirerEmployeeId);

            // Return a list with 0 elements indicating that the given employee has no inquiry subjects
            if (inquirer == null)
            {
                return(new List <JobIndex>());
            }

            periodChecker.CheckShowingInquirySubject(inquirer);
            var inquiryJobIndexIds = inquiryJobIndexPointRepository.GetAllJobIndexIdByInquirer(inquirerEmployeeId);

            return(jobIndexRep.FindJobIndices(inquiryJobIndexIds).ToList());
        }