Example #1
0
        public IActionResult Index()
        {
            var projects  = _projectInteractor.GetProjectList(false);
            var resources = _resourceInteractor.GetListResources();

            var viewModel = new DashBoardModel()
            {
                ProjectLists  = projects,
                ResourceLists = resources
            };

            return(View(viewModel));
        }
Example #2
0
        public IActionResult Index([FromQuery] string search)
        {
            var projects = new List <Entities.Project>();

            if (string.IsNullOrEmpty(search))
            {
                projects = _projectInteractor.GetProjectList();
            }
            else
            {
                projects = _projectInteractor.SearchProjectList(search);
            }

            //TempData.Remove("success");
            return(View(projects));
        }
Example #3
0
        // GET: Task
        public IActionResult Index(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var result = _interactor.GetProjectTasks((int)id);

            var inProgTasks    = new List <TaskPT>();
            var completedTasks = new List <TaskPT>();
            var activeProjects = _projectInteractor.GetProjectList() ?? new List <Project>();

            if (result.Count == 0)
            {
                var projName = _projectInteractor.GetProjectDetails((int)id);

                var emptyModel = new TaskViewModel()
                {
                    InProgressTask    = inProgTasks,
                    CompletedTask     = completedTasks,
                    ProjectId         = (int)id,
                    ProjectName       = projName?.Name,
                    CompletedProgress = 0,
                    DueDate           = null,
                    projectLists      = activeProjects
                };

                return(View(emptyModel));
            }

            foreach (var item in result)
            {
                //truncate the desc for the view
                if (item.Name.Length > 20)
                {
                    item.Name = string.Concat(item.Name.Substring(0, 20), "...");
                }

                if (item.Description != null)
                {
                    if (item.Description.Length > 20)
                    {
                        item.Description = string.Concat(item.Description.Substring(0, 20), "...");
                    }
                }

                if (item.StatusId == (int)StatusId.Done)
                {
                    completedTasks.Add(item);
                }
                else
                {
                    inProgTasks.Add(item);
                }
            }

            //get values for progress bar
            var queryable                = result.AsQueryable();
            var totalProjectMinutes      = queryable.Sum(x => x.Effort.ValueInMinutes);
            var completedProjectMiniutes = queryable.Where(x => x.StatusId == (int)StatusId.Done).Sum(x => x.Effort.ValueInMinutes);
            var currentProgressValue     = completedProjectMiniutes == 0 ? 0 : Math.Ceiling((completedProjectMiniutes / totalProjectMinutes) * 100); //round the value

            var viewModel = new TaskViewModel()
            {
                InProgressTask    = inProgTasks,
                CompletedTask     = completedTasks,
                ProjectId         = result[0].Project?.Id,
                ProjectName       = result[0].Project?.Name,
                CompletedProgress = currentProgressValue,
                DueDate           = result[0].Project?.DueDate,
                projectLists      = activeProjects
            };

            return(View(viewModel));
        }