public FeatureController(VinaC2CContext context, IWebHostEnvironment environment, IHubContext <SignalServer> hubContext) { this._context = context; this._environment = environment; this._hubContext = hubContext; featureService = new FeatureService(context); }
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; }
public static void AfterScenario(ITestOutcomeEvent e) { var specflowContext = SpecflowContextWrapper.Create(); var scenario = ScenarioService.GetScenario(e, specflowContext); FeatureService.RegisterScenario(scenario, specflowContext); }
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>"; }
private FeatureService CreateFeatureService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new FeatureService(userId); return(service); }
/// <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)); }
public ArticlesController(IFeatureRepository featureRepository, IBlogPostRepository blogPostRepository, IUserRepository userRepository) : base(userRepository) { _blogPostRepository = blogPostRepository; _featureRepository = featureRepository; _featureService = new FeatureService(_featureRepository); }
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); }
public void AttributeCreateNoNameTest() { FeatureService service = getService(); Feature feature = new Feature(); feature.Type = 10; service.Add(feature); }
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); }
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); }
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); } }
public void Init() { var configuration = new MapperConfiguration(config => config.AddProfiles( typeof(AdminProfile) ) ); IMapper mapper = new Mapper(configuration); _featureService = new FeatureService(_efContextMock.Object, mapper); }
public CheckResiCommand( BinderByteService binderByteService, CekResiService cekResiService, FeatureService featureService, TelegramService telegramService ) { _binderByteService = binderByteService; _cekResiService = cekResiService; _featureService = featureService; _telegramService = telegramService; }
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); }
public EpicGamesService( IRecurringJobManager recurringJobManager, ITelegramBotClient botClient, CacheService cacheService, RssService rssService, FeatureService featureService ) { _recurringJobManager = recurringJobManager; _botClient = botClient; _cacheService = cacheService; _rssService = rssService; _featureService = featureService; }
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); }
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"]); } } } }); }
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); }
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); }
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 } ); }
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); }
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); }
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(); }
public EditModel(PacketFeaturesService packetFeaturesService, FeatureService featureService) { _packetFeaturesService = packetFeaturesService; _featureService = featureService; }
public FeatureServiceTests() { _store = new InMemoryFeatureStore(); _sut = new FeatureService(_store); }
public void TestInitialize() => featureService = new FeatureService();
public FeaturesController() { featSrv = new FeatureService(); }
public RolesController() { roleSrv = new RoleService(); featSrv = new FeatureService(); }