예제 #1
0
        public static GraphItem GetPerformanceAverageByIssuesInDate(List <Issue> issues, DateTime date, int member)
        {
            issues = issues.Where(m => DateHelpers.IsEquals(m.IssueDueDate, date) == true).ToList();
            GraphItem _performanceAverage = new GraphItem();

            _performanceAverage.y    = GetPerformanceByIssues(issues) / member;
            _performanceAverage.Note = GetAverageNote(_performanceAverage.y);

            return(_performanceAverage);
        }
예제 #2
0
        public static CIOListIssuesForDateViewModel GetListIssuesForDateViewModel(DateTime fromDate, DateTime toDate)
        {
            List <Issue>           _issuesInTimes = IssueRepositories.GetIssuesProjectIdFromDateToDate(fromDate, toDate);
            List <ApplicationUser> _users         = db.Users.Where(m => m.BugNetUserId != null).ToList();
            List <Project>         _projects      = db.Projects.ToList();

            List <Issue> _issuesThisWeek = new List <Issue>();

            foreach (var project in _projects)
            {
                _issuesThisWeek.AddRange(_issuesInTimes.Where(m => m.ProjectId == project.Id).ToList());
            }

            CIOListIssuesForDateViewModel     issuesForDate = new CIOListIssuesForDateViewModel();
            List <ListIssuesForDateViewModel> issues        = new List <ListIssuesForDateViewModel>();

            issuesForDate.FromDate = fromDate;
            issuesForDate.ToDate   = toDate;

            DateTime _dateTemp = issuesForDate.FromDate;

            while (_dateTemp <= issuesForDate.ToDate)
            {
                ListIssuesForDateViewModel _issue = new ListIssuesForDateViewModel();
                _issue.Date = _dateTemp;
                if (_issue.Date < DateTime.Today)
                {
                    _issue.Issues = IssueMappers.IssueToViewModels(_issuesThisWeek.Where(m => DateHelpers.IsEquals(m.IssueDueDate, _dateTemp)).ToList()).OrderByDescending(m => m.IssueDueDate).ToList();
                }
                else
                {
                    _issue.Issues = IssueMappers.IssueToViewModels(_issuesThisWeek.Where(m => DateHelpers.IsEquals(m.IssueDueDate, _dateTemp)).ToList()).OrderByDescending(m => m.IssueDueDate).ToList();
                }

                _dateTemp = _dateTemp.AddDays(1);

                issues.Add(_issue);
            }
            issuesForDate.ListIssuesForDate = issues;

            return(issuesForDate);
        }
예제 #3
0
        public static CIOTimesViewModel GetCIOTimesViewModel(DateTime fromDate, DateTime toDate)
        {
            List <Issue>           _issuesThisWeekAllProject = IssueRepositories.GetIssuesProjectIdFromDateToDate(fromDate, toDate);
            List <ApplicationUser> _users    = db.Users.Where(m => m.BugNetUserId != null).ToList();
            List <Project>         _projects = db.Projects.ToList();

            List <Issue> _issuesThisWeek = new List <Issue>();

            foreach (var project in _projects)
            {
                _issuesThisWeek.AddRange(_issuesThisWeekAllProject.Where(m => m.ProjectId == project.Id).ToList());
            }

            CIOTimesViewModel cioTimes = new CIOTimesViewModel();
            List <ListPerformanceUsersViewModel> listPer = new List <ListPerformanceUsersViewModel>();

            cioTimes.FromDate = fromDate;
            cioTimes.ToDate   = toDate;

            DateTime _dateTemp = cioTimes.FromDate;

            while (_dateTemp <= cioTimes.ToDate)
            {
                ListPerformanceUsersViewModel _per = new ListPerformanceUsersViewModel();
                _per.Date = _dateTemp;
                if (_per.Date < DateTime.Today)
                {
                    _per.PerformancesUsers = PerformanceHelpers.GetPerformanceUserByIssuesDate(_issuesThisWeek.Where(m => DateHelpers.IsEquals(m.IssueDueDate, _dateTemp) && m.IsClosed == true).ToList()).OrderByDescending(m => m.y).ToList();
                }
                else
                {
                    _per.PerformancesUsers = PerformanceHelpers.GetPerformanceUserByIssuesDate(_issuesThisWeek.Where(m => DateHelpers.IsEquals(m.IssueDueDate, _dateTemp)).ToList()).OrderByDescending(m => m.y).ToList();
                }

                _dateTemp = _dateTemp.AddDays(1);

                listPer.Add(_per);
            }
            cioTimes.ListPerformances = listPer;

            return(cioTimes);
        }
예제 #4
0
        public static StaffTimesViewModel GetPerformanceInDateViewModel(DateTime fromDate, DateTime toDate, string user)
        {
            List <Issue>   _issuesInTimes         = IssueRepositories.GetIssuesProjectIdFromDateToDate(fromDate, toDate);
            List <Project> _projects              = db.Projects.ToList();
            List <Issue>   _issuesNotFinishedTemp = IssueRepositories.GetIssuesNotFinishedByDate(_today);
            List <Issue>   _issuesFutureTemp      = IssueRepositories.GetIssuesFutureByDate(_today);

            List <Issue> _issuesNotFinished = new List <Issue>();
            List <Issue> _issuesFuture      = new List <Issue>();
            List <Issue> issuesInTimes      = new List <Issue>();

            foreach (var project in _projects)
            {
                issuesInTimes.AddRange(_issuesInTimes.Where(m => m.ProjectId == project.Id).ToList());
                _issuesNotFinished.AddRange(_issuesNotFinishedTemp.Where(m => m.ProjectId == project.Id).ToList());
                _issuesFuture.AddRange(_issuesFutureTemp.Where(m => m.ProjectId == project.Id).ToList());
            }

            StaffTimesViewModel staffTimes = new StaffTimesViewModel();
            List <GraphItem>    issues     = new List <GraphItem>();

            staffTimes.FromDate = fromDate;
            staffTimes.ToDate   = toDate;

            DateTime _dateTemp = staffTimes.FromDate;

            while (_dateTemp <= staffTimes.ToDate)
            {
                GraphItem _issue = new GraphItem();
                _issue.x = _dateTemp.ToShortDateString();
                _issue.y = PerformanceHelpers.GetPerformanceByIssues(issuesInTimes.Where(m => DateHelpers.IsEquals(m.IssueDueDate, _dateTemp) && m.AssignedUserName == user).ToList());

                _dateTemp = _dateTemp.AddDays(1);

                issues.Add(_issue);
            }
            staffTimes.Performances      = issues;
            staffTimes.UserName          = user;
            staffTimes.IssuesNotFinished = IssueMappers.IssueToViewModels(_issuesNotFinished.Where(m => m.AssignedUserName == user).ToList());
            staffTimes.IssuesFuture      = IssueMappers.IssueToViewModels(_issuesFuture.Where(m => m.AssignedUserName == user).ToList());
            staffTimes.IssuesAll         = IssueMappers.IssueToViewModels(issuesInTimes.Where(m => m.AssignedUserName == user).ToList());

            return(staffTimes);
        }