public UnitOfWork(NgAppDbContext context) { _context = context; Features = new FeatureRepository(_context); Model = new ModelRepository(_context); Make = new MakeRepository(_context); }
public ManagePackageQuestionController(UsersAccessRepository usersAccessRepository , PackageQuestionsRepository packageQuestionsRepository , FeatureRepository featureRepository) : base(usersAccessRepository) { _packageQuestionsRepository = packageQuestionsRepository; _featureRepository = featureRepository; }
public async Task Should_update_feature_data() { var feature = new Feature("Feature01", true); await AddEntity(feature); await ExecuteCommand(async (contexto) => { var featureRepository = new FeatureRepository(contexto); var featureToUpdata = await featureRepository.GetAsync(feature.Id); featureToUpdata.Disable(); await contexto.SaveChangesAsync(); }); var persistedEntity = await ExecuteCommand <Feature>((contexto) => { var featureRepository = new FeatureRepository(contexto); return(featureRepository.GetAsync(feature.Id)); }); using (new AssertionScope()) { persistedEntity.Name.Should().Be("Feature01"); persistedEntity.IsActive.Should().BeFalse(); } }
public async Task Should_toggle_feature() { var feature = new Feature("isButtonGreen", false); await AddEntity(feature); await ExecuteCommand((context) => { FeatureAppService featureAppService = GetFeatureAppService(context); return(featureAppService.ToggleFeature(new FeatureModel { Name = "isButtonGreen", IsActive = true })); }); var persistedEntity = await ExecuteCommand((contexto) => { var featureRepository = new FeatureRepository(contexto); return(featureRepository.GetAsync(feature.Id)); }); using (new AssertionScope()) { persistedEntity.Name.Should().Be("isButtonGreen"); persistedEntity.IsActive.Should().BeTrue(); } }
public static bool FeatureSwitchEnabled(this HtmlHelper helper, string featureName) { var featureManager = new FeatureRepository(); var feature = featureManager.GetFeature(featureName); return(feature.Enabled); }
//-------------------------------------------------------------------- /** * Constructeur */ public ShowPromotionViewModel(int promotion_id) { promotionRepository = new PromotionRepository(); featureRepository = new FeatureRepository(); Promotion = promotionRepository.GetPromotion(promotion_id); Features = featureRepository.GetFeatures(); }
public UnitOfWork(VegaDbContext context, ISortHelper <Vehicle> vehicleSortHelper) { _context = context; _vehicleSortHelper = vehicleSortHelper; Features = new FeatureRepository(_context); Makes = new MakeRepository(_context); Vehicles = new VehicleRepository(_context, vehicleSortHelper); Photos = new PhotoRepository(_context); }
public AssemblyService(ComputerShopContext context) { categoryRepo = new CategoryRepository(context); productRepo = new ProductRepository(context); assemblyRepo = new AssemblyRepository(context); featureRepo = new FeatureRepository(context); featuresForCategoryRepo = new FeaturesForCategoryRepository(context); featureValueRepo = new FeatureValueRepository(context); userRepo = new UserRepository(context); }
public ManageFeatureController(FeatureRepository featureRepository , FeatureItemRepository featureItemRepository , UsersAccessRepository usersAccessRepository, ProductGroupFeatureRepository productGroupFeatureRepository, ProductFeatureRepository productFeatureRepository) : base(usersAccessRepository) { _featureRepository = featureRepository; _featureItemRepository = featureItemRepository; _productGroupFeatureRepository = productGroupFeatureRepository; _productFeatureRepository = productFeatureRepository; }
public void DeleteProduct(int id) { var repo = new ProductRepository(); var imgrepo = new ImageRepository(); var featrepo = new FeatureRepository(); imgrepo.DeleteRangeByProductId(id); //where y el resultado un removerange featrepo.DeleteRangeByProductId(id); //where y el resultado un removerange repo.Delete(id); }
public ProductController() { prep = new ProductRepository(); pcrep = new ProductCategoryRepository(); frep = new FeatureRepository(); crep = new CategoryRepository(); pfrep = new ProductFeatureRepository(); }
private void MergeList(List <Feature> listParam, List <Feature> listDb, FeatureRepository repo) { var a = listDb.Where(x => listParam.Any(y => (y.Id == x.Id) && (x.Name != y.Name || x.Description != y.Description))).ToList(); repo.UpdateRange(a); var b = listDb.Where(x => listParam.All(y => y.Id != x.Id)).ToList(); repo.DeleteRange(b); var c = listParam.Where(x => x.Id == 0).ToList(); repo.AddRange(c); }
public AdminRepositoryGetHierarchyTest() { // Arrange repository = new FeatureRepository(); // SiCo Activated using (SPSite site = new SPSite(TestContent.SharePointContainers.SiCoActivated.Url)) { siCoActivatedId = site.ID; webAppId = site.WebApplication.Id; // RootWeb using (SPWeb web = site.OpenWeb()) { siCoActivatedRootWebId = web.ID; } // SiCoActivatedSubWebActivated using (SPWeb web = site.OpenWeb(TestContent.SharePointContainers.SiCoActivated.SubWebActivated.UrlRelative)) { siCoActivatedSubWebActivatedId = web.ID; } // SiCoActivatedSubWebInactive using (SPWeb web = site.OpenWeb(TestContent.SharePointContainers.SiCoActivated.SubWebInactive.UrlRelative)) { siCoActivatedSubWebInactiveId = web.ID; } } // SiCo Inactive using (SPSite site = new SPSite(TestContent.SharePointContainers.SiCoInActive.Url)) { siCoInactiveId = site.ID; // RootWeb using (SPWeb web = site.OpenWeb()) { siCoInactiveRootWebId = web.ID; } // SiCoInactiveSubWebActivated using (SPWeb web = site.OpenWeb(TestContent.SharePointContainers.SiCoInActive.SubWebActivated.UrlRelative)) { siCoInactiveSubWebActivatedId = web.ID; } // SiCoInactiveSubWebInactive using (SPWeb web = site.OpenWeb(TestContent.SharePointContainers.SiCoInActive.SubWebInactive.UrlRelative)) { siCoInactiveSubWebInactiveId = web.ID; } } }
public UnitOfWork() { _context = new ApplicationDbContext(); Projects = new ProjectRepository(_context); Practices = new PracticeRepository(_context); Users = new UserRepository(_context); PracticeUsers = new PracticeUserRepository(_context); Features = new FeatureRepository(_context); FeatureUsers = new FeatureUserRepository(_context); Experiences = new ExperienceRepository(_context); Communications = new CommunicationRespository(_context); Countries = new CountryRepository(_context); }
private FeatureAppService GetFeatureAppService(TogglerContext context) { var featureRepository = new FeatureRepository(context); var applicationFeatureRepository = new ApplicationFeatureRepository(context); var applicationRepository = new ApplicationRepository(context); var uow = new UnitOfWork(context); var featureDomainService = new FeatureDomainService(_mediator, featureRepository); var applicationFeatureDomainService = new ApplicationFeatureDomainService(_mediator, applicationFeatureRepository, featureRepository); var featureAppService = new FeatureAppService(uow, applicationRepository, featureRepository, featureDomainService, applicationFeatureDomainService, applicationFeatureRepository); return(featureAppService); }
public UnitOfWork() { _context = new ApplicationDbContext(); Projects = new ProjectRepository(_context); Practices = new PracticeRepository(_context); Users = new UserRepository(_context); PracticeUsers = new PracticeUserRepository(_context); Features = new FeatureRepository(_context); FeatureUsers = new FeatureUserRepository(_context); Experiences = new ExperienceRepository(_context); Communications = new CommunicationRespository(_context); Countries = new CountryRepository(_context); }
public ManageFeatureQuestionForPakageController( UsersAccessRepository usersAccessRepository, FeatureQuestionForPakageRepository featureQuestionForPakageRepository, ProductGroupRepository productGroupRepository, FeatureRepository featureRepository, PackageUserAnswerRepository packageUserAnswerRepository ) : base(usersAccessRepository) { _featureQuestionForPakageRepository = featureQuestionForPakageRepository; _productGroupRepository = productGroupRepository; _featureRepository = featureRepository; _packageUserAnswerRepository = packageUserAnswerRepository; }
public AdminService(ComputerShopContext context) { groupRepo = new GroupRepository(context); categoryRepo = new CategoryRepository(context); producentRepo = new ProducentRepository(context); featureRepo = new FeatureRepository(context); featureValueRepo = new FeatureValueRepository(context); featureForCategoryRepo = new FeaturesForCategoryRepository(context); productRepo = new ProductRepository(context); featureValueRepo = new FeatureValueRepository(context); userRepo = new UserRepository(context); featureValueForProductRepo = new FeatureValueForProductRepository(context); }
/// <summary> /// Checks importability of subsequences. /// </summary> /// <exception cref="Exception"> /// Thrown if subsequences are not importable. /// Thrown if feature contains no leaf location or /// if source length not equals to parent sequence length or /// if feature length is less than 1. /// </exception> private void CheckImportability() { for (int i = 1; i < features.Count; i++) { FeatureItem feature = features[i]; ILocation location = feature.Location; List <ILocation> leafLocations = location.GetLeafLocations(); if (feature.Key == "source") { throw new Exception($"Sequence seems to be chimeric as it is several 'source' records in file. Second source location: {leafLocations[0].StartData}"); } if (!FeatureRepository.FeatureExists(feature.Key)) { throw new Exception($"Unknown feature. Feature name = {feature.Key}"); } if (feature.Key == gene) { // checking if there is any feature with identical location if (allNonGenesLeafLocations.Any(l => LocationsEqual(leafLocations, l))) { continue; } } if (location.SubLocations.Count > 0) { LocationOperator subLocationOperator = location.SubLocations[0].Operator; foreach (ILocation subLocation in location.SubLocations) { if (subLocation.Operator != subLocationOperator) { throw new Exception($"SubLocation operators does not match: {subLocationOperator} and {subLocation.Operator}"); } } } if (leafLocations.Count == 0) { throw new Exception("No leaf locations"); } if (leafLocations.Any(leafLocation => leafLocation.LocationEnd < leafLocation.LocationStart)) { throw new Exception("Subsequence length cant be less than 1."); } } }
public UnitOfWork(HotelContext context) { this.context = context ?? throw new System.ArgumentNullException(nameof(context)); Users = new UserRepository(context); BookingOffers = new BookingOfferRepository(context); Offers = new OfferRepository(context); BookingRoomServices = new BookingRoomServiceRepository(context); BookingRooms = new BookingRoomRepository(context); Services = new ServiceRepository(context); RoomFeatures = new RoomFeatureRepository(context); Features = new FeatureRepository(context); RoomImages = new RoomImageRepository(context); Rooms = new RoomRepository(context); }
public void UpdateProduct(Product product) { var prodrepo = new ProductRepository(); var imgrepo = new ImageRepository(); var featrepo = new FeatureRepository(); var features = featrepo.GetByProductId(product.Id); imgrepo.AddRange(product.Image); MergeList(product.Feature, features, featrepo); prodrepo.Update(product); }
public ManageProductGroupDependencyController(UsersAccessRepository usersAccessRepository, ProductGroupDependenciesRepository productGroupDependenciesRepository, ProductGroupRepository productGroupRepository, FeatureRepository featureRepository, ConditionRepository conditionRepository, ProductGroupFeatureRepository productGroupFeatureRepository, FeatureItemRepository featureItemRepository ) : base(usersAccessRepository) { _productGroupDependenciesRepository = productGroupDependenciesRepository; _productGroupRepository = productGroupRepository; _featureRepository = featureRepository; _conditionRepository = conditionRepository; _productGroupFeatureRepository = productGroupFeatureRepository; _featureItemRepository = featureItemRepository; }
public int AddProduct(Product product) { var prodrepo = new ProductRepository(); var featrepo = new FeatureRepository(); var features = product.Feature; product.Feature = null; var id = prodrepo.Add(product); foreach (var feat in features) { feat.ProductID = product.Id; } featrepo.AddRange(features); return(id); }
public async Task Should_persist_feature_data() { var feature = new Feature("Feature01", true); await AddEntity(feature); var persistedEntity = await ExecuteCommand <Feature>((contexto) => { var featureRepository = new FeatureRepository(contexto); return(featureRepository.GetAsync(feature.Id)); }); using (new AssertionScope()) { persistedEntity.Name.Should().Be("Feature01"); persistedEntity.IsActive.Should().BeTrue(); } }
public ManageProductController(UsersAccessRepository usersAccessRepository, ProductRepostitory productRepostitory, ProductGroupRepository productGroupRepository, ProductUnitRepository productUnitRepository, ProductGroupFeatureRepository productGroupFeatureRepository, ProductFeatureRepository productFeatureRepository, ProductGalleryRepository productGalleryRepository, FeatureRepository featureRepository, ProductDiscountRepository productDiscountRepository) : base(usersAccessRepository) { _productRepostitory = productRepostitory; _productGroupRepository = productGroupRepository; _productUnitRepository = productUnitRepository; _productGroupFeatureRepository = productGroupFeatureRepository; _productFeatureRepository = productFeatureRepository; _productGalleryRepository = productGalleryRepository; _featureRepository = featureRepository; _productDiscountRepository = productDiscountRepository; }
public async Task Should_get_feature_by_name() { var feature01 = new Feature("Feature01", true); var feature02 = new Feature("Feature02", false); var feature03 = new Feature("Feature03", true); await AddEntity(feature01, feature02, feature03); var persistedEntity = await ExecuteCommand <Feature>((contexto) => { var featureRepository = new FeatureRepository(contexto); return(featureRepository.GetByName("Feature02")); }); using (new AssertionScope()) { persistedEntity.Name.Should().Be("Feature02"); persistedEntity.IsActive.Should().BeFalse(); } }
public async Task Should_add_new_feature() { var newFeature = await ExecuteCommand((context) => { FeatureAppService featureAppService = GetFeatureAppService(context); return(featureAppService.Add(new FeatureModel { Name = "isButtonGreen", IsActive = true })); }); var persistedEntity = await ExecuteCommand((contexto) => { var featureRepository = new FeatureRepository(contexto); return(featureRepository.GetAsync(newFeature.Id)); }); using (new AssertionScope()) { persistedEntity.Should().NotBeNull(); newFeature.Name.Should().Be("isButtonGreen"); newFeature.IsActive.Should().BeTrue(); } }
public List <Feature> GetFeatureByProductId(int id) { var repo = new FeatureRepository(); return(repo.GetByProductId(id)); }
/// <summary> /// Create subsequences from features /// and non-coding subsequences from gaps. /// </summary> /// <returns> /// Returns tuple of coding and non-coding features count. /// </returns> private (int, int) CreateFeatureSubsequences() { var codingSubsequences = new List <Subsequence>(features.Count); var newPositions = new List <Position>(); var newSequenceAttributes = new List <SequenceAttribute>(); for (int i = 1; i < features.Count; i++) { FeatureItem feature = features[i]; ILocation location = feature.Location; List <ILocation> leafLocations = location.GetLeafLocations(); Feature subsequenceFeature; if (feature.Key == gene) { if (allNonGenesLeafLocations.Any(l => LocationsEqual(leafLocations, l))) { continue; } subsequenceFeature = Feature.Gene; } else { subsequenceFeature = FeatureRepository.GetFeatureByName(feature.Key); } if (feature.Qualifiers.ContainsKey(LibiadaWeb.Attribute.Pseudo.GetDisplayValue()) || feature.Qualifiers.ContainsKey(LibiadaWeb.Attribute.Pseudogene.GetDisplayValue())) { subsequenceFeature = Feature.PseudoGen; } bool partial = CheckPartial(leafLocations); bool complement = location.Operator == LocationOperator.Complement; bool join = leafLocations.Count > 1; bool complementJoin = join && complement; if (location.SubLocations.Count > 0) { complement = complement || location.SubLocations[0].Operator == LocationOperator.Complement; } int start = leafLocations[0].LocationStart - 1; int end = leafLocations[0].LocationEnd - 1; int length = end - start + 1; var subsequence = new Subsequence { Id = db.GetNewElementId(), Feature = subsequenceFeature, Partial = partial, SequenceId = sequenceId, Start = start, Length = length, RemoteId = location.Accession }; codingSubsequences.Add(subsequence); AddPositionToMap(start, end); newPositions.AddRange(CreateAdditionalPositions(leafLocations, subsequence.Id)); var sequenceAttributes = sequenceAttributeRepository.Create(feature.Qualifiers, complement, complementJoin, subsequence); newSequenceAttributes.AddRange(sequenceAttributes); } var nonCodingSubsequences = CreateNonCodingSubsequences(); db.Subsequence.AddRange(codingSubsequences); db.Subsequence.AddRange(nonCodingSubsequences); db.Position.AddRange(newPositions); db.SequenceAttribute.AddRange(newSequenceAttributes); db.SaveChanges(); return(codingSubsequences.Count, nonCodingSubsequences.Count); }
public FeatureController() { frep = new FeatureRepository(); }
public static async Task Main(string[] args) { var config = new ConfigurationBuilder() .AddJsonFile("appSettings.json", true, true) .AddUserSecrets <Program>() .Build(); var tableStorage = new AzureTableStorage(config["StorageAccountConnectionString"]); var storageAccount = CloudStorageAccount.Parse(config["StorageAccountConnectionString"]); var cloudBlobClient = new BlobServiceClient(config["StorageAccountConnectionString"]); var globalSearchTermRepository = new GlobalSearchTermRepository(); var featureRepository = new FeatureRepository(); var serviceProvider = new ServiceCollection() .AddSingleton <IAzureTableStorage>(tableStorage) .AddSingleton(storageAccount) .AddSingleton(globalSearchTermRepository) .AddSingleton(featureRepository) .AddSingleton(cloudBlobClient) .AddSingleton <IConfiguration>(config); await using var googleCredStream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("StarWars5e.Parser.google_credentials.json"); if (googleCredStream != null && googleCredStream.Length > 0) { await using var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("StarWars5e.Parser.google_credentials.json"); var googleCredential = GoogleCredential.FromStream(stream).CreateScoped(SheetsService.ScopeConstants.Spreadsheets); var sheetsService = new SheetsService(new BaseClientService.Initializer { HttpClientInitializer = googleCredential, ApplicationName = "SW5E Sheets API" }); serviceProvider.AddSingleton(sheetsService); } if (!string.IsNullOrWhiteSpace(config["SearchKey"])) { var searchIndexClient = new SearchIndexClient(new Uri("https://sw5esearch.search.windows.net"), new AzureKeyCredential(config["SearchKey"])); var searchIndexerClient = new SearchIndexerClient(new Uri("https://sw5esearch.search.windows.net"), new AzureKeyCredential(config["SearchKey"])); serviceProvider.AddSingleton(searchIndexClient); serviceProvider.AddSingleton(searchIndexerClient); } var serviceProviderBuilt = serviceProvider.BuildServiceProvider(); var languages = config["Languages"].Split(','); if (!languages.Any()) { Console.WriteLine("No languages found."); return; } foreach (var language in languages) { var languageEnum = Enum.TryParse <Language>(language, true, out var parsedLanguage) ? parsedLanguage : Language.None; if (languageEnum == Language.None) { Console.WriteLine($"Language {language} not supported."); return; } var stringsClass = LocalizationFactory.Get(languageEnum); await ParseContent.Parse(serviceProviderBuilt, serviceProviderBuilt.GetService <IAzureTableStorage>(), serviceProviderBuilt.GetService <GlobalSearchTermRepository>(), stringsClass); } }