当前位置: 首页>>代码示例>>C#>>正文


C# Domain.Task类代码示例

本文整理汇总了C#中ASC.Projects.Core.Domain.Task的典型用法代码示例。如果您正苦于以下问题:C# Task类的具体用法?C# Task怎么用?C# Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Task类属于ASC.Projects.Core.Domain命名空间,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimpleTaskWrapper

 public SimpleTaskWrapper(Task task)
 {
     ID = task.ID;
     Title = task.Title;
     Description = task.Description;
     Deadline = (ApiDateTime)task.Deadline;
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:SimpleTaskWrapper.cs

示例2: ChangeStatus

        public Subtask ChangeStatus(Task task, Subtask subtask, TaskStatus newStatus)
        {
            if (subtask == null) throw new Exception("subtask.Task");
            if (task == null) throw new ArgumentNullException("task");
            if (task.Status == TaskStatus.Closed) throw new Exception("task can't be closed");

            if (subtask.Status == newStatus) return subtask;

            ProjectSecurity.DemandEdit(task, subtask);
           
            subtask.Status = newStatus;
            subtask.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            subtask.LastModifiedOn = TenantUtil.DateTimeNow();
            subtask.StatusChangedOn = TenantUtil.DateTimeNow();

            if (subtask.Responsible.Equals(Guid.Empty))
                subtask.Responsible = SecurityContext.CurrentAccount.ID;

            var senders = GetSubscribers(task);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Closed && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskClosing(senders, task, subtask);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Open && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskResumed(senders, task, subtask);

            return subtaskDao.Save(subtask);
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:28,代码来源:SubtaskEngine.cs

示例3: TaskWrapper

        public TaskWrapper(Task task)
        {
            if (task.SubTasks != null)
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();

            CreatedBy = EmployeeWraper.Get(task.CreateBy);
            if (task.CreateBy != task.LastModifiedBy)
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);

            if (task.Responsible!=Guid.Empty)
                Responsible = EmployeeWraper.Get(task.Responsible);

            Id = task.ID;

            Updated = (ApiDateTime)task.LastModifiedOn;
            Created = (ApiDateTime)task.CreateOn;
            Deadline = (task.Deadline == DateTime.MinValue ? null : (ApiDateTime)task.Deadline);
            Priority = task.Priority;
            
            Title = task.Title;
            Status = (int)task.Status;
            Description = task.Description;
            MilestoneId = task.Milestone;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            CanEdit = ProjectSecurity.CanEdit(task);
            CanWork = ProjectSecurity.CanWork(task);

            if (task.Milestone != 0 && task.MilestoneDesc != null)
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);

            if (task.Responsibles != null)
                Responsibles = task.Responsibles.Select(x => EmployeeWraper.Get(x)).ToList();
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:33,代码来源:TaskWrapper.cs

示例4: Save

 public override Task Save(Task task)
 {
     if (task != null)
     {
         ResetCache(task.ID);
     }
     return base.Save(task);
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:8,代码来源:TaskDao.cs

示例5: TimeSpend

 public static void TimeSpend(TimeSpend timeSpend, Project project, Task relativeTask, String actionText, int actionType, int businessValue)
 {
     UserActivityPublisher.Publish<TimeLinePublisher>(
      new TimeLineUserActivity(actionText, actionType, businessValue)
      {
          ContentID = relativeTask != null ? relativeTask.ToString() : String.Empty,
          ContainerID = timeSpend.Task.Project.ID.ToString(),
          Title = relativeTask != null ? relativeTask.Title : timeSpend.Hours.ToString(),
          URL = String.Concat(VirtualPathUtility.ToAbsolute(ConfigurationManager.BaseVirtualPath + "timeTracking.aspx"), String.Format("?prjID={0}", timeSpend.Task.Project.ID)),
          AdditionalData = String.Format(AdditionalDataPattern, EntityType.TimeSpend, relativeTask != null ? relativeTask.Title : string.Empty, project.Title),
          SecurityId = string.Format(SecurityDataPattern, EntityType.TimeSpend, relativeTask != null ? relativeTask.ID.ToString() : string.Empty, project.ID)
      });
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:13,代码来源:TimeLinePublisher.cs

示例6: InitTaskPage

        private void InitTaskPage(Task task)
        {
            var taskDescriptionView = (TaskDescriptionView)LoadControl(PathProvider.GetFileStaticRelativePath("Tasks/TaskDescriptionView.ascx"));
            taskDescriptionView.Task = task;
            _content.Controls.Add(taskDescriptionView);

            EssenceTitle = task.Title;
            IsSubcribed = Global.EngineFactory.GetTaskEngine().IsSubscribed(task);

            if ((int)task.Status == 2)
            {
                EssenceStatus = TaskResource.Closed.ToLower();
            }

            Title = HeaderStringHelper.GetPageTitle(task.Title);
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:16,代码来源:Tasks.aspx.cs

示例7: Task

        public static void Task(Task task, Milestone milestone, String actionText, int actionType, int businessValue, bool withPreview)
        {
            //DropProjectActivitiesCache(task.Project);

            UserActivityPublisher.Publish<TimeLinePublisher>(new TimeLineUserActivity(actionText, actionType, businessValue)
            {

                ContentID = (milestone != null) ? milestone.ToString() : String.Empty,
                ContainerID = task.Project.ID.ToString(),
                Title = task.Title,
                URL = String.Concat(VirtualPathUtility.ToAbsolute(ConfigurationManager.BaseVirtualPath + "tasks.aspx").Replace("api/", ""), String.Format("?prjID={0}&id={1}", task.Project.ID, task.ID)),
                AdditionalData = String.Format(AdditionalDataPattern, EntityType.Task, (milestone != null) ? milestone.Title : String.Empty, task.Project.Title),
                SecurityId = string.Format(SecurityDataPattern, EntityType.Task, task.ID, task.Project.ID),
                HtmlPreview = withPreview ? task.Description.HtmlEncode() : null
            });
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:16,代码来源:TimeLinePublisher.cs

示例8: CanRead

        public static bool CanRead(Task task, Guid userId)
        {
            if (task == null || !CanRead(task.Project, userId)) return false;
            if (task.Responsible == userId) return true;

            if (task.Responsibles.Contains(userId)) return true;

            if (!GetTeamSecurity(task.Project, userId, ProjectTeamSecurity.Tasks)) return false;
            if (task.Milestone != 0 && !GetTeamSecurity(task.Project, userId, ProjectTeamSecurity.Milestone))
            {
                var m = GetFactory().GetMilestoneDao().GetById(task.Milestone);
                if (!CanRead(m, userId)) return false;
            }

            return true;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:16,代码来源:ProjectSecurity.cs

示例9: TaskWrapper

        public TaskWrapper(Task task)
        {
            Id = task.ID;
            Title = task.Title;
            Description = task.Description;
            Status = (int)task.Status;

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles.Select(EmployeeWraper.Get).OrderBy(r=> r.DisplayName).ToList();
            }


            Deadline = (task.Deadline == DateTime.MinValue ? null : new ApiDateTime(task.Deadline, TimeZoneInfo.Local));
            Priority = task.Priority;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            MilestoneId = task.Milestone;
            Created = (ApiDateTime)task.CreateOn;
            CreatedBy = EmployeeWraper.Get(task.CreateBy);
            Updated = (ApiDateTime)task.LastModifiedOn;
            StartDate = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.CreateBy != task.LastModifiedBy)
            {
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);
            }

            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();
            }

            CanEdit = ProjectSecurity.CanEdit(task);
            CanCreateSubtask = ProjectSecurity.CanCreateSubtask(task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(task);
            CanDelete = ProjectSecurity.CanDelete(task);

            if (task.Milestone != 0 && task.MilestoneDesc != null)
            {
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);
            }

            if (task.Links.Any())
            {
                Links = task.Links.Select(r=> new TaskLinkWrapper(r));
            }
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:47,代码来源:TaskWrapper.cs

示例10: SubtaskWrapper

 public SubtaskWrapper(Subtask subtask, Task task)
 {
     Id = subtask.ID;
     Title = subtask.Title;
     Status = (int)subtask.Status;
     if (subtask.Responsible != Guid.Empty)
     {
         Responsible = EmployeeWraper.Get(subtask.Responsible);
     }
     Created = (ApiDateTime)subtask.CreateOn;
     CreatedBy = EmployeeWraper.Get(subtask.CreateBy);
     Updated = (ApiDateTime)subtask.LastModifiedOn;
     if (subtask.CreateBy != subtask.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(subtask.LastModifiedBy);
     }
     CanEdit = ProjectSecurity.CanEdit(task, subtask);
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:18,代码来源:SubtaskWrapper.cs

示例11: ChangeStatus

        public Subtask ChangeStatus(Task task, Subtask subtask, TaskStatus newStatus)
        {
            if (subtask == null) throw new Exception("subtask.Task");
            if (task == null) throw new ArgumentNullException("task");
            if (task.Status == TaskStatus.Closed) throw new Exception("task can't be closed");

            if (subtask.Status == newStatus) return subtask;

            ProjectSecurity.DemandEdit(task, subtask);
           
            switch (newStatus)
            {
                case TaskStatus.Closed:
                    TimeLinePublisher.Subtask(subtask, task, EngineResource.ActionText_Closed, UserActivityConstants.ActivityActionType, UserActivityConstants.ImportantActivity);
                    break;

                case TaskStatus.Open:
                    TimeLinePublisher.Subtask(subtask, task, subtask.Status == TaskStatus.Closed ? EngineResource.ActionText_Reopen : EngineResource.ActionText_Accept, UserActivityConstants.ActivityActionType, UserActivityConstants.SmallActivity);
                    break;
            }

            subtask.Status = newStatus;
            subtask.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            subtask.LastModifiedOn = TenantUtil.DateTimeNow();
            subtask.StatusChangedOn = TenantUtil.DateTimeNow();

            if (subtask.Responsible.Equals(Guid.Empty))
                subtask.Responsible = SecurityContext.CurrentAccount.ID;

            var objectID = task.UniqID + "_" + task.Project.ID;
            var senders = NotifySource.Instance.GetSubscriptionProvider().GetRecipients(NotifyConstants.Event_NewCommentForTask, objectID).ToList();
            senders.RemoveAll(r => r.ID == SecurityContext.CurrentAccount.ID.ToString());

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Closed && !_factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskClosing(senders, task, subtask);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Open && !_factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskResumed(senders, task, subtask);

            return _subtaskDao.Save(subtask);
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:41,代码来源:SubtaskEngine.cs

示例12: SaveOrUpdate

 public Task SaveOrUpdate(Task task, IEnumerable<int> attachedFileIds, bool notifyResponsible)
 {
     return SaveOrUpdate(task, attachedFileIds, notifyResponsible, false);
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:4,代码来源:TaskEngine.cs

示例13: CanRead

 private static bool CanRead(Task task)
 {
     return ProjectSecurity.CanRead(task);
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:4,代码来源:TaskEngine.cs

示例14: ChangeStatus

        public Task ChangeStatus(Task task, TaskStatus newStatus)
        {
            ProjectSecurity.DemandEdit(task);

            if (task == null) throw new ArgumentNullException("task");
            if (task.Project == null) throw new Exception("Project can't be null.");
            if (task.Project.Status == ProjectStatus.Closed) throw new Exception(EngineResource.ProjectClosedError);

            if (task.Status == newStatus) return task;

            var senders = GetSubscribers(task);

            if (newStatus == TaskStatus.Closed && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutTaskClosing(senders, task);

            if (newStatus == TaskStatus.Open && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutTaskResumed(senders, task);

            task.Status = newStatus;
            task.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            task.LastModifiedOn = TenantUtil.DateTimeNow();
            task.StatusChangedOn = TenantUtil.DateTimeNow();

            //subtask
            if (newStatus == TaskStatus.Closed)
            {
                if (!task.Responsibles.Any())
                    task.Responsibles.Add(SecurityContext.CurrentAccount.ID);

                subtaskDao.CloseAllSubtasks(task);
            }

            return taskDao.Save(task);
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:34,代码来源:TaskEngine.cs

示例15: CheckLink

        private static void CheckLink(Task parentTask, Task dependentTask)
        {
            if (parentTask == null) throw new ArgumentNullException("parentTask");
            if (dependentTask == null) throw new ArgumentNullException("dependentTask");

            if (parentTask.ID == dependentTask.ID)
            {
                throw new Exception("it is impossible to create a link between one and the same task");
            }

/*            if (parentTask.Status == TaskStatus.Closed || dependentTask.Status == TaskStatus.Closed)
            {
                throw new Exception("Such link don't be created. Task closed.");
            }*/

            if (parentTask.Milestone != dependentTask.Milestone)
            {
                throw new Exception("Such link don't be created. Different Milestones");
            }

        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:21,代码来源:TaskEngine.cs


注:本文中的ASC.Projects.Core.Domain.Task类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。