예제 #1
0
        public async Task UnassignEmployees(MemberAssignModel model)
        {
            IDayAssign dayAssign = GetDayAssign(model.DayAssignId);

            List <Guid> userIdList = model.UserIdList;
            await messageBus.Publish(new RemoveDayAssignMembersCommand(dayAssign.Id.ToString(), userIdList));
        }
        public async Task UnassignEmployees(MemberAssignModel model)
        {
            await operationalTaskService.UnassignEmployees(model);

            janitorHubs.Clients.All.refreshOpenTasks();
            janitorHubs.Clients.All.refreshJanitorTasks();
            managementHubs.Clients.All.refreshWeekPlanGridTasks();
            managementHubs.Clients.All.refreshWeekPlanListTasks();
        }
예제 #3
0
        public async Task AssignEmployees(MemberAssignModel model)
        {
            IDayAssign dayAssign   = GetDayAssign(model.DayAssignId);
            var        currentUser = memberService.GetCurrentUser();

            //Janitor can create task only for himself
            if (currentUser.CurrentRole == RoleType.Janitor)
            {
                model.UserIdList = new List <Guid> {
                    currentUser.MemberId
                };
                model.TeamLeadId           = currentUser.MemberId;
                model.GroupId              = null;
                model.IsAssignedToAllUsers = false;
            }

            var memberModel = new ChangeDayAssignMembersComand(dayAssign.Id.ToString())
            {
                UserIdList           = model.UserIdList,
                GroupId              = model.GroupId,
                TeamLeadId           = model.TeamLeadId,
                IsAssignedToAllUsers = model.IsAssignedToAllUsers
            };

            await messageBus.Publish(memberModel);

            if (model.IsUnassignAll)
            {
                await jobStatusService.Pending(dayAssign.Id, dayAssign.StatusId);
            }
            else if (dayAssign.StatusId != JobStatus.Opened && !model.TeamLeadId.HasValue)
            {
                await jobStatusService.Opened(dayAssign.Id, dayAssign.StatusId);
            }
            else if (dayAssign.StatusId != JobStatus.Assigned && model.TeamLeadId.HasValue)
            {
                await jobStatusService.Assigned(dayAssign.Id, dayAssign.StatusId);
            }
        }