Exemple #1
0
        /// <summary>
        ///     添加任务模板
        ///     <remarks>
        ///         添加非标准任务,包括摘要任务、里程碑任务。
        ///     </remarks>
        /// </summary>
        /// <param name="subject">主题</param>
        /// <param name="body">内容</param>
        /// <param name="importance">重要性级别</param>
        /// <param name="tempo">进度</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="isAllDay">是否全天事件</param>
        /// <param name="duration">工期</param>
        /// <param name="deadLine">期限</param>
        /// <param name="isSummary">是否摘要任务</param>
        /// <returns>任务模板</returns>
        public static Task CreateTask(string subject, string body, string importance, string tempo, DateTime start,
            DateTime end, bool isAllDay, TimeSpan duration, DateTime deadLine, bool isSummary)
        {
            var task = new Task
            {
                Duration = duration,
                DeadLine = deadLine,
                IsSummary = isSummary
            };
            task.GenerateNewIdentity();
            task.IsMileStone = start == end;
            task.SetSchedule(subject, body, importance, tempo, start, end, isAllDay);

            return task;
        }
Exemple #2
0
        /// <summary>
        ///     设置父项
        /// </summary>
        /// <param name="task">父项</param>
        private void SetParent(Task task)
        {
            if (task == null || task.IsTransient())
            {
                throw new ArgumentException("任务父项参数为空!");
            }

            Parent = task;
            ParentId = task.Id;
        }
Exemple #3
0
        /// <summary>
        ///     添加子项
        /// </summary>
        /// <param name="task">子项</param>
        /// <returns>添加的子项</returns>
        public Task AddChild(Task task)
        {
            if (task == null || task.IsTransient())
            {
                throw new ArgumentException("任务子项参数为空!");
            }

            Children.Add(task);
            task.SetParent(this);
            return task;
        }