public ActionResult New()
        {
            var userTaskType = _context.UserTaskTypes.ToList();
            var viewModel    = new SearchTaskViewModel()
            {
                UserTask     = new UserTask(),
                UserTaskType = userTaskType
            };

            return(View("NewDetailsUserTask", viewModel));
        }
        public ActionResult Details(int id)
        {
            var userTask = _context.UserTasks.Include(n => n.Contractor)
                           .Include(n => n.UserTaskType)
                           .Include(n => n.ContractorEmployee).SingleOrDefault(n => n.Id == id);

            var userTaskTypes = _context.UserTaskTypes.ToList();

            var searchTaskViewModel = new SearchTaskViewModel()
            {
                UserTask     = userTask,
                UserTaskType = userTaskTypes
            };

            return(View("NewDetailsUserTask", searchTaskViewModel));
        }
Exemple #3
0
        public void Search(SearchTaskViewModel taskViewModel)
        {
            if (taskViewModel == null)
            {
                throw new ArgumentNullException("searchViewModel");
            }

            try
            {
                if (!tabMap.ContainsKey(taskViewModel.Id))
                {
                    var searchResultView = new SearchResultView();
                    searchResultView.Initialize(logger, securityContext, mediaFactory, mediaItemController, taskController, tagController, this);

                    taskViewModel.AddResultsCallback(result => searchResultView.HandleSearchResult(result));

                    var tabItem = new TabItem();

                    //TextBlock header = new TextBlock();
                    //header.Inlines.Add(taskViewModel.Description);
                    //header.ToolTip = string.Format("{0}: {1}", taskViewModel.Name, taskViewModel.Description);
                    tabItem.Header = new TaskHeader(logger, taskViewModel);

                    tabItem.Content = searchResultView;
                    resultControl.Items.Add(tabItem);
                    tabItem.IsSelected = true;

                    AddViewModel(taskViewModel, tabItem);

                    if (taskViewModel.Status == TaskStatus.Ready)
                    {
                        taskViewModel.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("  TaskResultView.Search", ex);
            }
        }
        // GET: UserTask
        public ViewResult Index(UserTask userTask)
        {
            var userTasks = _context.UserTasks.Where(t => t.IsActive == true).Include(t => t.Contractor)
                            .Include(t => t.ContractorEmployee)
                            .Include(t => t.UserTaskType).ToList();

            if (userTask.Contractor != null)
            {
                if (!String.IsNullOrEmpty(userTask.Contractor.Name))
                {
                    userTasks = userTasks.Where(t => t.Contractor.Name == userTask.Contractor.Name).ToList();
                }
            }
            if (userTask.ContractorEmployee != null)
            {
                if (!String.IsNullOrEmpty(userTask.ContractorEmployee.FullName))
                {
                    userTasks = userTasks.Where(t => t.ContractorEmployee.FullName == userTask.ContractorEmployee.FullName).ToList();
                }
            }

            if (userTask.UserTaskTypeId != 0)
            {
                userTasks = userTasks.Where(t => t.UserTaskTypeId == userTask.UserTaskTypeId).ToList();
            }

            var userTaskTypes = _context.UserTaskTypes.ToList();

            var searchTaskViewModel = new SearchTaskViewModel()
            {
                UserTasks          = userTasks,
                Contractor         = new Contractor(),
                ContractorEmployee = new ContractorEmployee(),
                UserTaskType       = userTaskTypes
            };

            return(View(searchTaskViewModel));
        }
        public void Search(SearchTaskViewModel taskViewModel)
        {
            if (taskViewModel == null)
                throw new ArgumentNullException("searchViewModel");

            try
            {
                if (!tabMap.ContainsKey(taskViewModel.Id))
                {
                    var searchResultView = new SearchResultView();
                    searchResultView.Initialize(logger, securityContext, mediaFactory, mediaItemController, taskController, tagController, this);

                    taskViewModel.AddResultsCallback(result => searchResultView.HandleSearchResult(result));

                    var tabItem = new TabItem();

                    //TextBlock header = new TextBlock();
                    //header.Inlines.Add(taskViewModel.Description);
                    //header.ToolTip = string.Format("{0}: {1}", taskViewModel.Name, taskViewModel.Description);
                    tabItem.Header = new TaskHeader(logger, taskViewModel);
                    
                    tabItem.Content = searchResultView;
                    resultControl.Items.Add(tabItem);
                    tabItem.IsSelected = true;

                    AddViewModel(taskViewModel, tabItem);

                    if (taskViewModel.Status == TaskStatus.Ready)
                    {
                        taskViewModel.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("  TaskResultView.Search", ex);
            }
        }