Ejemplo n.º 1
0
        public ActionResult Details(int id)
        {
            ViewBag.Title = "Информация о процедуре";

            var task = DataProvider.GetItem(new TaskDataFilter {
                Id = id
            });

            if (task == null)
            {
                throw new ApplicationException("Процедура с кодом '" + id + "' не найдена");
            }

            var trial = DataProvider.GetItem(new TrialDataFilter {
                Code = task.TrialCode
            });
            var procedure = DataProvider.GetItem(new ProcedureDataFilter {
                Code = task.ProcedureCode
            });

            ViewBag.Roles = DataProvider.GetList(new RoleDataFilter());
            ViewBag.Users = DataProvider.GetList(new UserDataFilter());

            return(View(TaskViewModel.Create(task, trial.Name, procedure.Name)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int projectId, int year, int month, int?flag)
        {
            var project = await _projectService.RetriveProjectWithDetails(projectId, ProjectApiContent.RetrieveAll);

            if (project == null || project.ProjectId <= 0 || year < 2020 || month < 1 || month > 12)
            {
                return(NotFound());
            }

            //上一年结转
            var balance = BalanceViewModel.Create(project.AnnualBalance.Where(b => b.Year == year - 1));

            //当年全部计划
            var plans  = project.Plan.Where(p => p.Year == year);
            var planId = plans.Where(p => p.Month == month).SingleOrDefault()?.Id;
            //当年全部月报
            var performs  = project.Perform.Where(p => p.Year == year);
            var performId = performs.Where(p => p.Month == month).SingleOrDefault()?.Id;

            var model = MonthPerformViewModel.Create(project, year, month, balance, plans, performs);

            model.Terms = project.Terms.OrderBy(p => p.TermsCategory).ThenBy(p => p.TargetDate).Select(p => (TermsViewModel)p);

            //当月全部计划任务
            if (planId.HasValue)
            {
                model.PlanTerms = (await _planService.GetPlanTerms(planId.Value))
                                  .Select(p => TaskViewModel.Create(p, project.Terms.SingleOrDefault(t => t.Id == p.TermsId)));
            }

            //当月全部完成任务
            if (performId.HasValue)
            {
                model.PerformTerms = (await _performService.GetPerformTerms(performId.Value))
                                     .Select(p => TaskViewModel.Create(p, project.Terms.SingleOrDefault(t => t.Id == p.TermsId)));
            }

            model.ClearZeroProperties();

            if (flag == null)
            {
                ViewBag.Message = string.Empty;
            }
            else if (flag.Value == 0)
            {
                ViewBag.Message = "月报数据保存成功,请继续填写,或者点击‘返回’返回查看页面";
            }
            else
            {
                ViewBag.Message = "保存月报数据数据出错,请记录现在的时间并联系管理员查看日志进行处理";
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public static SprintViewModel Create(Business.Models.Sprint sprint, bool isOwner, double averageStoryPoint)
        {
            var taskViewModels = new List <TaskViewModel>();
            var selectTasks    = new List <SelectListItem>();

            foreach (var task in sprint.Tasks)
            {
                var taskViewModel = TaskViewModel.Create(task);
                taskViewModels.Add(taskViewModel);
                selectTasks.Add(new SelectListItem(task.Name, task.Id.ToString()));
            }

            return(new SprintViewModel(sprint, isOwner, averageStoryPoint, taskViewModels, selectTasks));
        }
Ejemplo n.º 4
0
        private void mvvmContext1_ViewModelCreate(object sender, DevExpress.Utils.MVVM.ViewModelCreateEventArgs e)
        {
            var today = DateTime.Today;
            var tasks = new ObservableCollection <TaskViewModel> {
                TaskViewModel.Create("Do shopping", today),
                TaskViewModel.Create("Dinner with Joe", today + TimeSpan.FromDays(2)),
                TaskViewModel.Create("Car in shop", today + TimeSpan.FromDays(1)),
                TaskViewModel.Create("Clean patio", today + TimeSpan.FromDays(1)),
                TaskViewModel.Create("Take the garbage out", today + TimeSpan.FromDays(4)),
                TaskViewModel.Create("Complete MVVM project", today),
                TaskViewModel.Create("Vegas, baby!", today + TimeSpan.FromDays(10))
            };

            e.ViewModel = TasksViewModel.Create(tasks);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> GetTaskByIdAsync(int teamId, int taskId)
        {
            if (!await _accessCheckService.OwnerOrMemberAsync(teamId))
            {
                return(View("ErrorGetTaskById"));
            }

            if (await _accessCheckService.IsOwnerAsync(teamId))
            {
                ViewBag.AddVision = "visible";
            }
            else
            {
                ViewBag.AddVision = "collapse";
            }

            var task = await _manageTasksService.GetTaskByIdAsync(taskId);

            var taskViewModel = TaskViewModel.Create(task);

            return(View(taskViewModel));
        }