Beispiel #1
0
        public IEnumerable <UnitInPeriodDTOWithActions> GetUnitsWithActions(long periodId)
        {
            var res   = new List <UnitInPeriodDTOWithActions>();
            var units = unitRep.GetUnits(new PeriodId(periodId));

            foreach (var unit in units)
            {
                var u = unitInPeriodDTOWithActionsMapper.MapToModel(unit, new string[] { });
                // u.Inquirers=new List<EmployeeDTO>();

                //unit.ConfigurationItemList.ToList().ForEach(c =>
                //{
                //    var emp = _employeeRepository.GetBy(c.Id.InquirerId);
                //    u.Inquirers.Add(new EmployeeDTO()
                //    {
                //        FirstName = emp.FirstName,
                //        LastName = emp.LastName,
                //        PeriodId = emp.Id.PeriodId.Id,
                //        PersonnelNo=emp.Id.EmployeeNo
                //    });
                //});

                res.Add(u);
            }

            return(res);
        }
        public JobInPeriodDTO AssignJob(long periodId, JobInPeriodDTO jobInPeriod)
        {
            //Job job= jobService.AssignJob(new JobId(new PeriodId(periodId), new SharedJobId(jobInPeriod.JobId)));
            //return jobInPeriodDTOMapper.MapToModel(job,new string[]{});

            Job job = jobService.AssignJob(new JobId(new PeriodId(periodId), new SharedJobId(jobInPeriod.JobId)),
                                           jobInPeriod.CustomFields.Select(c => new SharedJobCustomFieldId(c.Id)).ToList(),
                                           jobInPeriod.JobIndices.Select(c => new JobIndexForJob(new AbstractJobIndexId(c.Id), c.ShowforTopLevel, c.ShowforSameLevel, c.ShowforLowLevel)).ToList()
                                           );

            return(jobInPeriodDTOMapper.MapToModel(job, new string[] {}));
        }
Beispiel #3
0
        public UnitInPeriodDTO AssignUnit(long periodId, UnitInPeriodDTO unitInPeriod)
        {
            var unit = unitService.AssignUnit(
                (unitInPeriod.ParentId == null) ? new UnitId(new PeriodId(periodId), new SharedUnitId(0)) : new UnitId(new PeriodId(periodId), new SharedUnitId(unitInPeriod.ParentId.Value)),
                new UnitId(new PeriodId(periodId), new SharedUnitId(unitInPeriod.UnitId)),
                unitInPeriod.CustomFields.Select(c => new SharedUnitCustomFieldId(c.Id)).ToList(),
                unitInPeriod.UnitIndices.Select(c => new UnitIndexForUnit(new AbstractUnitIndexId(c.Id), c.ShowforTopLevel, c.ShowforSameLevel, c.ShowforLowLevel)).ToList()

                );

            return(unitInPeriodDTOMapper.MapToModel(unit, new string[] { }));
        }
        public PageResultDTO <JobInPeriodDTOWithActions> GetAllJobs(long periodId, int pageSize, int pageIndex, QueryStringConditions queryStringConditions, string selectedColumns)
        {
            var fs     = new ListFetchStrategy <Job>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <Job>(item.Key,
                                                                  (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            jobRep.Find(e => e.Id.PeriodId == new PeriodId(periodId), fs);
            var res = new PageResultDTO <JobInPeriodDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => jobInPeriodDTOWithActionsMapper.MapToModel(r, selectedColumns.Split(','))).ToList();
            return(res);
        }