public async System.Threading.Tasks.Task ShowTasks(TaskIndexViewModel taskIndexViewModel)
        {
            var page = new TaskIndexPage();
            await Navigation.PushAsync(page);

            NavigationPage.SetHasBackButton(page, true);
            page.BindingContext = taskIndexViewModel;
        }
示例#2
0
        public TaskIndexViewModel GetTaskIndexViewModel()
        {
            var model = new TaskIndexViewModel
            {
                Tasks = (from t in _manager.PendingTasks select t).ToList()
            };

            return(model);
        }
示例#3
0
        public bool StartMonitoring_TaskIndexViewModel(TaskIndexViewModel model)
        {
            //Add this user as watching tasks for this feature id
            Groups.Add(Context.ConnectionId, LiveUpdateHelper.GroupName(ViewModelDataType.Task, ActionType.Index, model.FeatureId));

            Task.Factory.StartNew(() =>
            {
                //Check if the model has changed, call update if it has
                using (var db = new ApplicationDbContext())
                {
                    var feature  = db.Features.Find(model.FeatureId);
                    var newModel = new TaskIndexViewModel(feature);
                    //Check task in list
                    foreach (var oldTask in model.Tasks)
                    {
                        var newTask = newModel.Tasks.Find(task => task.Id == oldTask.Id);
                        if (newTask == null)
                        {
                            //Data has been removed!
                            LiveUpdateSingleton.Instance.EntityUpdated(new taskList()
                            {
                                new Tuple <EntityState, Models.DataModels.ScrumTask>(EntityState.Deleted, new Models.DataModels.ScrumTask()
                                {
                                    Id = oldTask.Id, FeatureId = model.FeatureId
                                })
                            });
                        }
                        else if (!oldTask.PublicInstancePropertiesEqual(newTask))
                        {
                            //Data has changed
                            var task = db.Tasks.Find(oldTask.Id);
                            LiveUpdateSingleton.Instance.EntityUpdated(new taskList()
                            {
                                new Tuple <EntityState, Models.DataModels.ScrumTask>(EntityState.Modified, task)
                            });
                        }
                    }
                    foreach (var newTask in newModel.Tasks)
                    {
                        var oldTask = model.Tasks.Find(task => task.Id == newTask.Id);
                        if (oldTask == null)
                        {
                            //Data has been added!
                            var task = db.Tasks.Find(newTask.Id);
                            LiveUpdateSingleton.Instance.EntityUpdated(new taskList()
                            {
                                new Tuple <EntityState, Models.DataModels.ScrumTask>(EntityState.Added, task)
                            });
                        }
                    }
                }
            });
            return(true);
        }
示例#4
0
        // GET: Tasks?page=1&status=All
        public async Task <IActionResult> Index([FromQuery] int page = 1, [FromQuery] FilteredTaskStatus status = FilteredTaskStatus.All)
        {
            IPagedList <ToDoTask> tasks = await _taskService.GetPage(page, 10, status);

            TaskIndexViewModel viewModel = new TaskIndexViewModel()
            {
                Tasks          = ToMappedPagedList <ToDoTask, TaskListElementViewModel>(tasks),
                FilteredStatus = status
            };

            return(View(viewModel));
        }
        public ActionResult Index()
        {
            // Get list of tasks for the current user
            List <Task> taskList = taskService.GetTasksByUser(UserGuid);

            TaskIndexViewModel viewModel = new TaskIndexViewModel()
            {
                TaskList = taskList
            };

            return(View(viewModel));
        }
        public PartialViewResult Index(TaskIndexViewModel viewModel)
        {
            //Todo: validation somewhere?
            var tasks = _taskRepository.Search(
                viewModel.UserId,
                viewModel.TaskTypeId,
                viewModel.DueDateFrom,
                viewModel.DueDateTo,
                viewModel.TaskStatus,
                false);

            var partialViewModel = TaskIndexTaskViewModelMapper.MapToViewModel(tasks);

            return(PartialView("_IndexTasks", partialViewModel));
        }
示例#7
0
        public async Task <IActionResult> Index(TaskIndexViewModel model)
        {
            if (model == null)
            {
                model = new TaskIndexViewModel();
            }

            if (model.Year <= 0)
            {
                model.Year = DateTime.Today.Year;
            }
            if (model.Month <= 0)
            {
                model.Month = DateTime.Today.Month;
            }

            var allowAllOrgs = Helper.AllowAllOrgs(HttpContext, out int?allowedOrgId);
            var orgnizations = allowAllOrgs ? await _systemService.GetOrganizations() :
                               new Organization[]
            {
                await _systemService.FindOrganization(allowedOrgId.Value)
            };

            if (!allowAllOrgs)
            {
                model.OrganizationId = allowedOrgId.Value;
            }
            else
            {
                if (model.OrganizationId <= 0)
                {
                    model.OrganizationId = orgnizations.FirstOrDefault().OrganizationId;
                }
            }

            ViewBag.OrgList = new SelectList(orgnizations,
                                             nameof(Organization.OrganizationId), nameof(Organization.Name));

            var planTerms = await _planService.GetMonthlyTasksOfOrg(model.OrganizationId, model.Year, model.Month);

            model.BindPlanTasks(planTerms);

            var performTerms = await _performService.GetMonthlyTasksOfOrg(model.OrganizationId, model.Year, model.Month);

            model.BindPerformTasks(performTerms);

            return(View(model));
        }
示例#8
0
        // GET: Task
        public async Task <IActionResult> Index(int listId)
        {
            ToDoList toDoToDoList = await _toDoListService.FindById(listId);

            if (toDoToDoList == null)
            {
                return(NotFound());
            }

            var taskIndexViewModel = new TaskIndexViewModel
            {
                Id             = listId,
                ListName       = toDoToDoList.Name,
                ToDoTasks      = toDoToDoList.Tasks.Where(t => t.Done == false).OrderByDescending(x => x.Id),
                CompletedTasks = toDoToDoList.Tasks.Where(t => t.Done).OrderByDescending(x => x.Id)
            };

            return(View(taskIndexViewModel));
        }
示例#9
0
        public ActionResult Index()
        {
            ViewBag.UserName = UserHelper.CreateUsernameWithoutDomain2(User as ClaimsPrincipal);
            var user = UserHelper.CreateUsernameWithoutDomain2(User as ClaimsPrincipal);

            var viewModel = new TaskIndexViewModel
            {
                IsAdmin    = _administratorDAO.UserIsAdmin(UserHelper.CreateUsernameWithoutDomain(string.IsNullOrEmpty(user) ? Session.SessionID : user)),
                IsLoggedIn = !string.IsNullOrEmpty(user)
            };

            foreach (var selectedTask in _selectedTaskDAO.GetAllChronologically(string.IsNullOrEmpty(User.Identity.Name) ? Session.SessionID : User.Identity.Name, DateTime.Now))
            {
                viewModel.SelectedTasks.Add(new SelectedTaskViewModel(selectedTask));
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            return(View(viewModel));
        }
示例#10
0
        public static TaskIndexViewModel MapToViewModel(
            IList <User> users,
            Guid?userId,
            IList <TaskType> taskTypes,
            Guid?taskTypeId,
            DateTime?dueDateFrom,
            DateTime?dueDateTo,
            TaskStatus?taskStatus,
            IList <Task> tasks)
        {
            var viewModel = new TaskIndexViewModel();

            viewModel.Users        = new SelectList(users, "Id", "Username", userId).AddDefaultOption();
            viewModel.TaskTypes    = new SelectList(taskTypes, "Id", "Description", taskTypeId).AddDefaultOption();
            viewModel.DueDateFrom  = dueDateFrom;
            viewModel.DueDateTo    = dueDateTo;
            viewModel.TaskStatuses = new TaskStatus().ToSelectList(taskStatus).AddDefaultOption();
            viewModel.Tasks        = TaskIndexTaskViewModelMapper.MapToViewModel(tasks);
            return(viewModel);
        }
示例#11
0
        // GET: Tasks
        public async Task <ActionResult> Index(int?id, EnumTaskView?view)
        {
            if (view != null)
            {
                //Store preferred view style as list
                UpdateUserPreferredView((EnumTaskView)view);
            }
            else
            {
                view = _userManager.FindById(User.Identity.GetUserId()).PreferedView;
            }

            //Check valid input
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "No Feature Id presented."));
            }

            //Find feature in database
            var feature = await _db.Features.FindAsync(id);

            if (feature == null)
            {
                return(HttpNotFound("Feature not found."));
            }

            //TODO: Ensure user is allowed access to this project

            //Create and return view model
            var model = new TaskIndexViewModel(feature);

            switch (view)
            {
            case EnumTaskView.Board:
                return(View("Board", model));

            case EnumTaskView.List:
            default:
                return(View("Index", model));
            }
        }
        public ActionResult Index(string code)
        {
            var staff = GetCurrentUserName();
            var data  = new TaskIndexViewModel();

            data.Tasks = TaskBLO.Current.ListTaskOfStaff(staff);
            data.FilterByRequestType = RequestTypeBLO.Current
                                       .GetAll()
                                       .Select(x => new SelectListItem {
                Value = x.RequestTypeCode, Text = x.RequestTypeName
            })
                                       .ToList();
            data.FilterByStatus = StatusBLO.Current
                                  .GetStatusByObject(Constants.Object.OBJECT_TASK)
                                  .Select(x => new SelectListItem {
                Value = x.StatusCode, Text = x.StatusName
            })
                                  .ToList();
            data.FilterByPeriodOfTime = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Value = "0", Text = "Today", Selected = true
                },
                new SelectListItem()
                {
                    Value = "7", Text = "One Week"
                },
                new SelectListItem()
                {
                    Value = "30", Text = "One Month"
                },
                new SelectListItem()
                {
                    Value = "99999", Text = "All"
                }
            };
            return(View(data));
        }
示例#13
0
 public IActionResult Index(TaskIndexViewModel model, [FromQuery] int page)
 {
     return(RedirectToAction(nameof(Index), new { page = page, status = model.FilteredStatus }));
 }
 public PartialViewResult Cancel(Guid taskId, TaskIndexViewModel viewModel)
 {
     _taskService.Cancel(taskId, HttpContext.User.Identity.Name);
     //return null;
     return(Index(viewModel));
 }
示例#15
0
        public TaskIndexViewModel GetTaskIndexViewModel()
        {
            var model = new TaskIndexViewModel();

            return(model);
        }