示例#1
0
        public async Task <List <IOperationalTaskModel> > GetByDepartmentIdYearWeek(Guid departmentId, int year, int weekNumber)
        {
            List <IOperationalTaskModel> viewModelList = new List <IOperationalTaskModel>();

            List <JobAssign> jobAssigns = jobAssignProvider.GetByDepartmentWeekAndYear(departmentId, year, weekNumber);

            foreach (var jobAssign in jobAssigns)
            {
                foreach (var jobId in jobAssign.JobIdList)
                {
                    IOperationalTaskModel viewModel = new OperationalTaskModel();

                    FillJobAssignData(viewModel, jobAssign, departmentId, JobTypeEnum.AdHock);

                    List <IDayAssign> dayAssignList = dayAssignService.GetDayAssigns(jobAssign.Id, jobId, departmentId, weekNumber);
                    IDayAssign        dayAssign     = dayAssignList.FirstOrDefault(); // adhock tasks have only one day assign
                    FillDayAssignData(viewModel, dayAssign, JobTypeEnum.AdHock);

                    Job job = await jobProvider.Get(jobId);

                    FillJobData(viewModel, job, departmentId, JobTypeEnum.AdHock);

                    FillCategory(viewModel);

                    viewModelList.Add(viewModel);
                }
            }

            return(viewModelList);
        }
示例#2
0
        private async Task <IOperationalTaskModel> GetOtherTask(Guid dayAssignId)
        {
            IOperationalTaskModel model     = new OperationalTaskModel();
            IDayAssign            dayAssign = dayAssignService.GetDayAssignById(dayAssignId);

            Job job = await jobProvider.Get(dayAssign.JobId);

            FillJobData(model, job, dayAssign.DepartmentId, JobTypeEnum.Other);

            JobAssign jobAssign = jobAssignProvider.GetAssignByJobIdAndDepartmentId(dayAssign.JobId, dayAssign.DepartmentId);

            FillJobAssignData(model, jobAssign, dayAssign.DepartmentId, JobTypeEnum.Other);

            FillDayAssignData(model, dayAssign, JobTypeEnum.Other);

            return(model);
        }