public UnitOfWork() { _context = new ApplicationContext(); CountriesRepository = new CountriesRepository(_context); PersonRepository = new PersonRepository(_context); TreeRepository = new TreeRepository(_context); }
protected override CommonTest.TreeRepositoryTestMethods getTestMethods(FileSystem system) { IStreamedBlobRepository blrepo = new StreamedBlobRepository(system); ITreeRepository trrepo = new TreeRepository(system); return(new CommonTest.TreeRepositoryTestMethods(blrepo, trrepo)); }
protected override CommonTest.TreeRepositoryTestMethods getTestMethods(DataContext db) { IStreamedBlobRepository blrepo = new StreamedBlobRepository(db); ITreeRepository trrepo = new TreeRepository(db); return(new CommonTest.TreeRepositoryTestMethods(blrepo, trrepo)); }
public TreeDetailsViewModel(INavigation navigation, string selectedTreeID) { _navigation = navigation; _tree = new TREE(); _tree.TREEID = selectedTreeID; _treeRepository = new TreeRepository(); UpdateTreeCommand = new Command(async() => await UpdateTree()); DeleteTreeCommand = new Command(async() => await DeleteTree()); CommentsCommand = new Command(async() => await ShowComments()); ResetCommand = new Command(async() => await ResetValues()); StemMapCommand = new Command(async() => await ShowStemMap()); DeformityCommand = new Command(async() => await ShowDeformity()); AgeCommand = new Command(async() => await ShowAge()); ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.ID).ToList(); ListVigour = PickerService.VigourItems().OrderBy(c => c.NAME).ToList(); ListCrownDamage = PickerService.CrownDamageItems().OrderBy(c => c.NAME).ToList(); ListDefoliatingInsect = PickerService.DefoliatingInsectItems().OrderBy(c => c.NAME).ToList(); ListFoliarDisease = PickerService.FoliarDiseaseItems().OrderBy(c => c.NAME).ToList(); ListBarkRetention = PickerService.BarkRetentionItems().OrderBy(c => c.NAME).ToList(); ListWoodCondition = PickerService.WoodConditionItems().OrderBy(c => c.NAME).ToList(); ListMortalityCause = PickerService.MortalityCauseItems().OrderBy(c => c.NAME).ToList(); ListDecayClass = PickerService.DecayClassItems().OrderBy(c => c.NAME).ToList(); ListCrownPosition = PickerService.CrownPositionItems().OrderBy(c => c.NAME).ToList(); ListCrownClass = PickerService.CrownClassItems().OrderBy(c => c.NAME).ToList(); ListStemQuality = PickerService.StemQualityItems().OrderBy(c => c.NAME).ToList(); FetchTreeDetails(); IsChanged = false; OnAppearingCommand = new Command(() => OnAppearing()); OnDisappearingCommand = new Command(() => OnDisappearing()); }
public AccountController(UserManager <IdentityUser> userManager, ILogger <AccountController> logger) { _userManager = userManager; _logger = logger; this.areaRepository = new AreaRepository(); this.treeRepository = new TreeRepository(); }
async Task TestQueryByPath() { var db = getDataContext(); ICommitRepository cmrepo = new CommitRepository(db); ITreeRepository trrepo = new TreeRepository(db); var rf = await cmrepo.GetCommitByRef("HEAD"); if (rf == null) { return; } try { var tree = await trrepo.GetTreeRecursivelyFromPath(rf.Item2.TreeID, ((AbsoluteTreePath)"/src/Persists/").Canonicalize()); if (tree != null) { RecursivePrint(tree.Item1, tree.Item2); } } catch (Exception e) { Console.Error.WriteLine(e); } }
private void DisplayData() { var connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; var repository = new TreeRepository(connectionString); // 커뮤니티별 메뉴 전체 리스트(IsVisible 속성이 true인 것만 출력) Model = repository.GetTrees(); }
protected override CommonTest.RefRepositoryTestMethods getTestMethods(DataContext db) { IStreamedBlobRepository blrepo = new StreamedBlobRepository(db); ITreeRepository trrepo = new TreeRepository(db); ICommitRepository cmrepo = new CommitRepository(db); ITagRepository tgrepo = new TagRepository(db); IRefRepository rfrepo = new RefRepository(db); return(new CommonTest.RefRepositoryTestMethods(cmrepo, blrepo, trrepo, tgrepo, rfrepo)); }
protected override CommonTest.TagRepositoryTestMethods getTestMethods(FileSystem system) { IStreamedBlobRepository blrepo = new StreamedBlobRepository(system); ITreeRepository trrepo = new TreeRepository(system); ICommitRepository cmrepo = new CommitRepository(system); ITagRepository tgrepo = new TagRepository(system); IRefRepository rfrepo = new RefRepository(system); return(new CommonTest.TagRepositoryTestMethods(cmrepo, blrepo, trrepo, tgrepo, rfrepo)); }
public TreeListViewModel(INavigation navigation, string fk) { _navigation = navigation; _treeRepository = new TreeRepository(); _fk = fk; AddCommand = new Command(async() => await ShowAdd(_fk)); DeleteAllCommand = new Command(async() => await DeleteAll()); ShowFilteredCommand = new Command <TREE>(async(x) => await ShowStemMap(x)); ShowDeformityCommand = new Command <TREE>(async(x) => await ShowDeformity(x)); FetchTrees(); }
async Task TestRetrieveTreeRecursively(TreeID rootid) { var db = getDataContext(); Console.WriteLine("Retrieving TreeID {0} recursively...", rootid); ITreeRepository repo = new TreeRepository(db); var tree = await repo.GetTreeRecursively(rootid); // Recursively display trees: RecursivePrint(tree.Item1, tree.Item2); }
// public ApplicationUserRepository ApplicationUserRepository; //public ProductKeyRepository ProductKeyRepository; public UnitOfWork(DbContext dataContext) { DbContext = dataContext; TreeRepository = new TreeRepository(dataContext); FriendshipRepository = new FriendshipRepository(dataContext); GenDiseasesRepository = new GenDiseasesRepository(dataContext); HaveDiseaseRepository = new HaveDiseaseRepository(dataContext); MemberRepository = new MemberRepository(dataContext); ParentsRepository = new ParentsRepository(dataContext); ChildsRepository = new ChildsRepository(dataContext); MarriageRepository = new MarriageRepository(dataContext); // ApplicationUserRepository = new ApplicationUserRepository(dataContext); //ProductKeyRepository = new ProductKeyRepository(dataContext); }
public TestTreeRepository_RemoveNodeAsync() { dbContext = TestHelpers.CreateTestDb(); repository = new TreeRepository <TestDbContext, Category, int>(dbContext, new IntIdentifierSerializer()); TestHelpers.CreateTestCategoryTree(dbContext, repository); // ┌───────1───────┐ // │ │ │ // ┌───2───┐ 3 4 // │ │ │ // 5 6 8 // │ │ // 9 10 // │ // 7 }
public ProfileController(UserRepository userRepository , ShopOrderRepository shopOrderRepository , ShopProductRepository shopProductRepository , UserAddressRepository userAddressRepository , ProductUnitRepository productUnitRepository , TreeRepository treeRepository , ProductRepostitory productRepostitory , ShopOrderPaymentRepository shopOrderPaymentRepository) { _userRepository = userRepository; _shopOrderRepository = shopOrderRepository; _shopProductRepository = shopProductRepository; _userAddressRepository = userAddressRepository; _productUnitRepository = productUnitRepository; _treeRepository = treeRepository; _productRepostitory = productRepostitory; _shopOrderPaymentRepository = shopOrderPaymentRepository; }
public AddTreeViewModel(INavigation navigation) { _navigation = navigation; //_treeValidator = new TreeValidator(); _tree = new TREE(); _treeRepository = new TreeRepository(); AddCommand = new Command(async() => await AddTree("")); ViewAllCommand = new Command(async() => await ShowList()); ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.NAME).ToList(); ListVigour = PickerService.VigourItems().ToList(); ListCrownDamage = PickerService.CrownDamageItems().ToList(); ListDefoliatingInsect = PickerService.DefoliatingInsectItems().ToList(); ListFoliarDisease = PickerService.FoliarDiseaseItems().ToList(); ListBarkRetention = PickerService.BarkRetentionItems().ToList(); ListWoodCondition = PickerService.WoodConditionItems().ToList(); ListMortalityCause = PickerService.MortalityCauseItems().ToList(); ListDecayClass = PickerService.DecayClassItems().ToList(); }
public UnitOfWork(GrowingPlantsContext context) { UserRepository = new UserRepository(context); TreeRepository = new TreeRepository(context); MeasurementUnitRepository = new MeasurementUnitRepository(context); LightRepository = new LightRepository(context); HumidityRepository = new HumidityRepository(context); TemperatureRepository = new TemperatureRepository(context); FavoriteTreeRepository = new FavoriteTreeRepository(context); CountryRepository = new CountryRepository(context); PlantingProcessRepository = new PlantingProcessRepository(context); PlantingEnvironmentRepository = new PlantingEnvironmentRepository(context); ProcessStepRepository = new ProcessStepRepository(context); PlantingActionRepository = new PlantingActionRepository(context); RecurrenceRepository = new RecurrenceRepository(context); NotificationRepository = new NotificationRepository(context); PlantingSpotRepository = new PlantingSpotRepository(context); PlantTypeRepository = new PlantTypeRepository(context); GalleryRepository = new GalleryRepository(context); PictureRepository = new PictureRepository(context); }
public TreeAgeViewModel(INavigation navigation, TREE tree) { _navigation = navigation; _tree = tree; // _tree.TREEID = selectedTreeID; _treeRepository = new TreeRepository(); _dosave = false; UpdateTreeCommand = new Command(async() => await UpdateTree()); CommentsCommand = new Command(async() => await ShowComments()); ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.NAME).ToList(); ListCoreStatus = PickerService.CoreStatusItems().OrderBy(c => c.NAME).ToList(); //FetchTreeDetails(); //defaults if (_tree.HEIGHTTOCORE == 0) { _tree.HEIGHTTOCORE = 1.3F; } OnAppearingCommand = new Command(() => OnAppearing()); OnDisappearingCommand = new Command(() => OnDisappearing()); }
public TreeListViewModel(INavigation navigation, string fk) { try { _navigation = navigation; _treeRepository = new TreeRepository(); _fk = fk; _tree = new TREE(); AddCommand = new Command(async() => await ShowAdd(_fk)); DeleteAllCommand = new Command(async() => await DeleteAll()); ShowFilteredCommand = new Command <TREE>(async(x) => await ShowStemMap(x)); ShowDeformityCommand = new Command <TREE>(async(x) => await ShowDeformity(x)); ShowAgesCommand = new Command <TREE>(async(x) => await ShowAges(x)); FetchTrees(); } catch (Exception ex) { var myerror = ex.Message; } }
public TestTreeRepository_QueryRoots() { dbContext = TestHelpers.CreateTestDb(); repository = new TreeRepository <TestDbContext, Category, int>(dbContext, new IntIdentifierSerializer()); TestHelpers.CreateTestCategoryTree(dbContext, repository); dbContext.Categories.Add(new Category { Id = 11 }); dbContext.SaveChanges(); // ┌───────1───────┬──────11 // │ │ │ // ┌───2───┐ 3 4 // │ │ │ // 5 6 8 // │ │ // 9 10 // │ // 7 }
public ManageBankService(IConfiguration configuration , UsersPaymentRepository usersPaymentRepository , ShopProductRepository shopProductRepository , ShopOrderRepository shopOrderRepository , SmsRestClient smsRestClient , UserRepository userRepository , ShopOrderStatusRepository shopOrderStatusRepository , ShopOrderPaymentRepository shopOrderPaymentRepository , TreeRepository treeRepository , LogRepository logRepository) { _bankConfig = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>(); _usersPaymentRepository = usersPaymentRepository; _shopProductRepository = shopProductRepository; _shopOrderRepository = shopOrderRepository; _smsRestClient = smsRestClient; _userRepository = userRepository; _shopOrderStatusRepository = shopOrderStatusRepository; _shopOrderPaymentRepository = shopOrderPaymentRepository; _treeRepository = treeRepository; _logRepository = logRepository; }
public static void CreateTestCategoryTree(TestDbContext dbContext, TreeRepository <TestDbContext, Category, int> repository) { var cats = Enumerable.Range(1, 10) .Select(i => new Category { Id = i }) .ToList(); dbContext.AddRange(cats); dbContext.SaveChanges(); repository.SetParentAsync(cats[1], cats[0]); repository.SetParentAsync(cats[2], cats[0]); repository.SetParentAsync(cats[3], cats[0]); repository.SetParentAsync(cats[4], cats[1]); repository.SetParentAsync(cats[5], cats[1]); repository.SetParentAsync(cats[7], cats[3]); repository.SetParentAsync(cats[8], cats[4]); repository.SetParentAsync(cats[9], cats[5]); repository.SetParentAsync(cats[6], cats[8]); dbContext.SaveChanges(); // ┌───────1───────┐ // │ │ │ // ┌───2───┐ 3 4 // │ │ │ // 5 6 8 // │ │ // 9 10 // │ // 7 }
public TreeDetailsViewModel(INavigation navigation, string selectedTreeID) { _navigation = navigation; _tree = new TREE(); _tree.TREEID = selectedTreeID; _treeRepository = new TreeRepository(); UpdateTreeCommand = new Command(async() => await UpdateTree()); DeleteTreeCommand = new Command(async() => await DeleteTree()); CommentsCommand = new Command(async() => await ShowComments()); ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.NAME).ToList(); ListVigour = PickerService.VigourItems().ToList(); ListCrownDamage = PickerService.CrownDamageItems().ToList(); ListDefoliatingInsect = PickerService.DefoliatingInsectItems().ToList(); ListFoliarDisease = PickerService.FoliarDiseaseItems().ToList(); ListBarkRetention = PickerService.BarkRetentionItems().ToList(); ListWoodCondition = PickerService.WoodConditionItems().ToList(); ListMortalityCause = PickerService.MortalityCauseItems().ToList(); ListDecayClass = PickerService.DecayClassItems().ToList(); ListCrownPosition = PickerService.CrownPositionItems().ToList(); FetchTreeDetails(); }
public TreeManagerUserControl() { _connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; _repository = new TreeRepository(_connectionString); }
async Task DemonstrateHashing() { var db = getDataContext(); IBlobRepository blrepo = new BlobRepository(db); ITreeRepository trrepo = new TreeRepository(db); ICommitRepository cmrepo = new CommitRepository(db); IRefRepository rfrepo = new RefRepository(db); // Create a sample set of blobs: Blob readmeBlob; ImmutableContainer <BlobID, Blob> blobs = new ImmutableContainer <BlobID, Blob>( bl => bl.ID, readmeBlob = new Blob.Builder(pContents: Encoding.UTF8.GetBytes(@"Hello world")) ); Console.Out.WriteAsync(String.Format("Blob {0} = \"{1}\"" + Environment.NewLine, readmeBlob.ID.ToString(firstLength: 7), Encoding.UTF8.GetString(readmeBlob.Contents))); // Persist them: var persistingBlobs = blrepo.PersistBlobs(blobs); // Create an initial tree: Tree trRoot; ImmutableContainer <TreeID, Tree> trees = new ImmutableContainer <TreeID, Tree>( tr => tr.ID, new Tree[] { trRoot = new Tree.Builder( pTrees: new List <TreeTreeReference>(0), pBlobs: new List <TreeBlobReference> { new TreeBlobReference.Builder(pName: "README", pBlobID: readmeBlob.ID) } ) } ); // Dump the tree: RecursivePrint(trRoot.ID, trees); // Now wait for the blob persistence to complete: await persistingBlobs; // Persist our tree now: var persistTrees = trrepo.PersistTree(trRoot.ID, trees); await persistTrees; // Let's make a commit out of all that: Commit cm1 = new Commit.Builder( pParents: new List <CommitID>(0), pTreeID: trRoot.ID, pCommitter: @"James Dunne <*****@*****.**>", pDateCommitted: DateTimeOffset.Now, pMessage: "Initial commit." ); // Persist that commit: Console.Out.WriteAsync(String.Format("Persisting commit {0}..." + Environment.NewLine, cm1.ID.ToString(firstLength: 7))); await cmrepo.PersistCommit(cm1); // Let's create a ref to point to it: await rfrepo.DestroyRefByName("demo/HEAD"); await rfrepo.PersistRef(new Ref.Builder(pName: "demo/HEAD", pCommitID: cm1.ID)); await Console.Out.WriteAsync(String.Format("Pointed demo/HEAD to commit {0}" + Environment.NewLine, cm1.ID.ToString(firstLength: 7))); // Now let's create a new blob with some revised contents: (adding a period at the end) Blob readmeBlob2; blobs = new ImmutableContainer <BlobID, Blob>( bl => bl.ID, readmeBlob2 = new Blob.Builder(Encoding.UTF8.GetBytes(@"Hello world.")) ); var persistBlobs2 = blrepo.PersistBlobs(blobs); // Make a new tree out of the old tree: Tree.Builder trRoot2b = new Tree.Builder(trRoot); // Point README to the new BlobID: trRoot2b.Blobs[0] = new TreeBlobReference.Builder(trRoot2b.Blobs[0]) { BlobID = readmeBlob2.ID }; // Freeze our Tree.Builder to a Tree: Tree trRoot2; trees = new ImmutableContainer <TreeID, Tree>(tr => tr.ID, trRoot2 = trRoot2b); // Wait for the blobs to persist: await persistBlobs2; // Now persist the new tree: await trrepo.PersistTree(trRoot2.ID, trees); // Load a streamed blob: IStreamedBlob strbl = await blrepo.GetStreamedBlob(readmeBlob.ID); await strbl.ReadStream(blsr => { Console.WriteLine("blob is {0} length", blsr.Length); byte[] dum = new byte[8040]; int count = 8040; try { while ((count = blsr.Read(dum, 0, 8040)) > 0) { for (int i = 0; i < (count / 40) + ((count % 40) > 0 ? 1 : 0); ++i) { Console.WriteLine(dum.ToHexString(i * 40, Math.Min(count - (i * 40), 40))); } } } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); } }); }
public ManageTreeController( UsersAccessRepository usersAccessRepository, TreeRepository treeRepository) : base(usersAccessRepository) { _treeRepository = treeRepository; }
public AddTreeViewModel(INavigation navigation, string fk) { _navigation = navigation; //_treeValidator = new TreeValidator(); _tree = new TREE(); _treeRepository = new TreeRepository(); _fk = fk; _tree.PLOTID = fk; AddCommand = new Command(async() => await AddTree(_fk)); DeleteTreeCommand = new Command(async() => await DeleteTree()); ViewAllCommand = new Command(async() => await ShowList()); ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.ID).ToList(); ListVigour = PickerService.VigourItems().OrderBy(c => c.NAME).ToList(); ListCrownDamage = PickerService.CrownDamageItems().OrderBy(c => c.NAME).ToList(); ListDefoliatingInsect = PickerService.DefoliatingInsectItems().OrderBy(c => c.NAME).ToList(); ListFoliarDisease = PickerService.FoliarDiseaseItems().OrderBy(c => c.NAME).ToList(); ListBarkRetention = PickerService.BarkRetentionItems().OrderBy(c => c.NAME).ToList(); ListWoodCondition = PickerService.WoodConditionItems().OrderBy(c => c.NAME).ToList(); ListMortalityCause = PickerService.MortalityCauseItems().OrderBy(c => c.NAME).ToList(); ListDecayClass = PickerService.DecayClassItems().OrderBy(c => c.NAME).ToList(); ListCrownPosition = PickerService.CrownPositionItems().OrderBy(c => c.NAME).ToList(); ListCrownClass = PickerService.CrownClassItems().OrderBy(c => c.NAME).ToList(); ListStemQuality = PickerService.StemQualityItems().OrderBy(c => c.NAME).ToList(); CommentsCommand = new Command(async() => await ShowComments()); StemMapCommand = new Command(async() => await ShowStemMap()); DeformityCommand = new Command(async() => await ShowDeformity()); AgeCommand = new Command(async() => await ShowAge()); OnAppearingCommand = new Command(() => OnAppearing()); OnDisappearingCommand = new Command(() => OnDisappearing()); // DoDefaults _tree.HEIGHTTODBH = 1.3F; _tree.DBHIN = "Y"; _tree.CROWNIN = "Y"; _tree.BARKRETENTIONCODE = 1; _tree.WOODCONDITIONCODE = 1; if (util.UseDefaultOrigin) { _tree.TREEORIGINCODE = util.DefaultOrigin; } if (util.UseDefaultStatus) { _tree.TREESTATUSCODE = util.DefaultStatus; } if (util.UseDefaultVSNStatus) { _tree.VSNSTATUSCODE = util.DefaultVSNStatus; } if (util.UseDefaultSpecies) { _tree.SPECIESCODE = util.DefaultSpecies; } _tree.HEIGHTTODEADTIP = 999; _tree.DIRECTHEIGHTTOCONTLIVECROWN = 0; _tree.OCULARHEIGHTTOCONTLIVECROWN = 999; if (util.AllowAutoNumber) { _tree.TREENUMBER = _treeRepository.GetNextNumber(fk); } }
public TreeController(TreeRepository treeRepo, IMapper mapper) { _treeRepo = treeRepo; _mapper = mapper; }
async Task <TreeID> TestPersistTree() { // Create a Blob: Blob bl = new Blob.Builder(Encoding.UTF8.GetBytes("Sample README content.")); ImmutableContainer <BlobID, Blob> blobs = new ImmutableContainer <BlobID, Blob>(b => b.ID, bl); // Create a Tree: Tree trPersists = new Tree.Builder( new List <TreeTreeReference>(0), new List <TreeBlobReference> { new TreeBlobReference.Builder("HelloWorld.cs", bl.ID), new TreeBlobReference.Builder("PersistBlob.cs", bl.ID), new TreeBlobReference.Builder("PersistTree.cs", bl.ID), } ); Tree trSrc = new Tree.Builder( new List <TreeTreeReference> { new TreeTreeReference.Builder("Persists", trPersists.ID), }, new List <TreeBlobReference> { new TreeBlobReference.Builder("blah", bl.ID), } ); Tree trData = new Tree.Builder( new List <TreeTreeReference>(0), new List <TreeBlobReference> { new TreeBlobReference.Builder("myTest.xml", bl.ID), new TreeBlobReference.Builder("myTest2.xml", bl.ID), new TreeBlobReference.Builder("myTest3.xml", bl.ID), } ); Tree trRoot = new Tree.Builder( new List <TreeTreeReference> { new TreeTreeReference.Builder("src", trSrc.ID), new TreeTreeReference.Builder("data", trData.ID), }, new List <TreeBlobReference> { new TreeBlobReference.Builder("README", bl.ID), new TreeBlobReference.Builder("main.xml", bl.ID), new TreeBlobReference.Builder("test.xml", bl.ID), } ); ImmutableContainer <TreeID, Tree> trees = new ImmutableContainer <TreeID, Tree>(tr => tr.ID, trRoot, trSrc, trData, trPersists); var db = getDataContext(); IBlobRepository blrepo = new BlobRepository(db); ITreeRepository trrepo = new TreeRepository(db); // Persist the tree and its blobs: await blrepo.PersistBlobs(blobs); var ptr = await trrepo.PersistTree(trRoot.ID, trees); // Make sure we got back what's expected of the API: Debug.Assert(trRoot.ID == ptr.ID); Console.WriteLine("Root TreeID = {0}", trRoot.ID); return(trRoot.ID); }