public PaymentStart()
 {
     FeatureService = DependencyService.Get <IFeatureService>();
     InitializeComponent();
     IsEvent = false;
     InitialiteToolBar();
 }
 public SystemConfigurationController(ILog log, ISystemConfigurationService systemConfigurationService, IFeatureService featureService, ILocalizationService localizationService, IUserService userService, ISiteService siteService)
     : base(log, localizationService, userService, siteService)
 {
     this.log = log;
      this.systemConfigurationService = systemConfigurationService;
      this.featureService = featureService;
 }
 public RemoveController(
     IUserService userService,
     IFeatureService featureService,
     ILocationService locationService,
     ICustomerService customerService,
     IDivisionService divisionService,
     IPropertyService propertyService,
     IItemService itemService,
     IDealService dealService,
     IPaymentService paymentService,
     IEmployeeService employeeService,
     IReminderService reminderService,
     IPictureService pictureService
     )
 {
     _userService     = userService;
     _customerService = customerService;
     _locationService = locationService;
     _featureService  = featureService;
     _propertyService = propertyService;
     _divisionService = divisionService;
     _itemService     = itemService;
     _dealService     = dealService;
     _employeeService = employeeService;
     _paymentService  = paymentService;
     _reminderService = reminderService;
     _pictureService  = pictureService;
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpatialContextsDialog"/> class.
 /// </summary>
 /// <param name="fsId">The fs id.</param>
 /// <param name="featSvc">The feat SVC.</param>
 public SpatialContextsDialog(string fsId, IFeatureService featSvc)
     : this()
 {
     lblFeatureSource.Text = fsId;
     grdSpatialContexts.DataSource = featSvc.GetSpatialContextInfo(fsId, false).SpatialContext;
     lblCount.Text = string.Format(Strings.SpatialContextsFound, grdSpatialContexts.Rows.Count);
 }
示例#5
0
        public FindItemDialog(BotServices services, IStatePropertyAccessor <OnTurnState> onTurnAccessor, IStatePropertyAccessor <CartState> cartStateAccessor, IPimbotServiceProvider provider)
            : base(Name)
        {
            _services          = services;
            _onTurnAccessor    = onTurnAccessor;
            _cartStateAccessor = cartStateAccessor;
            _itemService       = provider.ItemService;
            _categoryService   = provider.CategoryService;
            _featureService    = provider.FeatureService;

            // Add dialogs
            var waterfallSteps = new WaterfallStep[]
            {
                InitializeStateStepAsync,
                ResolveShowItemDialog,
                AskByAttributesDialog,
                ResolveAttributeFiltering,
                AskWhatNext,
                ResolveShowItems,
                PrintItems,
            };

            AddDialog(new WaterfallDialog(
                          "start",
                          waterfallSteps));
            AddDialog(new ChoicePrompt(ShowAllItemsPrompt));
            AddDialog(new ChoicePrompt(DidYouMeanPrompt));
            AddDialog(new ChoicePrompt(AskForPropertyPrompt));
            AddDialog(new ShowCategoriesDialog(services, onTurnAccessor, provider));
        }
        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IEditorService edSvc, IFdoProviderCapabilities caps)
            : this()
        {
            _fsId    = fsId;
            _mode    = mode;
            _cls     = cls;
            _featSvc = edSvc.CurrentConnection.FeatureService;

            IQueryControl ctrl = null;

            switch (_mode)
            {
            case QueryMode.SQL:
                ctrl   = new SqlQueryCtrl(fsId, edSvc);
                _inner = ctrl;
                break;

            case QueryMode.Standard:
                ctrl   = new StandardQueryCtrl(fsId, edSvc, cls, caps);
                _inner = ctrl;
                break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpatialContextsDialog"/> class.
 /// </summary>
 /// <param name="fsId">The fs id.</param>
 /// <param name="featSvc">The feat SVC.</param>
 public SpatialContextsDialog(string fsId, IFeatureService featSvc)
     : this()
 {
     lblFeatureSource.Text         = fsId;
     grdSpatialContexts.DataSource = featSvc.GetSpatialContextInfo(fsId, false).SpatialContext;
     lblCount.Text = string.Format(Strings.SpatialContextsFound, grdSpatialContexts.Rows.Count);
 }
示例#8
0
文件: MainForm.cs 项目: kanbang/Colt
 public MainForm(IFeatureService featSvc, IResourceService resSvc)
     : this()
 {
     this.featSvc = featSvc;
     this.resSvc = resSvc;
     localFsPreviewCtrl.Init(featSvc);
 }
 public FeatureController(IApiDescriptionGroupCollectionProvider apiDescriptionGroupCollectionProvider,
                          IActionDescriptorCollectionProvider actionDescriptorCollectionProvider, IFeatureService featureService)
 {
     _actionDescriptorCollectionProvider    = actionDescriptorCollectionProvider;
     _apiDescriptionGroupCollectionProvider = apiDescriptionGroupCollectionProvider;
     _featureService = featureService;
 }
示例#10
0
        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IFeatureService featSvc, FdoProviderCapabilities caps)
            : this()
        {
            _fsId = fsId;
            _mode = mode;
            _cls = cls;
            _featSvc = featSvc;

            IQueryControl ctrl = null;
            switch (_mode)
            {
                case QueryMode.SQL:
                    ctrl = new SqlQueryCtrl(fsId, featSvc);
                    _inner = ctrl;
                    break;
                case QueryMode.Standard:
                    ctrl = new StandardQueryCtrl(fsId, featSvc, cls, caps);
                    _inner = ctrl;
                    break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
示例#11
0
 public BrowserRestrictionController(IBrowserRestrictionService browserRestrictionService,
                                     IFeatureService featureService)
 {
     _browserRestrictionService = browserRestrictionService ??
                                  throw new ArgumentNullException(nameof(browserRestrictionService));
     _featureService = featureService ?? throw new ArgumentNullException(nameof(featureService));
 }
        public void Setup()
        {
            _dbFaker = new SecurityDbFaker();
            _mapper  = new Mapper(new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <FeatureProfile>();
            }));

            _mock = new Mock <ISecurityData>();

            //success
            _mock.Setup(x => x.DeleteFeature(It.Is <int>(id =>
                                                         _dbFaker.Features.Any(l => l.Id == id))))
            .Returns <int>(id =>
            {
                return(Task.FromResult(true));
            });

            //not exists
            _mock.Setup(x => x.DeleteFeature(It.Is <int>(id =>
                                                         _dbFaker.Features.All(l => l.Id != id))))
            .Returns <int>(id =>
            {
                throw new SecurityDbException("not exists", ExceptionType.NotFound,
                                              EntityType.Feature, new[] { id.ToString() });
            });


            _securityData = new FeatureService(_mock.Object, _mapper);
        }
示例#13
0
        public async Task Invoke(HttpContext context, IFeatureService featureService, EsquioAspNetCoreDiagnostics diagnostics)
        {
            var evaluationsResponse = new List <EvaluationResponse>();

            var names = context.Request
                        .Query[FEATURENAME_QUERY_PARAMETER_NAME];

            foreach (var featureName in names)
            {
                try
                {
                    diagnostics.EsquioMiddlewareEvaluatingFeature(featureName);

                    var isEnabled = await featureService
                                    .IsEnabledAsync(featureName, context?.RequestAborted ?? CancellationToken.None);

                    evaluationsResponse.Add(new EvaluationResponse()
                    {
                        Name    = featureName,
                        Enabled = isEnabled
                    });
                }
                catch (Exception exception)
                {
                    diagnostics.EsquioMiddlewareThrow(featureName, exception);

                    await WriteError(context, featureName);

                    return;
                }
            }

            diagnostics.EsquioMiddlewareSuccess();
            await WriteResponse(context, evaluationsResponse);
        }
示例#14
0
        public void Setup()
        {
            _dbFaker = new SecurityDbFaker();
            _mapper  = new Mapper(new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <AccessRightProfile>();
                cfg.AddProfile <FeatureProfile>();
            }));

            _mock = new Mock <ISecurityData>();
            //success
            _mock.Setup(x => x.AddFeature(It.Is <string>(l =>
                                                         !_dbFaker.Features.Any(k => k.Name.Equals(l)))))
            .Returns(() => Task.FromResult(
                         _dbFaker.Features.Max(l => l.Id) + 1));

            //existed name
            _mock.Setup(x => x.AddFeature(It.Is <string>(l =>
                                                         _dbFaker.Features.Any(k => k.Name.Equals(l)))))
            .Returns <string>(name =>
            {
                throw new SecurityDbException("existed name", ExceptionType.NameExists,
                                              EntityType.Feature, new [] { name });
            });

            //error
            _mock.Setup(x => x.AddFeature(It.Is <string>(l =>
                                                         l.Equals("Error!"))))
            .Returns <string>(name =>
            {
                throw new Exception();
            });

            _securityData = new FeatureService(_mock.Object, _mapper);
        }
示例#15
0
 public IndexModel(
     IFeatureService featureService,
     IStringLocalizer <SharedResource> sharedLocalizer)
 {
     _featureService = featureService;
     PageTitle       = sharedLocalizer[SharedResource.Facilities];
 }
 public MonthlyEmailNotficationBalanceService(IMonthlyEmailNotficationBalanceRepository repository, IEmailNotificationLogRepository emailNotificationLogRepository, ISubscriptionRepository subscriptionRepository, IFeatureService featureService) : base(repository)
 {
     _repository = repository;
     _emailNotificationLogRepository = emailNotificationLogRepository;
     _subscriptionRepository         = subscriptionRepository;
     _featureService = featureService;
 }
示例#17
0
 public RoleFeatureController(IRoleFeatureService roleFeatureService
                              , IFeatureService featureService, IRoleService roleService, IUnitOfWork unitOfWork)
 {
     this.roleFeatureService = roleFeatureService;
     this.roleService        = roleService;
     this.featureService     = featureService;
     this.unitOfWork         = unitOfWork;
 }
示例#18
0
 public PlexAvailabilityRule(IPlexContentRepository repo, ILogger <PlexAvailabilityRule> log, ISettingsService <PlexSettings> plexSettings,
                             IFeatureService featureService)
 {
     PlexContentRepository = repo;
     Log             = log;
     _plexSettings   = plexSettings;
     _featureService = featureService;
 }
示例#19
0
        public MySQLFixture()
        {
            DbContext = CreateDbContext();
            PopulateDbContext();
            var store = new EntityFrameworkFeatureStore(DbContext);

            Sut = new FeatureService(store);
        }
示例#20
0
 public AddModel(
     IFeatureService featureService,
     IStringLocalizer <SharedResource> sharedLocalizer
     )
 {
     _featureService = featureService;
     _localizer      = sharedLocalizer;
 }
 public UserController()
 {
     service                 = IoC.Resolve <IFeatureService>("FeatureService");
     companyService          = IoC.Resolve <ICompanyService>("CompanyService");
     featureSetService       = IoC.Resolve <IFeatureSetService>("FeatureSetService");
     featureSetListService   = IoC.Resolve <IFeatureSetListService>("FeatureSetListService");
     featureSetAccessService = IoC.Resolve <IFeatureSetAccessService>("FeatureSetAccessService");
 }
示例#22
0
 public NotificationEnsureClientAccountsHandler(IUnitOfWork unitOfWork, IFeatureService featureService, ISearch <Account> accounts, ISearch <Fund> funds, ILookup <AccountType> accountTypeLookup)
 {
     this.unitOfWork        = unitOfWork;
     this.featureService    = featureService;
     this.accounts          = accounts;
     this.funds             = funds;
     this.accountTypeLookup = accountTypeLookup;
 }
 public UserController()
 {
     service = IoC.Resolve<IFeatureService>("FeatureService");
     companyService = IoC.Resolve<ICompanyService>("CompanyService");
     featureSetService = IoC.Resolve<IFeatureSetService>("FeatureSetService");
     featureSetListService = IoC.Resolve<IFeatureSetListService>("FeatureSetListService");
     featureSetAccessService = IoC.Resolve<IFeatureSetAccessService>("FeatureSetAccessService");
 }
 public IndexModel(
     IFeatureService featureService,
     IBaseService baseService,
     IStringLocalizer <SharedResource> sharedLocalizer)
 {
     _featureService = featureService;
     _baseService    = baseService;
     PageTitle       = sharedLocalizer[SharedResource.Categories];
 }
示例#25
0
        public InlineRenameSession(
            IThreadingContext threadingContext,
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            IWaitIndicator waitIndicator,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            IEnumerable <IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener)
            : base(threadingContext, assertIsForeground: true)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _renameInfo = renameInfo;

            _triggerDocument = triggerSpan.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (_triggerDocument == null)
            {
                throw new InvalidOperationException(EditorFeaturesResources.The_triggerSpan_is_not_included_in_the_given_workspace);
            }

            _inlineRenameSessionDurationLogBlock = Logger.LogBlock(FunctionId.Rename_InlineSession, CancellationToken.None);

            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _textBufferFactoryService        = textBufferFactoryService;
            _textBufferAssociatedViewService = textBufferAssociatedViewService;
            _textBufferAssociatedViewService.SubjectBuffersConnected += OnSubjectBuffersConnected;

            // Disable completion when an inline rename session starts
            _featureService          = featureServiceFactory.GlobalFeatureService;
            _completionDisabledToken = _featureService.Disable(PredefinedEditorFeatureNames.Completion, this);

            _renameService          = renameService;
            _waitIndicator          = waitIndicator;
            _refactorNotifyServices = refactorNotifyServices;
            _asyncListener          = asyncListener;
            _triggerView            = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                                      textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _optionSet = renameInfo.ForceRenameOverloads
                ? workspace.Options.WithChangedOption(RenameOptions.RenameOverloads, true)
                : workspace.Options;

            this.ReplacementText = triggerSpan.GetText();

            _baseSolution    = _triggerDocument.Project.Solution;
            this.UndoManager = workspace.Services.GetService <IInlineRenameUndoManager>();

            _debuggingWorkspaceService = workspace.Services.GetService <IDebuggingWorkspaceService>();
            _debuggingWorkspaceService.BeforeDebuggingStateChanged += OnBeforeDebuggingStateChanged;

            InitializeOpenBuffers(triggerSpan);
        }
示例#26
0
 public FeatureController(IFeatureService featureService, ISupportedBrowserService supportedBrowserService,
                          IBrowserRestrictionService browserRestrictionService)
 {
     _featureService          = featureService ?? throw new ArgumentNullException(nameof(featureService));
     _supportedBrowserService = supportedBrowserService ??
                                throw new ArgumentNullException(nameof(supportedBrowserService));
     _browserRestrictionService = browserRestrictionService ??
                                  throw new ArgumentNullException(nameof(browserRestrictionService));
 }
示例#27
0
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="edSvc">The editor service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featureSourceId">The FeatureSource id.</param>
        /// <param name="mode">The editor mode</param>
        /// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
        public void Initialize(IEditorService edSvc, IFdoProviderCapabilities caps, ClassDefinition cls, string featureSourceId, ExpressionEditorMode mode, bool attachStylizationFunctions)
        {
            try
            {
                _mode  = mode;
                _cls   = cls;
                _edSvc = edSvc;
                if (_edSvc != null)
                {
                    _featSvc = _edSvc.CurrentConnection.FeatureService;
                    insertThemeExpressionToolStripMenuItem.Enabled = true;
                }
                else
                {
                    insertThemeExpressionToolStripMenuItem.Enabled = false;
                }
                m_featureSource = featureSourceId;
                _caps           = caps;

                btnTools.Enabled = attachStylizationFunctions;

                SortedList <string, PropertyDefinition> sortedCols = new SortedList <string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string          name = col.Name;
                    ToolStripButton btn  = new ToolStripButton();
                    btn.Name   = name;
                    btn.Text   = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                {
                    ColumnName.SelectedIndex = 0;
                }

                LoadFunctions(caps, attachStylizationFunctions);
            }
            catch
            {
            }
        }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceValidationContext"/> class.
 /// </summary>
 /// <param name="resSvc">The res SVC.</param>
 /// <param name="featSvc">The feat SVC.</param>
 public ResourceValidationContext(IResourceService resSvc, IFeatureService featSvc)
 {
     _resSvc = resSvc;
     _featSvc = featSvc;
     _validated = new Dictionary<string, string>();
     _resources = new Dictionary<string, IResource>();
     _schemas = new Dictionary<string, FeatureSourceDescription>();
     _spatialContexts = new Dictionary<string, FdoSpatialContextList>();
     _caps = new Dictionary<string, FdoProviderCapabilities>();
 }
示例#29
0
        /// <summary>
        /// Initializes the FDO expression editor
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="cls"></param>
        /// <param name="featureSourceId"></param>
        /// <param name="mode"></param>
        public void Initialize(IServerConnection conn, ClassDefinition cls, string featureSourceId, ExpressionEditorMode mode)
        {
            IFeatureSource           fs   = (IFeatureSource)conn.ResourceService.GetResource(featureSourceId);
            IFdoProviderCapabilities caps = conn.FeatureService.GetProviderCapabilities(fs.Provider);

            //This is normally set by the Editor Service, but we don't have that so do it here
            _featSvc = conn.FeatureService;

            this.Initialize(null, caps, cls, featureSourceId, mode, false);
        }
示例#30
0
 public UserOperationController(ClassesBL classesBL, FieldsBL fieldsBL
                                , IFeatureService featureService,
                                ILogger logger)
 {
     _FeatureService = featureService;
     _UserManager    = Startup.UserManagerFactory.Invoke();
     _ClassesBL      = classesBL;
     _FieldsBL       = fieldsBL;
     _Logger         = logger;
 }
 public PimBotServiceProvider(
     IItemService itemservice,
     IKeywordService keywordService,
     IFeatureService featureService,
     ICategoryService categoryService)
 {
     ItemService     = itemservice;
     FeatureService  = featureService;
     IKeywordService = keywordService;
     CategoryService = categoryService;
 }
        public FeatureListViewModel(IFeatureService featureService, INavigationService navigationService)
        {
            Argument.IsNotNull(() => featureService);
            Argument.IsNotNull(() => navigationService);

            _navigationService = navigationService;

            Features = new ObservableCollection<Feature>(featureService.GetAvailableFeatures());

            NavigateToFeature = new Command<Feature>(OnNavigateToFeatureExecute);
        }
示例#33
0
 public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies,
                                INotificationHelper notification, ILogger <PlexAvailabilityChecker> log, IHubContext <NotificationHub> hub, IFeatureService featureService)
 {
     _tvRepo              = tvRequest;
     _repo                = repo;
     _movieRepo           = movies;
     _notificationService = notification;
     _log            = log;
     _notification   = hub;
     _featureService = featureService;
 }
示例#34
0
        public FeatureController(
            IUnitOfWork unitOfWork,
            IFeatureRepository FeatureRepository,
            IMapper mapper,
            IFeatureService featureService,
            IModificationService modificationService) :
            base(unitOfWork, FeatureRepository, mapper, modificationService)

        {
            _featureService = featureService;
        }
示例#35
0
 /// <summary>
 /// Configure actions to be executed depending on the feature active state.
 /// </summary>
 /// <param name="featureService">The <see cref="IFeatureService"/>.</param>
 /// <param name="featureName">The feature name to be evaluated.</param>
 /// <param name="enabled">Action to be executed when <paramref name="featureName"/> is enabled. </param>
 /// <param name="disabled">Action to be executed when <paramref name="featureName"/> is not enabled.</param>
 /// <param name="cancellationToken"> A System.Threading.CancellationToken to observe while waiting for the task to complete.</param>
 /// <returns>A <see cref="Task"/> that complete when <paramref name="active"/> or <paramref name="disabled"/> is executed.</returns>
 public static async Task Do(this IFeatureService featureService, string featureName, Action enabled, Action disabled, CancellationToken cancellationToken = default)
 {
     if (await featureService.IsEnabledAsync(featureName, cancellationToken))
     {
         enabled();
     }
     else
     {
         disabled();
     }
 }
示例#36
0
 /// <summary>
 /// Configure actions to be executed depending on the feature active state.
 /// </summary>
 /// <typeparam name="TResult">The action return type.</typeparam>
 /// <param name="featureService">The <see cref="IFeatureService"/>.</param>
 /// <param name="featureName">The feature name to be evaluated.</param>
 /// <param name="enabled">Action to be executed when <paramref name="featureName"/> is active. </param>
 /// <param name="disabled">Action to be executed when <paramref name="featureName"/> is not active.</param>
 /// <param name="cancellationToken"> A System.Threading.CancellationToken to observe while waiting for the task to complete.</param>
 /// <returns>A <see cref="Task{TResult}"/> that complete when <paramref name="enabled"/> or <paramref name="disabled"/> is executed.</returns>
 public static async Task <TResult> Do <TResult>(this IFeatureService featureService, string featureName, Func <TResult> enabled, Func <TResult> disabled, CancellationToken cancellationToken = default)
 {
     if (await featureService.IsEnabledAsync(featureName, cancellationToken))
     {
         return(enabled());
     }
     else
     {
         return(disabled());
     }
 }
示例#37
0
 public UserEmailBuilder(IPsaContextService contextService, IConnClientService ConnClientService, IMasterOrganizationRepository masterOrganizationRepository, IDict dictionary, IAppSettings settings, IFeatureService featureService, IEmailTemplateService emailTemplateService, IDistributorHelperService distributorHelperService)
 {
     ContextService               = contextService;
     ConnClientService            = ConnClientService;
     MasterOrganizationRepository = masterOrganizationRepository;
     Dictionary               = dictionary;
     Settings                 = settings;
     FeatureService           = featureService;
     EmailTemplateService     = emailTemplateService;
     DistributorHelperService = distributorHelperService;
 }
示例#38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StandardQueryCtrl"/> class.
 /// </summary>
 /// <param name="fsId">The fs id.</param>
 /// <param name="featSvc">The feat SVC.</param>
 /// <param name="cls">The CLS.</param>
 /// <param name="caps">The caps.</param>
 public StandardQueryCtrl(string fsId, IFeatureService featSvc, ClassDefinition cls, FdoProviderCapabilities caps)
     : this()
 {
     _fsId = fsId;
     _featSvc = featSvc;
     _cls = cls;
     _caps = caps;
     foreach (var prop in cls.Properties)
     {
         chkProperties.Items.Add(prop.Name, true);
     }
 }
示例#39
0
 public SqlQueryCtrl(string fsId, IFeatureService featSvc)
     : this()
 {
     _fsId = fsId;
     _featSvc = featSvc;
 }
        public FeatureController(IFeatureService featureService)
        {
            Check.If(featureService).IsNotNull();

            _featureService = featureService;
        }
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="featSvc">The feature service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featuresSourceId">The features source id.</param>
        /// <param name="attachStylizationFunctions">If true, Stylization FDO functions will be included</param>
        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
        {
            try
            {
                _cls = cls;
                _featSvc = featSvc;
                m_featureSource = featuresSourceId;

                //TODO: Perhaps add column type and indication of primary key
                SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string name = col.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                    ColumnName.SelectedIndex = 0;

                LoadCompletableProperties(_cls.Properties);

                //TODO: Figure out how to translate the enums into something usefull

                //Functions
                SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
                {
                    sortedFuncs.Add(func.Name, func);
                }

                if (attachStylizationFunctions)
                {
                    foreach (var func in GetStylizationFunctions())
                    {
                        sortedFuncs.Add(func.Name, func);
                    }
                }

                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
                {
                    string name = func.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.ToolTipText = func.Description;
                    string fmt = "{0}({1})";
                    List<string> args = new List<string>();
                    foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
                    {
                        args.Add(argDef.Name.Trim());
                    }
                    string expr = string.Format(fmt, name, string.Join(", ", args.ToArray()));
                    btn.Click += delegate
                    {
                        InsertText(expr);
                    };
                    btnFunctions.DropDown.Items.Add(btn);
                }
                LoadCompletableFunctions(caps.Expression.FunctionDefinitionList);
                if (attachStylizationFunctions)
                    LoadCompletableFunctions(GetStylizationFunctions());

                //Spatial Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnSpatial.DropDown.Items.Add(btn);
                }

                //Distance Operators
                foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnDistance.DropDown.Items.Add(btn);
                }

                //Conditional Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnCondition.DropDown.Items.Add(btn);
                }

                /*try
                {
                    /*FdoProviderCapabilities cap = m_connection.GetProviderCapabilities(m_providername);
                    foreach (FdoProviderCapabilitiesFilterType cmd in cap.Filter.Condition)
                        FunctionCombo.Items.Add(cmd.ToString());

                    FunctionLabel.Enabled = FunctionCombo.Enabled = true;
                }
                catch
                {
                    FunctionLabel.Enabled = FunctionCombo.Enabled = false;
                }*/
            }
            catch
            {
            }
        }
        public static FeatureController GetInitialisedFeatureController(IFeatureService featureService)
        {
            var controller = new FeatureController(featureService)
            {
                Request = new HttpRequestMessage { RequestUri = new Uri(Url) },
                Configuration = new HttpConfiguration()
            };

            controller.Configuration.MapHttpAttributeRoutes();
            controller.Configuration.EnsureInitialized();

            return controller;
        }
 /// <summary>
 /// Initializes this instance
 /// </summary>
 /// <param name="featureService">The feature service.</param>
 public void Init(IFeatureService featureService)
 {
     _fsvc = featureService;
 }
示例#44
0
 public override void Bind(IEditorService service)
 {
     //Only available on MGOS 2.2 and above
     this.LocalPreviewEnabled = service.SiteVersion >= new Version(2, 2);
     _fs = (IFeatureSource)service.GetEditedResource();
     _caps = service.FeatureService.GetProviderCapabilities(_fs.Provider);
     _fsvc = service.FeatureService;
     _rsvc = service.ResourceService;
     _edsvc = service;
     _edsvc.RegisterCustomNotifier(this);
     this.ConfigEnabled = _caps.Connection.SupportsConfiguration;
 }
示例#45
0
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="featSvc">The feature service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featuresSourceId">The features source id.</param>
        /// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
        {
            try
            {
                _cls = cls;
                _featSvc = featSvc;
                m_featureSource = featuresSourceId;
                _caps = caps;

                SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string name = col.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                    ColumnName.SelectedIndex = 0;

                //Functions
                SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
                {
                    sortedFuncs.Add(func.Name, func);
                }

                if (attachStylizationFunctions)
                {
                    foreach (var func in Utility.GetStylizationFunctions())
                    {
                        sortedFuncs.Add(func.Name, func);
                    }
                }

                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
                {
                    string name = func.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.ToolTipText = func.Description;

                    string fmt = "{0}({1})"; //NOXLATE
                    List<string> args = new List<string>();
                    foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
                    {
                        args.Add(argDef.Name.Trim());
                    }
                    string expr = string.Format(fmt, name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
                    btn.Click += delegate
                    {
                        InsertText(expr);
                    };
                    btnFunctions.DropDown.Items.Add(btn);
                }

                //Spatial Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnSpatial.DropDown.Items.Add(btn);
                }

                //Distance Operators
                foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnDistance.DropDown.Items.Add(btn);
                }

                //Conditional Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnCondition.DropDown.Items.Add(btn);
                }
            }
            catch
            {
            }
        }
 public FeatureController()
 {
     UserInformationFactory.SetInstance(UserInformation<User, WhoIsOnline>.Instance(new HttpContextWrapper(System.Web.HttpContext.Current), new WhoIsOnlineService<User, WhoIsOnline>(new EntityWhoIsOnlineRepository()), new GetUserStrategy()));
     theFeatureService = new FeatureService();
 }