예제 #1
0
 public BurnDown(SiteSettings ss, IEnumerable <DataRow> dataRows)
 {
     dataRows.ForEach(dataRow =>
     {
         var id                   = dataRow["Id"].ToLong();
         var ver                  = dataRow["Ver"].ToInt();
         var target               = this.Where(o => o.Id == id && o.Ver < ver).LastOrDefault();
         var workValue            = dataRow["WorkValue"].ToDecimal();
         var progressRate         = dataRow["ProgressRate"].ToDecimal();
         var progressRateAddtions = ProgressRateAddtions(target, progressRate);
         Add(new BurnDownElement(
                 id,
                 ver,
                 Titles.DisplayValue(ss, dataRow),
                 workValue,
                 dataRow["StartTime"].ToDateTime(),
                 dataRow["CompletionTime"].ToDateTime(),
                 progressRate,
                 progressRateAddtions,
                 dataRow["Status"].ToInt(),
                 dataRow["Updator"].ToInt(),
                 EarnedValueAddtions(workValue, progressRateAddtions),
                 dataRow["CreatedTime"].ToDateTime(),
                 dataRow["UpdatedTime"].ToDateTime()));
     });
     if (this.Any())
     {
         var latest = Targets(DateTime.MaxValue);
         MinTime           = latest.Select(o => o.StartTime).Min();
         MaxTime           = latest.Select(o => o.CompletionTime).Max();
         LatestUpdatedTime = latest.Select(o => o.UpdatedTime).Max();
         Days = Times.DateDiff(Times.Types.Days, MinTime, MaxTime);
     }
 }
예제 #2
0
        public Gantt(SiteSettings ss, IEnumerable <DataRow> dataRows, string groupBy)
        {
            GroupBy = ss.GetColumn(groupBy);
            var status       = ss.GetColumn("Status");
            var workValue    = ss.GetColumn("WorkValue");
            var progressRate = ss.GetColumn("ProgressRate");

            dataRows.ForEach(dataRow =>
                             Add(new GanttElement(
                                     GroupBy != null
                        ? dataRow["GroupBy"].ToString()
                        : string.Empty,
                                     dataRow["Id"].ToLong(),
                                     Titles.DisplayValue(ss, dataRow),
                                     dataRow["WorkValue"].ToDecimal(),
                                     dataRow["StartTime"].ToDateTime(),
                                     dataRow["CompletionTime"].ToDateTime(),
                                     dataRow["ProgressRate"].ToDecimal(),
                                     dataRow["Status"].ToInt(),
                                     dataRow["Owner"].ToInt(),
                                     dataRow["Updator"].ToInt(),
                                     dataRow["CreatedTime"].ToDateTime(),
                                     dataRow["UpdatedTime"].ToDateTime(),
                                     status,
                                     workValue,
                                     progressRate)));
            AddSummary(dataRows, status, workValue, progressRate);
        }
예제 #3
0
        public static HtmlBuilder CalendarBody(
            this HtmlBuilder hb,
            SiteSettings ss,
            Column column,
            DateTime month,
            DateTime begin,
            IEnumerable <DataRow> dataRows)
        {
            var data = dataRows
                       .Select(o => new CalendarElement
                               (
                                   o["Id"].ToLong(),
                                   (ss.GetColumn(column.ColumnName).EditorFormat == "Ymdhm"
                        ? o["Date"].ToDateTime().ToLocal().ToString("t") + " "
                        : string.Empty) + Titles.DisplayValue(ss, o),
                                   column.ColumnName == "CompletionTime"
                        ? o["Date"].ToDateTime().ToLocal().AddDays(-1)
                        : o["Date"].ToDateTime().ToLocal()
                               ))
                       .OrderBy(o => o.Time)
                       .ThenBy(o => o.Title)
                       .GroupBy(o => o.Date)
                       .ToDictionary(
                o => o.First().Date,
                o => o.Select(p => p));

            return(hb
                   .Table(
                       attributes: new HtmlAttributes()
                       .Id("CalendarBody")
                       .DataAction("UpdateByCalendar")
                       .DataMethod("post"),
                       action: () =>
            {
                hb.THead(action: () => hb
                         .Tr(action: () =>
                {
                    for (var x = 0; x < 7; x++)
                    {
                        hb.Th(css: DayOfWeekCss(x), action: () => hb
                              .Text(text: DayOfWeekString(x)));
                    }
                }));
                hb.TBody(action: () =>
                {
                    for (var y = 0; y < 7; y++)
                    {
                        hb.Tr(action: () =>
                        {
                            for (var x = 0; x < 7; x++)
                            {
                                var date = begin.ToLocal().AddDays(y * 7 + x);
                                hb.Td(
                                    attributes: new HtmlAttributes()
                                    .Class("container" +
                                           (date == DateTime.Now.ToLocal().Date
                                                        ? " today"
                                                        : string.Empty))
                                    .DataId(date.ToString()),
                                    action: () => hb
                                    .Items(
                                        month: month,
                                        date: date,
                                        data: data));
                            }
                        });
                    }
                });
            })
                   .Hidden(
                       controlId: "CalendarCanUpdate",
                       value: (
                           !column.RecordedTime &&
                           column.EditorReadOnly != true &&
                           column.CanUpdate).ToOneOrZeroString())
                   .Hidden(controlId: "CalendarPrevious", value: PreviousMonth(month))
                   .Hidden(controlId: "CalendarNext", value: NextMonth(month))
                   .Hidden(controlId: "CalendarThisMonth", value: ThisMonth()));
        }