コード例 #1
0
 protected override void OnStop()
 {
     _ = ClientRouter.Close();
 }
コード例 #2
0
        private async Task <Tuple <List <int>, string, string> > AlertReplyComment(int taskid, int userid, string comment, ClientRouter clientRouter)
        {
            var task = await _taskRepository.FindByIdAsync(taskid);

            var user = await _userRepository.FindByIdAsync(userid);

            var pics = await _tagRepository.FindAll().Where(_ => _.TaskID.Equals(taskid)).Select(_ => _.UserID).ToListAsync();

            string projectName = string.Empty;

            if (task.ProjectID > 0)
            {
                projectName = (await _projectRepository.FindByIdAsync(task.ProjectID.Value)).Name;
            }
            string message   = string.Empty;
            string urlResult = string.Empty;

            switch (clientRouter)
            {
            case ClientRouter.ToDoList:
                urlResult = $"/todolist-comment/{taskid}/{task.JobName}";
                break;

            case ClientRouter.History:
                urlResult = $"/history-comment/{taskid}/{task.JobName}";
                break;

            case ClientRouter.Follow:
                urlResult = $"/todolist-comment/{taskid}/{task.JobName}";
                break;

            case ClientRouter.ProjectDetail:
                urlResult = $"/todolist-comment/{taskid}/{task.JobName}";
                break;

            case ClientRouter.Abnormal:
                urlResult = $"/todolist-comment/{taskid}/{task.JobName}";
                break;

            case ClientRouter.Routine:
                urlResult = $"/todolist-comment/{taskid}/{task.JobName}";
                break;

            default:
                break;
            }
            switch (task.JobTypeID)
            {
            case JobType.Project:
                message = $"{user.Username.ToTitleCase()} replied to the comment: '{comment}'.";
                break;

            case JobType.Abnormal:
            case JobType.Routine:
                message = $"{user.Username.ToTitleCase()} replied to the comment: '{comment}'.";
                break;

            default:
                break;
            }
            return(Tuple.Create(pics, message, urlResult));
        }