Esempio n. 1
0
 public void AddTaskComment(ITaskComment comment, int taskId)
 {
     PostAsJson("api/task/comment/", () =>
     {
         //return new { Comment = comment, TaskId = taskId };
         return(new { comment, taskId });
     });
 }
Esempio n. 2
0
 public static DbTaskComment ToDbModel(this ITaskComment @this)
 {
     return(new DbTaskComment
     {
         Id = @this.Id,
         Day = @this.Day,
         Text = @this.Text,
         UserId = @this.Who.Id,
     });
 }
Esempio n. 3
0
 public void AddTaskComment(ITaskComment comment, int taskId)
 {
     this.dbContext.Update(db =>
     {
         var model = comment.ToDbModel();
         db.TaskComments.Add(model);
         db.SaveChanges();
         var link = model.ToDbLink(taskId);
         db.LinkTaskItemWithComment.Add(link);
         db.SaveChanges();
     });
 }
Esempio n. 4
0
        private IEnumerable<IGraphPoint> MakePv(ISprint sprint, ITaskWithRecord[] tasks, ITaskRecord[] records, ITaskComment[] comments)
        {
            // 期間未定はPVを計れない
            if ((sprint.Left.HasValue && sprint.Right.HasValue) == false)
            {
                return Enumerable.Empty<IGraphPoint>();
            }

            var dateList = records.Select(x => x.Day).Concat(comments.Select(x => x.Day)).ToArray();
            var left = sprint.Left ?? (dateList.Any() ? dateList.Min() : DateTime.Now);
            var right = sprint.Right ?? (dateList.Any() ? dateList.Max() : DateTime.Now);

            // 次にPV(計画)
            // 休日を除く日で総Valueを案分する
            var alldays =
                (from i in Enumerable.Range(0, (right - left).Days + 1)
                 let day = left.AddDays(i)
                 select day).ToArray();
            var workDays =
                (from day in alldays
                 where this.workdayService.IsWorkday(day)
                 select day).ToArray();

            // 稼働日が無い場合は先頭日に全部押し付ける
            if (workDays.Any() == false)
            {
                workDays = new[] { left };
            }

            // 計画値の総量
            var pvAll = tasks.Sum(x => x.Value ?? 0.0);
            // 1日あたりの量
            var pvAve = pvAll / workDays.Length;
            var pvList = workDays.Select(x => new GraphPoint { Day = x, Value = pvAve }).ToArray();
            var inHolidays = alldays.Select(x => new GraphPoint { Day = x, Value = 0.0 }).ToArray();
            return Merge(pvList, inHolidays);
        }