Exemplo n.º 1
0
        public async Task <CreateOperationalTaskViewModel> CreateAdHocTask(IOperationalTaskModel model)
        {
            model.JobId = await taskIdGenerator.AdHoc();

            var addressList = new List <JobAddress>();

            addressList.Add(new JobAddress {
                HousingDepartmentId = model.DepartmentId, Address = model.Address
            });
            await messageBus.Publish(new CreateJobCommand(model.JobId, model.CategoryId, model.Title, JobTypeEnum.AdHock, model.CreatorId, RoleType.Coordinator, addressList, null, null));

            var jobAssignId = Guid.NewGuid();
            CreateOperationalTaskAssignCommand adHockAssignCommand = GetCreateOperationalTaskAssignCommand(model, model.JobId, jobAssignId);
            await messageBus.Publish(adHockAssignCommand);

            var dayAssignId = Guid.NewGuid();
            CreateDayAssignCommand dayAssign = GetCreateDayAssignCommand(model, dayAssignId, jobAssignId);
            await messageBus.Publish(dayAssign);

            await SetStatusAfterCreation(dayAssignId, model.TeamLeadId);

            CreateOperationalTaskViewModel result = new CreateOperationalTaskViewModel
            {
                Id           = model.JobId,
                DayAssignId  = dayAssignId,
                DepartmentId = model.DepartmentId
            };

            return(result);
        }
Exemplo n.º 2
0
        public async Task <CreateOperationalTaskViewModel> CreateOtherTask(IOperationalTaskModel model)
        {
            int weekNumber = CalendarHelper.GetWeekNumber(model.Date.Value);

            model.JobId = await taskIdGenerator.Other();

            var addressList = new List <JobAddress>();

            addressList.Add(new JobAddress {
                HousingDepartmentId = model.DepartmentId, Address = model.Address
            });
            await messageBus.Publish(new CreateJobCommand(model.JobId, Guid.Empty, model.Title, JobTypeEnum.Other, model.CreatorId, RoleType.Coordinator, addressList, null, null));

            var jobAssignId = Guid.NewGuid();
            CreateOperationalTaskAssignCommand tenantkAssignCommand = GetCreateOperationalTaskAssignCommand(model, model.JobId, jobAssignId, weekNumber);
            await messageBus.Publish(tenantkAssignCommand);

            var dayAssignId = Guid.NewGuid();
            CreateDayAssignCommand dayAssign = GetCreateDayAssignCommand(model, dayAssignId, jobAssignId, weekNumber);
            await messageBus.Publish(dayAssign);

            await SetStatusAfterCreation(dayAssignId, model.TeamLeadId);

            CreateOperationalTaskViewModel result = new CreateOperationalTaskViewModel
            {
                Id           = model.JobId,
                DepartmentId = model.DepartmentId,
                DayAssignId  = dayAssignId
            };

            return(result);
        }
        public async Task <CreateOperationalTaskViewModel> CreateJanitorTenantTask(NewTenantTaskModel model)
        {
            CreateOperationalTaskViewModel result = await CreateTenantTask(model);

            if (model.TeamLeadId.HasValue)
            {
                var assignedMemberModel = model.Map <MemberAssignModel>();
                assignedMemberModel.DayAssignId = result.DayAssignId;
                await AssignEmployees(assignedMemberModel);
            }
            return(result);
        }