Ejemplo n.º 1
0
 public FeatureController(VinaC2CContext context, IWebHostEnvironment environment, IHubContext <SignalServer> hubContext)
 {
     this._context     = context;
     this._environment = environment;
     this._hubContext  = hubContext;
     featureService    = new FeatureService(context);
 }
Ejemplo n.º 2
0
        public FeatureViewViewModel(FeatureService featureService)
        {
            featureService.FeaturesChanged += this.OnFeaturesChanged;

            this.selectWorldEvent
            .Select(i => this.worlds.Value.Select(i))
            .Subscribe(this.worlds);

            this.selectCategoryEvent
            .Select(i => this.categories.Value.Select(i))
            .Subscribe(this.categories);

            this.worlds.Select(_ => true).Subscribe(this.categoriesInvalidated);
            this.categories.Select(_ => true).Subscribe(this.featuresInvalidated);

            this.worldsInvalidated
            .DistinctUntilChanged()
            .Where(x => x)
            .Subscribe(_ => this.UpdateWorlds());

            this.categoriesInvalidated
            .DistinctUntilChanged()
            .Where(x => x)
            .Subscribe(_ => this.UpdateCategories());

            this.featuresInvalidated
            .DistinctUntilChanged()
            .Where(x => x)
            .Subscribe(_ => this.UpdateFeatures());

            this.featureService = featureService;

            this.SectionType = SectionType.Feature;
        }
Ejemplo n.º 3
0
        public static void AfterScenario(ITestOutcomeEvent e)
        {
            var specflowContext = SpecflowContextWrapper.Create();
            var scenario        = ScenarioService.GetScenario(e, specflowContext);

            FeatureService.RegisterScenario(scenario, specflowContext);
        }
Ejemplo n.º 4
0
        private void SetViewBag(Blog blog, ViewResult viewResult, User user)
        {
            if (blog == null)
            {
                blog = SetupNewBlog();
            }

            _featureService = new FeatureService(_featureRepository);

            //var blogposts = _blogPostRepository.GetAll().Where(o => o.Published).ToList();
            //var archiveModel = new ArchiveModel();
            //var years = blogposts.Select(o => o.DateCreated.Year).Distinct().Select(i => new Year { Name = i });
            //foreach (var year in years)
            //{
            //    var months =
            //        blogposts.Where(o => o.DateCreated.Year == year.Name).Select(i => i.DateCreated.Month).Distinct().
            //            Select(y => new Month
            //            {
            //                Nr = y,
            //                Name = new DateTime(DateTime.Now.Year, y, 1).ToString("MMM")
            //            });
            //    foreach (var month in months)
            //    {
            //        var posts =
            //            blogposts.Where(o => o.DateCreated.Year == year.Name && o.DateCreated.Month == month.Nr);
            //        month.Posts.AddRange(posts.Select(o => new Article { Title = o.Title, Id = o.Id }));
            //        month.Count = posts.Count();
            //        year.Months.Add(month);
            //    }
            //    year.Count = months.Count();
            //    archiveModel.Years.Add(year);
            //}

            viewResult.ViewBag.Title                 = blog.Name;
            viewResult.ViewBag.Logo                  = blog.LogoUrl;
            viewResult.ViewBag.Name                  = blog.Name;
            viewResult.ViewBag.Description           = blog.Description;
            viewResult.ViewBag.Phone                 = blog.Phone;
            viewResult.ViewBag.Fax                   = blog.Fax;
            viewResult.ViewBag.Address               = blog.Address.AddressLine;
            viewResult.ViewBag.Post                  = blog.Address.Zip + " " + blog.Address.City;
            viewResult.ViewBag.FullAddress           = blog.Address.AddressLine + ", " + blog.Address.Zip + " " + blog.Address.City;
            viewResult.ViewBag.Email                 = blog.Email;
            viewResult.ViewBag.Lat                   = blog.GeoPoint.Latitude;
            viewResult.ViewBag.Lon                   = blog.GeoPoint.Longitude;
            viewResult.ViewBag.Menu                  = blog.Menu;
            viewResult.ViewBag.StyleSheet            = blog.StyleSheet;
            viewResult.ViewBag.GoogleAnalyticsId     = blog.GoogleAnalyticsId;
            viewResult.ViewBag.EnableNewsletter      = _featureService.EnableNewsletter.IsEnabledForUser(user);
            viewResult.ViewBag.EnableTaggableContent = _featureService.EnableTaggableContent.IsEnabledForUser(user);
            viewResult.ViewBag.EnableUserLogin       = _featureService.EnableUserLogin.IsEnabledForUser(user);
            viewResult.ViewBag.EnableSearch          = _featureService.EnableSearch.IsEnabledForUser(user);
            //ViewBag.ShowContactinfoInFooter = blog.ShowContactinfoInFooter;
            //ViewBag.Tags =
            //    blogposts.SelectMany(o => o.Tags).GroupBy(i => i).Select(
            //        y => new TagModel { Name = y.Key, Count = y.Count() });
            //ViewBag.Archive = archiveModel;
            //ViewBag.UserIsEditor = LoggedInUser != null && LoggedInUser.Groups.Any(o => o == "Admin");
            viewResult.ViewBag.AllowedHtmlElements = "<h1><h2><h3><h4><a><ul><li><strong><b><u><i><p><img>";
        }
Ejemplo n.º 5
0
        private FeatureService CreateFeatureService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new FeatureService(userId);

            return(service);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns a reference to the <see cref="Tracker"/> class object.
        /// </summary>
        /// <param name="solver">The solver to be used by the returned tracker.</param>
        /// <param name="geocoder">The geocoder to be used by the returned tracker.</param>
        /// <param name="messageReporter">The messageReporter to be used by the returned
        /// tracker.</param>
        /// <returns>A new <see cref="Tracker"/> class instance.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="solver"/>,
        /// <paramref name="geocoder"/> or <paramref name="messageReporter"/> is a null
        /// reference.</exception>
        public Tracker GetTracker(
            IVrpSolver solver,
            IGeocoder geocoder,
            IMessageReporter messageReporter)
        {
            CodeContract.RequiresNotNull("solver", solver);
            CodeContract.RequiresNotNull("geocoder", geocoder);
            CodeContract.RequiresNotNull("messageReporter", messageReporter);

            _CheckSettings(_settings);

            var settings = new TrackingSettings
            {
                BreakTolerance = _settings.TrackingSettings.BreakTolerance ?? 0,
            };

            var uri     = new Uri(_settings.TrackingServiceInfo.RestUrl);
            var service = FeatureService.Create(uri, Server);
            var trackingServiceClient = new TrackingServiceClient(service);

            var trackingService        = new TrackingServiceClient(service);
            var synchronizationService = new SynchronizationService(trackingServiceClient);

            return(new Tracker(
                       settings,
                       trackingService,
                       synchronizationService,
                       solver,
                       geocoder,
                       messageReporter));
        }
Ejemplo n.º 7
0
 public ArticlesController(IFeatureRepository featureRepository, IBlogPostRepository blogPostRepository, IUserRepository userRepository)
     : base(userRepository)
 {
     _blogPostRepository = blogPostRepository;
     _featureRepository  = featureRepository;
     _featureService     = new FeatureService(_featureRepository);
 }
Ejemplo n.º 8
0
        public void AttributeGetAllTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Type = FeatureTypes.STRING;
            feature.Name = "Color";
            service.Add(feature);

            Feature feature2 = new Feature();

            feature2.Type = FeatureTypes.STRING;
            feature2.Name = "Talle";
            service.Add(feature2);

            List <Feature> allFeatures = service.GetAll();

            Assert.AreEqual(2, allFeatures.Count());
            Feature savedFeature = allFeatures.Find(ft => ft.Id == feature.Id);

            Assert.IsNotNull(savedFeature);
            Feature savedFeature2 = allFeatures.Find(ft => ft.Id == feature2.Id);

            Assert.IsNotNull(savedFeature2);
        }
Ejemplo n.º 9
0
        public void AttributeCreateNoNameTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Type = 10;
            service.Add(feature);
        }
Ejemplo n.º 10
0
        public void AttributeCreateNoTypeTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Name = "Color";
            service.Add(feature);
        }
   public void Setup() {
 
     // set up Mediator mock
     _mediator = new Mock<IMediator>(MockBehavior.Strict);
 
     // inject mock as dependency
     _sut = new FeatureService(_mediator.Object);
   }
Ejemplo n.º 12
0
        public static void Main()
        {
            bugsnagClient = new Bugsnag.Client(new Bugsnag.Configuration
            {
                ApiKey     = "fa43381b116de659fcf1cfda14884d98",
                AppVersion = Application.ProductVersion,
                AutoNotify = false
            });

            // install custom handler for fatal exceptions
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            // route UI thread exceptions to the fatal exception handler
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

            RemoveOldVersionSettings();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var mainForm              = new MainForm();
            var tileCache             = new BitmapCache();
            var dialogService         = new DialogService(mainForm);
            var featureService        = new FeatureService();
            var sectionsService       = new SectionService();
            var sectionFactory        = new SectionFactory(tileCache);
            var sectionBitmapService  = new SectionBitmapService(sectionFactory);
            var mapModelFactory       = new MapModelFactory(tileCache);
            var mapLoadingService     = new MapLoadingService(sectionFactory, mapModelFactory);
            var imageImportingService = new ImageImportService(tileCache);
            var model = new CoreModel();

            // Unsure if I should get the SectionViews to register themselves, or pass the dispatcher the SectionViews as params
            mainForm.SectionView.SetModel(new SectionViewViewModel(sectionsService));
            mainForm.FeatureView.SetModel(new FeatureViewViewModel(featureService));

            var dispatcher = new Dispatcher(
                model,
                dialogService,
                sectionsService,
                sectionBitmapService,
                featureService,
                mapLoadingService,
                imageImportingService,
                tileCache,
                mainForm);

            mainForm.SetModel(new MainFormViewModel(model, dispatcher));

            mainForm.MapViewPanel.SetModel(new MapViewViewModel(model, dispatcher, featureService));

            var minimapForm = new MinimapForm();

            minimapForm.Owner = mainForm;
            minimapForm.SetModel(new MinimapFormViewModel(model, dispatcher));

            Application.Run(mainForm);
        }
Ejemplo n.º 13
0
        public static void AfterTestRun()
        {
            FileHelper.SourcePath = SBEConfiguration.SourcePath;
            FeatureService.SetFeatureTexts(SBEConfiguration.SourcePath);
            var assemblies = FeatureService.GetAllAssemblies();

            foreach (var generator in SBEConfiguration.Generators)
            {
                generator.Generate(assemblies);
            }
        }
Ejemplo n.º 14
0
        public void Init()
        {
            var configuration = new MapperConfiguration(config =>
                                                        config.AddProfiles(
                                                            typeof(AdminProfile)
                                                            )
                                                        );
            IMapper mapper = new Mapper(configuration);

            _featureService = new FeatureService(_efContextMock.Object, mapper);
        }
Ejemplo n.º 15
0
 public CheckResiCommand(
     BinderByteService binderByteService,
     CekResiService cekResiService,
     FeatureService featureService,
     TelegramService telegramService
     )
 {
     _binderByteService = binderByteService;
     _cekResiService    = cekResiService;
     _featureService    = featureService;
     _telegramService   = telegramService;
 }
Ejemplo n.º 16
0
        public void AttributeCreateDateOkTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Type = FeatureTypes.DATE;
            feature.Name = "Vencimiento";
            service.Add(feature);
            GenericRepository <Feature> repo = new GenericRepository <Feature>(getContext());

            Feature savedFeature = repo.Get(feature.Id);

            Assert.IsNotNull(savedFeature);
        }
Ejemplo n.º 17
0
 public EpicGamesService(
     IRecurringJobManager recurringJobManager,
     ITelegramBotClient botClient,
     CacheService cacheService,
     RssService rssService,
     FeatureService featureService
     )
 {
     _recurringJobManager = recurringJobManager;
     _botClient           = botClient;
     _cacheService        = cacheService;
     _rssService          = rssService;
     _featureService      = featureService;
 }
Ejemplo n.º 18
0
        public BaseFeature[] LoadFeatures(ViewStack parent)
        {
            var result   = new List <BaseFeature>();
            var assembly = typeof(ApplicationService).Assembly;

            var features = FeatureService.LoadFeatures();

            foreach (var feature in features)
            {
                feature.Metadata.IconPath = string.Format("pack://application:,,,/{0}", feature.Metadata.IconPath);
            }

            return(features);
        }
Ejemplo n.º 19
0
        protected override void OnClick()
        {
            // Approach 1
            // open feature service by known URL

            ServiceConnectionProperties svcsProperties = new ServiceConnectionProperties(
                new Uri("http://services.arcgis.com/6DIQcwlPy8knb6sg/arcgis/rest/services/Openstreetmap/FeatureServer"));

            QueuedTask.Run(() =>
            {
                using (FeatureService featureService = new FeatureService(svcsProperties))
                {
                    var footprints             = featureService.OpenDataset <FeatureClass>(0);
                    var featureClassDefinition = footprints.GetDefinition();

                    var oidField = featureClassDefinition.GetObjectIDField();
                }
            });


            // Approach 2
            // open feature service from layer
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault();

            QueuedTask.Run(() =>
            {
                using (FeatureService featureService = featureLayer.GetFeatureClass().GetDatastore() as FeatureService)
                {
                    var footprints             = featureService.OpenDataset <FeatureClass>(0);
                    var footprintsFeatureClass = featureLayer.GetFeatureClass();
                    var featureClassDefinition = footprints.GetDefinition();

                    var oidField = featureClassDefinition.GetObjectIDField();

                    using (var featureCursor = footprints.Search(new QueryFilter()
                    {
                        WhereClause = "building = 'yes'"
                    }, false))
                    {
                        while (featureCursor.MoveNext())
                        {
                            var currentFeature = featureCursor.Current as Feature;

                            System.Diagnostics.Debug.WriteLine(currentFeature["osmuser"]);
                        }
                    }
                }
            });
        }
Ejemplo n.º 20
0
        public void AttributeCreateStringOkTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Type = FeatureTypes.STRING;
            feature.Name = "Color";
            service.Add(feature);

            GenericRepository <Feature> repo = new GenericRepository <Feature>(getContext());

            Feature savedFeature = repo.Get(feature.Id);

            Assert.IsNotNull(savedFeature);
        }
Ejemplo n.º 21
0
        public void AttributeExistingTypeWithNameTest()
        {
            FeatureService service = getService();
            Feature        feature = new Feature();

            feature.Type = FeatureTypes.STRING;
            feature.Name = "Color";
            service.Add(feature);

            Feature feature2 = new Feature();

            feature2.Type = FeatureTypes.STRING;
            feature2.Name = "Color";
            service.Add(feature);
            service.Add(feature2);
        }
Ejemplo n.º 22
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            var       container = new UnityContainer();
            MyContext context   = new MyContext();
            GenericRepository <User>           userRepo           = new GenericRepository <User>(context);
            GenericRepository <Address>        addressRepo        = new GenericRepository <Address>(context);
            GenericRepository <Order>          orderRepo          = new GenericRepository <Order>(context);
            GenericRepository <Category>       categoryRepo       = new GenericRepository <Category>(context);
            GenericRepository <Product>        productRepo        = new GenericRepository <Product>(context);
            GenericRepository <Feature>        featureRepo        = new GenericRepository <Feature>(context);
            GenericRepository <ProductFeature> productFeatureRepo = new GenericRepository <ProductFeature>(context);
            GenericRepository <OrderProduct>   orderProductRepo   = new GenericRepository <OrderProduct>(context);
            GenericRepository <Review>         reviewRepo         = new GenericRepository <Review>(context);


            UserService     userService     = new UserService(userRepo, orderRepo, addressRepo, orderProductRepo, productRepo);
            AddressService  addressService  = new AddressService(addressRepo, userRepo);
            CategoryService categoryService = new CategoryService(categoryRepo, productRepo);

            ProductService productService = new ProductService(productRepo, productFeatureRepo, featureRepo, orderProductRepo, reviewRepo, orderRepo);
            FeatureService featureService = new FeatureService(featureRepo);
            OrderService   orderService   = new OrderService(orderRepo, orderProductRepo, userRepo, productRepo);
            ReviewService  reviewService  = new ReviewService(reviewRepo, productRepo, userRepo, orderRepo, orderProductRepo);

            container.RegisterInstance <IUserService>(userService);
            container.RegisterInstance <IAddressService>(addressService);
            container.RegisterInstance <ICategoryService>(categoryService);
            container.RegisterInstance <IProductService>(productService);
            container.RegisterInstance <IFeatureService>(featureService);
            container.RegisterInstance <IOrderService>(orderService);
            container.RegisterInstance <IReviewService>(reviewService);
            config.DependencyResolver = new UnityResolver(container);


            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Ejemplo n.º 23
0
        protected override bool Evaluate(IIdentity identity, string route, string method)
        {
            var path       = $"{route}/{method}";
            var identityId = identity?.Name;

            // Check feature premission
            User user = UserService.Get(i => i.IdentityId == identityId);

            bool isAdmin     = user?.Role.IsAdmin ?? false;
            var  permissions = user?.Role?.Permissions ?? new Feature[0];

            // Admin has full access
            bool allowAccess = isAdmin || permissions.Any(i => i.Path.ToLower() == path.ToLower());

            Security.Feature = FeatureService.Get(path);
            Security.User    = user;

            return(allowAccess);
        }
Ejemplo n.º 24
0
        public static IEnumerable <Feature> GetFeature(int?userId)
        {
            List <Feature> features = null;

            using (FeatureService srv = new FeatureService())
            {
                features = srv.GetFeats(userId);
            }

            if (features != null)
            {
                //若此會員有此功能,回傳true
                var query = features.Where(f => f.ActionName == "Index");
                if (query.Any())
                {
                    return(query);
                }
            }

            return(null);
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            // Here you can execute your code withot running full web UI (ASP.NET MVC or ASP.NET Core)
            //var sqlManager = new FeatureManager(@"WORK-MS-02\MSSQL2016");
            //sqlManager.ConfigureConnectionString("BPMonline7111_BStefaniuk_WORK_3_Build");
            //var features = sqlManager.GetFeatures().Result;
            ////sqlManager.SetFeaturesState(features.ToList());

            //foreach (var feature in features)
            //{
            //    Console.WriteLine($"Id: {feature.Id}, Code: {feature.Code}, State: {feature.State}");
            //}

            //var updateFeatures = new List<FeatureDto>
            //{
            //    new FeatureDto
            //    {
            //        Id = new Guid("294429AC-D295-4D63-BBCB-C782FC139DFD"),
            //        State = false
            //    },
            //    new FeatureDto
            //    {
            //        Id = new Guid("BAFF6A85-154E-4348-B489-CD6DA190FE0B"),
            //        State = true
            //    }
            //};

            //sqlManager.SetFeaturesState(updateFeatures).GetAwaiter();

            var featureService = new FeatureService();
            var features       = featureService.GetFeatures("BPMonline7111_BStefaniuk_WORK_3_Build").GetAwaiter().GetResult();

            foreach (var feature in features)
            {
                Console.WriteLine($"Id: {feature.Id}, Code: {feature.Code}, State: {feature.State}");
            }

            // Delay
            Console.Read();
        }
Ejemplo n.º 26
0
 public EditModel(PacketFeaturesService packetFeaturesService,
                  FeatureService featureService)
 {
     _packetFeaturesService = packetFeaturesService;
     _featureService        = featureService;
 }
Ejemplo n.º 27
0
 public FeatureServiceTests()
 {
     _store = new InMemoryFeatureStore();
     _sut   = new FeatureService(_store);
 }
Ejemplo n.º 28
0
 public void TestInitialize() => featureService = new FeatureService();
 public FeaturesController()
 {
     featSrv = new FeatureService();
 }
Ejemplo n.º 30
0
 public RolesController()
 {
     roleSrv = new RoleService();
     featSrv = new FeatureService();
 }