public Result <RelationOptionsDTO, OperationError> GetAvailableOptions(int fromSystemUsageId, int toSystemUsageId)
        {
            var operationContext = new SystemRelationOperationContext(new SystemRelationOperationParameters
            {
                FromSystemUsageId = fromSystemUsageId,
                ToSystemUsageId   = toSystemUsageId
            }, new SystemRelationOperationEntities());

            return
                (LoadFromSystemUsage(operationContext)
                 .Bind(LoadToSystemUsage)
                 .Bind(WithAuthorizedReadAccess)
                 .Match <Result <RelationOptionsDTO, OperationError> >
                 (
                     onSuccess: context =>
            {
                var fromSystemUsage = context.Entities.FromSystemUsage;
                var toSystemUsage = context.Entities.ToSystemUsage;

                if (!fromSystemUsage.IsInSameOrganizationAs(toSystemUsage))
                {
                    return new OperationError("source and destination usages are from different organizations", OperationFailure.BadInput);
                }

                var availableFrequencyTypes = _frequencyService.GetAvailableOptions(fromSystemUsage.OrganizationId).ToList();
                var exposedInterfaces = toSystemUsage.GetExposedInterfaces();
                var contracts = _contractRepository.GetByOrganizationId(fromSystemUsage.OrganizationId).OrderBy(c => c.Name).ToList();

                return new RelationOptionsDTO(fromSystemUsage, toSystemUsage, exposedInterfaces, contracts, availableFrequencyTypes);
            },
                     onFailure: error => error
                 ));
        }
 public IEnumerable <DataProcessingRegistrationRole> GetApplicableRoles(DataProcessingRegistration registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException(nameof(registration));
     }
     return(_localRoleOptionsService.GetAvailableOptions(registration.OrganizationId));
 }
Exemple #3
0
        public Result <IEnumerable <TOption>, OperationError> GetOptionTypes(Guid organizationUuid)
        {
            var orgId = ResolveOrgId(organizationUuid);

            if (orgId.Failed)
            {
                return(orgId.Error);
            }

            return(Result <IEnumerable <TOption>, OperationError> .Success(_optionsTypeService.GetAvailableOptions(orgId.Value)));
        }