Esempio n. 1
0
        private void InitServicesInformation(CloudFoundryClient client)
        {
            this.RefreshingServiceInformations = true;
            Task.Run(async() =>
            {
                this.EnterInit();

                var services = await client.Services.ListAllServices();
                foreach (var service in services)
                {
                    if (service.Active == true)
                    {
                        OnUIThread(() => { ServiceTypes.Add(service); });
                    }
                }

                var plans = await client.ServicePlans.ListAllServicePlans();
                foreach (var plan in plans)
                {
                    OnUIThread(() => { servicePlans.Add(plan); });
                }
            }).ContinueWith((antecedent) =>
            {
                if (antecedent.Exception != null)
                {
                    this.ExitInit(antecedent.Exception);
                }
                else
                {
                    this.ExitInit();
                }
            }).Forget();
        }
Esempio n. 2
0
        /// <summary>
        /// This method contains the core implementation for generating the GeneratedCode
        /// instance.
        /// </summary>
        /// <remarks>
        /// This method decorates every type found in codeNamespace with a CodeTypeMemberExtension.
        /// And then it sends each type through series of ITypeFilters to figure out whether the type
        /// is a service contract, service type, client type, message contract or data contract.
        /// </remarks>
        private void ParseAndFilterCodeNamespace()
        {
            ITypeFilter dataContractTypeFilter    = new DataContractTypeFilter();
            ITypeFilter messageContractTypeFilter = new MessageContractTypeFilter();
            ITypeFilter serviceContractTypeFilter = new ServiceContractTypeFilter();
            ITypeFilter clientTypeTypeFilter      = new ClientTypeTypeFilter();
            ITypeFilter serviceTypeTypeFilter     = new ServiceTypeTypeFilter();

            for (int i = 0; i < codeNamespace.Types.Count; i++)
            {
                // Take a reference to the current CodeTypeDeclaration.
                CodeTypeDeclaration ctd = codeNamespace.Types[i];
                // Create a new instance of CodeTypeMemberExtension to wrap
                // the current CodeTypeDeclaration.
                CodeTypeExtension typeExtension = new CodeTypeExtension(ctd);

                // Also wrap the inner CodeTypeMember(s)
                ExtendTypeMembers(typeExtension);

                // Here we execute the type filters in the highest to lowest probability order.
                if (dataContractTypeFilter.IsMatching(typeExtension))
                {
                    typeExtension.Kind = CodeTypeKind.DataContract;
                    DataContracts.Add(typeExtension);
                    continue;
                }
                if (messageContractTypeFilter.IsMatching(typeExtension))
                {
                    typeExtension.Kind = CodeTypeKind.MessageContract;
                    MessageContracts.Add(typeExtension);
                    continue;
                }
                if (serviceContractTypeFilter.IsMatching(typeExtension))
                {
                    typeExtension.Kind = CodeTypeKind.ServiceContract;
                    ServiceContracts.Add(typeExtension);
                    continue;
                }
                if (clientTypeTypeFilter.IsMatching(typeExtension))
                {
                    typeExtension.Kind = CodeTypeKind.ClientType;
                    ClientTypes.Add(typeExtension);
                    continue;
                }
                if (serviceTypeTypeFilter.IsMatching(typeExtension))
                {
                    typeExtension.Kind = CodeTypeKind.ServiceType;
                    ServiceTypes.Add(typeExtension);
                    continue;
                }
                UnfilteredTypes.Add(typeExtension);
            }
        }
        public void AddService()
        {
            var servicetype = new ServiceType()
            {
                Name = Name, Price = Price
            };

            _esClinicContext.ServiceTypes.Add(servicetype);
            _esClinicContext.SaveChanges();

            ServiceTypes.Add(servicetype);
        }
Esempio n. 4
0
        public void Add(Type serviceType, Type requestType, Type responseType)
        {
            RequestTypes.Add(requestType);
            ServiceTypes.Add(serviceType);

            var restrictTo = requestType.FirstAttribute <RestrictAttribute>()
                             ?? serviceType.FirstAttribute <RestrictAttribute>();

            var reqFilterAttrs = new[] { requestType, serviceType }
            .SelectMany(x => x.AllAttributes().OfType <IRequestFilterBase>()).ToList();
            var resFilterAttrs = (responseType != null ? new[] { responseType, serviceType } : new[] { serviceType })
                                 .SelectMany(x => x.AllAttributes().OfType <IResponseFilterBase>()).ToList();

            var authAttrs = reqFilterAttrs.OfType <AuthenticateAttribute>().ToList();
            var actions   = GetImplementedActions(serviceType, requestType);

            authAttrs.AddRange(actions.SelectMany(x => x.AllAttributes <AuthenticateAttribute>()));

            var operation = new Operation
            {
                ServiceType              = serviceType,
                RequestType              = requestType,
                ResponseType             = responseType,
                RestrictTo               = restrictTo,
                Actions                  = actions.Map(x => x.Name.ToUpper()),
                Routes                   = new List <RestPath>(),
                RequestFilterAttributes  = reqFilterAttrs,
                ResponseFilterAttributes = resFilterAttrs,
                RequiresAuthentication   = authAttrs.Count > 0,
                RequiredRoles            = authAttrs.OfType <RequiredRoleAttribute>().SelectMany(x => x.RequiredRoles).ToList(),
                RequiresAnyRole          = authAttrs.OfType <RequiresAnyRoleAttribute>().SelectMany(x => x.RequiredRoles).ToList(),
                RequiredPermissions      = authAttrs.OfType <RequiredPermissionAttribute>().SelectMany(x => x.RequiredPermissions).ToList(),
                RequiresAnyPermission    = authAttrs.OfType <RequiresAnyPermissionAttribute>().SelectMany(x => x.RequiredPermissions).ToList(),
            };

            this.OperationsMap[requestType] = operation;
            this.OperationNamesMap[operation.Name.ToLowerInvariant()] = operation;
            if (responseType != null)
            {
                ResponseTypes.Add(responseType);
            }

            //Only count non-core ServiceStack Services, i.e. defined outside of ServiceStack.dll or Swagger
            var nonCoreServicesCount = OperationsMap.Values
                                       .Count(x => x.ServiceType.Assembly != typeof(Service).Assembly &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerApiService" &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerResourcesService" &&
                                              x.ServiceType.FullName != "ServiceStack.Api.OpenApi.OpenApiService" &&
                                              x.ServiceType.Name != "__AutoQueryServices");

            LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, nonCoreServicesCount);
        }
Esempio n. 5
0
        private void AddServiceTypeContextMenuClick(object sender, RoutedEventArgs e)
        {
            var serviceTypeDetailedWindow = CreateDetailedWindow();

            serviceTypeDetailedWindow.ShowDialog();

            if (!serviceTypeDetailedWindow.DialogResult ?? false)
            {
                return;
            }

            ServiceTypes.Add(serviceTypeDetailedWindow.serviceType);
        }
Esempio n. 6
0
        private async void GetServiceTypes()
        {
            ServiceTypes.Add(new ServiceType {
                Id = 0, Name = "Wszystkie"
            });
            ServiceTypes = await _serviceTypeProxy.GetServiceTypes(new ServiceTypeFilter
            {
                SportId  = SelectedSportType?.Id > 0 ? SelectedSportType.Id : (int?)null,
                IsCourse = false
            });

            OnPropertyChanged("ServiceTypes");
        }
 public static void AddSingleton <T>(object E)
 {
     ServiceTypes.Add(typeof(T), E);
 }
Esempio n. 8
0
 public RequestFormViewModel()
 {
     SubmitCommand = new Command(async() => await Submit());
     ServiceTypes.Add("Oštrenje");
     ServiceTypes.Add("Reparacija");
 }