/// <summary> /// Crée une instance de <see cref="ProjectExport"/>. /// </summary> /// <param name="context">Le contexte.</param> /// <param name="projectId">L'identifiant du projet.</param> /// <returns>Le <see cref="ProjectExport"/></returns> internal async Task <ProjectExport> CreateProjectExport(KsmedEntities context, int projectId) { var referentialsUsed = await SharedScenarioActionsOperations.GetReferentialsUse(context, projectId); await Queries.LoadAllReferentialsOfProject(context, projectId, referentialsUsed); var project = await context.Projects .Include("Videos") .Include("Referentials") .FirstAsync(s => s.ProjectId == projectId); var scenarios = await context.Scenarios .Where(s => s.ProjectId == projectId && (s.NatureCode == KnownScenarioNatures.Initial || s.NatureCode == KnownScenarioNatures.Target || s.NatureCode == KnownScenarioNatures.Realized)) .ToArrayAsync(); await Queries.LoadScenariosDetails(context, scenarios, referentialsUsed); return(new ProjectExport() { AppVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), Project = project, ReferentialsStandard = ReferentialsHelper.GetAllReferentialsStandardUsed(project).ToArray(), ReferentialsProject = ReferentialsHelper.GetAllReferentialsProject(project).ToArray(), }); }
/// <summary> /// Charge les données globales relatives à la décomposition. /// </summary> private async Task LoadGlobalData() { var referentialsUsed = await SharedScenarioActionsOperations.GetReferentialsUse(_context, _projectId); _actions = await _context.KActions .Include("Predecessors") .Where(a => a.ScenarioId == _scenarioId) .ToArrayAsync(); await Queries.LoadActionsReferentials(_context, _actions, referentialsUsed); _video = await _context.Videos .Include("DefaultResource") .SingleAsync(v => v.VideoId == _videoId); _project = (await _context.Scenarios .Include("Project") .FirstAsync(s => s.ScenarioId == _scenarioId)) .Project; }