PublicAPI.Projects.ProjectTask.CompleteTask ELMA API Documentation
Complete the task
 
 
Syntax

public void CompleteTask(
	ProjectTask projectTask,
	CommentActionModel model,
	bool alertCoexecuters
)

Parameters

projectTask
Type: ProjectTask
Project task, which needs to be completed. Object. Access path: PublicAPI.Projects.ProjectTask
model
Type: CommentActionModel
Comments and attachments action model
alertCoexecuters
Type: System Boolean
Notify coexecutors
Examples

//load the necessary data 
var projectTask = PublicAPI.Projects.ProjectTask.LoadOrNull(3); //load the project task by ID 

//Create the comment 
var comment = PublicAPI.Portal.Objects.Common.Comment.Create();
comment.Text = "Comment";
comment.CreationAuthor = PublicAPI.Portal.Security.User.GetCurrentUser();
comment.CreationDate = DateTime.Now;
comment.Save();

//Create an attachment 
var attach = PublicAPI.Portal.Objects.Common.Attachment.Create();
attach.CreationAuthor = PublicAPI.Portal.Security.User.GetCurrentUser();
attach.CreationDate = DateTime.Now;
attach.File = context.File;
attach.Save();

//Create CommentActionModel and fill it in 
var model = InterfaceActivator.Create<ICommentActionModel>();
model.Attachments.Add(attach);
model.Comment = comment;

//Execute the task
PublicAPI.Projects.ProjectTask.CompleteTask(projectTask, model, false);
See Also