Пример #1
0
        public List <Entry> GenerateChartActivitiesImputedGroupByTaskAndProject(Models.Timesheet timesheet)
        {
            var projectsGroup = timesheet.Activities.GroupBy(x => new { x.Value.ProjectId, x.Value.TaskId });
            var entries       = new List <Microcharts.Entry>();
            var indexColor    = 0;

            foreach (var item in projectsGroup)
            {
                var tempProject = timesheet.Projects.FirstOrDefault(x => x.Value.Id.Equals(item.Key.ProjectId));
                var tempTask    = tempProject.Value?.Tasks.FirstOrDefault(x => x.Value.Id.Equals(item.Key.TaskId));

                var imputed = item.Sum(x => x.Value.Imputed);

                entries.Add(new Entry(float.Parse(imputed.ToString()))
                {
                    Color      = GenerateColors.GetColor(indexColor),
                    TextColor  = GenerateColors.GetColor(indexColor),
                    Label      = TruncateLongString(tempTask.Value.Value.DisplayName, 20),
                    ValueLabel = TimeFormat.Format(imputed)
                });
                indexColor++;
            }

            return(entries);
        }
Пример #2
0
        public List <Entry> GenerateChartImputationMonthVsHourMonthExpected(Models.Timesheet timesheet)
        {
            var entries         = new List <Microcharts.Entry>();
            var totalHoursMonth = (AppSettings.HoursDay * timesheet.Days.Where(x => x.IsClosed == false && x.IsWeekend == false && (x.Holiday == null || x.Holiday?.IsHolyday == false)).Count()) * 60;

            var consumed = timesheet.Activities.Sum(x => x.Value.Imputed);
            var pending  = totalHoursMonth - consumed;

            pending = pending < 0 ? pending = 0 : pending;

            entries.Add(new Entry(float.Parse(consumed.ToString()))
            {
                Color      = GenerateColors.GetColor(2),
                TextColor  = GenerateColors.GetColor(2),
                Label      = "Consumed",
                ValueLabel = TimeFormat.Format(consumed)
            });


            entries.Add(new Entry(float.Parse(pending.ToString()))
            {
                Color      = GenerateColors.GetColor(3),
                TextColor  = GenerateColors.GetColor(3),
                Label      = "Pending",
                ValueLabel = TimeFormat.Format(pending)
            });
            return(entries);
        }
Пример #3
0
        public List <Entry> GenerateChartActivitiesImputationVsDeviation(Models.Timesheet timesheet)
        {
            var entries    = new List <Microcharts.Entry>();
            var imputed    = timesheet.Activities.Sum(x => x.Value.Imputed);
            var desviation = timesheet.Activities.Sum(x => x.Value.Deviation);

            entries.Add(new Entry(float.Parse(imputed.ToString()))
            {
                Color      = GenerateColors.GetColor(0),
                TextColor  = GenerateColors.GetColor(0),
                Label      = "Imputed",
                ValueLabel = TimeFormat.Format(imputed)
            });

            entries.Add(new Entry(float.Parse(desviation.ToString()))
            {
                Color      = GenerateColors.GetColor(1),
                TextColor  = GenerateColors.GetColor(1),
                Label      = "Deviation",
                ValueLabel = TimeFormat.Format(desviation)
            });

            return(entries);
        }
Пример #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var result = TimeFormat.Format(int.Parse(string.Format("{0}", value)));

            return(result);
        }