コード例 #1
0
        public FKPSystemQuery(IRepositoryWrapperFKP repository)
        {
            Field <ListGraphType <VersionType> >("versions",
                                                 resolve: context => repository.Version.GetAll(),
                                                 description: "Все основные версии программы.");

            Field <VersionType>("version",
                                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "versionId"
            }),
                                resolve: context =>
            {
                if (Guid.TryParse(context.GetArgument <string>("versionId"), out var versionId))
                {
                    return(repository.Version.GetById(versionId));
                }

                context.Errors.Add(new ExecutionError("Wrong value for guid"));
                return(null);
            });

            Field <ListGraphType <FinanceWorkPlaceType> >("financeWorkPlaces",
                                                          arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> >
            {
                Name = "versionId"
            }),
                                                          resolve: context =>
            {
                var versionId = context.GetArgument <Guid>("versionId");
                return(repository.FinanceWorkPlace.GetAllByVersionId(versionId));
            }
                                                          );

            Field <ListGraphType <GoalType> >("goals",
                                              arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> >
            {
                Name = "versionId"
            }),
                                              resolve: context =>
            {
                var versionId = context.GetArgument <Guid>("versionId");
                return(repository.Version.GetGoalsByVersionId(versionId));
            },
                                              description: "Цели и задачи."
                                              );

            Field <VersionGeneralInfoType>("versionGeneralInfo",
                                           arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> >
            {
                Name = "versionId"
            }),
                                           resolve: context =>
            {
                var versionId = context.GetArgument <Guid>("versionId");
                return(repository.Version.GetVersionGeneralInfo(versionId));
            },
                                           description: "Общая информация о версии программы."
                                           );
        }
コード例 #2
0
        public VersionType(IRepositoryWrapperFKP repository, IDataLoaderContextAccessor dataLoader)
        {
            Field(v => v.Rid, type: typeof(IdGraphType)).Name("id").Description("Идентификатор версии программы.");
            Field(v => v.Code, true).Description("Краткое наименование программы.");
            Field(v => v.Name, true).Description("Наименование программы.");
            Field(v => v.Description, true).Description("Описание программы.");

            Field <VersionGeneralInfoType>("versionGeneralInfo",
                                           resolve: context => repository.Version.GetVersionGeneralInfo(context.Source.Rid),
                                           description: "Общая информация о версии программы.");

            Field <ListGraphType <GoalType> >("goals",
                                              resolve: context =>
            {
                var loader = dataLoader.Context
                             .GetOrAddCollectionBatchLoader <Guid, Goal>(
                    "GetAllGoalsByVersionIds",
                    repository.Version.GetAllByVersionIds);

                return(loader.LoadAsync(context.Source.Rid));
            },
                                              description: "Цели и задачи версии программы");

            Field <ListGraphType <SpacecraftScheduleType> >("spacecraftSchedules",
                                                            resolve: context =>
            {
                var loader = dataLoader.Context
                             .GetOrAddCollectionBatchLoader <Guid, VSpacecraftSpacecraftSchedule>("GetAllSpacecraftSchedulesByVersionIds",
                                                                                                  repository.SpacecraftSchedule.GetAllByVersionIds);

                return(loader.LoadAsync(context.Source.Rid));
            },
                                                            description: "Расписание космических полетов на 2016-2025 года.");

            Field <ListGraphType <FinanceWorkPlaceType> >("financeWorkPlaces",
                                                          resolve: context =>
            {
                var loader = dataLoader.Context
                             .GetOrAddCollectionBatchLoader <Guid, FinanceWorkPlace>(
                    "GetAllFinanceWorkPlacesByVersionIds",
                    repository.FinanceWorkPlace.GetAllByVersionIds);

                return(loader.LoadAsync(context.Source.Rid));
            },
                                                          description: "Финансирование.");
        }
コード例 #3
0
 public ProjectsController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }
コード例 #4
0
 public FinanceController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }
コード例 #5
0
 public SpacecraftsController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }
コード例 #6
0
 public TargetIndicatorsController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }
コード例 #7
0
 public EconomicEffectsController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }
コード例 #8
0
 public WorkEventsController(FKPSystemContext fkpSystemContext,
                             IRepositoryWrapperFKP repository)
 {
     _fkpSystemContext = fkpSystemContext;
     _repository       = repository;
 }
コード例 #9
0
 public VersionsController(IRepositoryWrapperFKP repository)
 {
     _repository = repository;
 }