Exemplo n.º 1
0
        public static List <ReportingItemSummary> GetReportingItems(DateTime startDate, DateTime endDate, IEnumerable <string> fileNames)
        {
            //get all projects, tasks and users for efficiency (rather than looking each one up from file each time)
            List <Project> projs = OperationsReadOnly.GetAllProjects();
            List <Task>    tasks = OperationsReadOnly.GetAllTasks();
            List <User>    users = OperationsReadOnly.GetAllUsers();

            List <ReportingItemSummary> results = new List <ReportingItemSummary>();

            foreach (string currFile in fileNames)
            {
                List <TimeEntry> entries = AllTimeEntry.GetBetween(startDate, endDate, true, currFile);

                foreach (TimeEntry currEntry in entries)
                {
                    ReportingItemSummary item = new ReportingItemSummary();
                    item.Details          = currEntry.Details;
                    item.EndDateTime      = currEntry.EndDateTime;
                    item.ExceptionDetails = currEntry.ExceptionDetails;
                    item.ExceptionMinutes = currEntry.ExceptionMinutes;
                    item.ProjectId        = currEntry.ProjectId;
                    Project prj = projs.Where(i => i.Id == currEntry.ProjectId).FirstOrDefault();
                    item.ProjectName   = prj == null ? string.Empty : prj.Description;
                    item.StartDateTime = currEntry.StartDateTime;
                    item.TaskId        = currEntry.TaskId;
                    Task tsk = tasks.Where(i => i.Id == currEntry.TaskId).FirstOrDefault();
                    item.TaskName     = tsk == null ? string.Empty : tsk.Description;
                    item.TimeEntryId  = currEntry.TimeEntryId;
                    item.TotalMinutes = currEntry.TotalMinutesMinusExceptions;
                    User usr = users.Where(i => i.UserId == currEntry.UserId).FirstOrDefault();
                    item.UserDisplayName = usr == null ? string.Empty : usr.DisplayName;
                    item.UserId          = currEntry.UserId;

                    results.Add(item);
                }
            }

            return(results);
        }
Exemplo n.º 2
0
        public static List <ReportingGoalSummary> GetReportingGoals(DateTime startDate, DateTime endDate, IEnumerable <string> fileNames)
        {
            //get all users for efficiency (rather than looking each one up from file each time)
            List <User> users = OperationsReadOnly.GetAllUsers();

            List <ReportingGoalSummary> results = new List <ReportingGoalSummary>();

            foreach (string currFile in fileNames)
            {
                List <Goal> entries = AllGoals.GetAllCompleteBetween(currFile, startDate, endDate);

                foreach (Goal currEntry in entries)
                {
                    ReportingGoalSummary item = new ReportingGoalSummary();

                    item.ActualCompletionDate = currEntry.ActualCompletionDate;
                    item.Completed            = currEntry.Completed;
                    item.Description          = currEntry.Description;
                    item.GoalId                 = currEntry.GoalId;
                    item.Improvements           = currEntry.Improvements;
                    item.Positives              = currEntry.Positives;
                    item.ResultMeasure          = currEntry.ResultMeasure;
                    item.ResultMeasureRating    = currEntry.ResultMeasureRating;
                    item.ResultTimelinessRating = currEntry.ResultTimelinessRating;
                    item.TargetCompletionDate   = currEntry.TargetCompletionDate;
                    item.TargetMeasure          = currEntry.TargetMeasure;
                    User usr = users.Where(i => i.UserId == currEntry.UserId).FirstOrDefault();
                    item.UserDisplayName = usr == null ? string.Empty : usr.DisplayName;
                    item.UserId          = currEntry.UserId;

                    results.Add(item);
                }
            }

            return(results);
        }