Example #1
0
        public async Task UpdateOrganization_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOrganization = new NodeDto
            {
                Id         = 1,
                Name       = "newOrganization1",
                Type       = "Home",
                Properties = new NodePropertiesDto
                {
                    Code              = "3548",
                    OrganizationType  = OrganizationType.LimitedLiabilityCompany,
                    OrganizationOwner = "Mr. Bin"
                },
                ParentId = 0
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOrganization);

            var expectResult = new ServiceResult($"Not found such type as: {newOrganization.Type}");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #2
0
        public async Task CreateOrganization_IsSuccessful()
        {
            _treeService = GetTreeService();

            var newOrganization = new NodeDto
            {
                Id         = 1,
                Name       = "Organization1",
                Type       = "Organization",
                Properties = new NodePropertiesDto
                {
                    Code              = "1234",
                    OrganizationType  = OrganizationType.LimitedLiabilityCompany,
                    OrganizationOwner = "Mr. Bin"
                },
                ParentId = 0
            };

            var result = await _treeService.CreateNodeAsync(newOrganization);

            var actualOrganization = (await _treeService.GetTreeAsync())[0];

            Assert.True(result.Succeeded);
            Assert.Equal(newOrganization.Id, actualOrganization.Id);
            Assert.Equal(newOrganization.Name, actualOrganization.Name);
            Assert.Equal(newOrganization.ParentId, actualOrganization.ParentId);
            Assert.Equal(newOrganization.Type, actualOrganization.Type);
            Assert.Equal(newOrganization.Properties.Code, actualOrganization.Properties.Code);
            Assert.Equal(newOrganization.Properties.OrganizationType, actualOrganization.Properties.OrganizationType);
            Assert.Equal(newOrganization.Properties.OrganizationOwner, actualOrganization.Properties.OrganizationOwner);
        }
Example #3
0
        public async Task DeleteNode_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var nodeToDelete = new NodeDto
            {
                Id   = 1,
                Type = "Home"
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.DeleteNodeAsync(nodeToDelete);

            var expectResult = new ServiceResult($"Not found such type as: {nodeToDelete.Type}");

            var actualTree = await _treeService.GetTreeAsync();

            Assert.Equal(12, actualTree.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #4
0
        public async Task DeleteBusiness_IsSuccessful()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var businessToDelete = new NodeDto
            {
                Id   = 1,
                Type = "Business"
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var result = await _treeService.DeleteNodeAsync(businessToDelete);

            var actualTree = await _treeService.GetTreeAsync();

            Assert.True(result.Succeeded);
            Assert.Equal(5, actualTree.Count);
        }
Example #5
0
        public async Task CreateDepartment_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newDepartment = new NodeDto
            {
                Id       = 2,
                Name     = "Service",
                Type     = "Home",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newDepartment);

            var expectResult = new ServiceResult($"Not found such type as: {newDepartment.Type}");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #6
0
        public async Task UpdateOffering_OfferingAlreadyExist_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOffering = new NodeDto
            {
                Id       = 1,
                Name     = "Multfilms",
                Type     = "Offering",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOffering);

            var expectResult = new ServiceResult($"Offering with name: {newOffering.Name} - already exist.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
        private static ICommand CreateOpenCasePathCommand(ITreeService treeService)
        {
            if (treeService == null)
            {
                throw new ArgumentNullException(nameof(treeService));
            }
            var comm = CommandFactory.CreateDelegateCommand(() => {
                if (!CheckCaseUnitSelected(treeService))
                {
                    return;
                }

                var slUnit = treeService.SelectedUnit;
                if (slUnit == null)
                {
                    return;
                }

                var cs = slUnit.GetInstance <ICase>(Contracts.Casing.Constants.TreeUnitTag_Case);
                if (cs == null)
                {
                    return;
                }

                try {
                    var direct = Path.GetFullPath(cs.Path);
                    Process.Start("explorer.exe", direct);
                }
                catch (Exception ex) {
                    LoggerService.WriteException(ex);
                }
            });

            return(comm);
        }
Example #8
0
        public async Task UpdateBusiness_BusinessNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newBusiness = new NodeDto
            {
                Id       = 0,
                Name     = "Internet",
                Type     = "Business",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newBusiness);

            var expectResult = new ServiceResult($"Business with id: {newBusiness.Id} - not found.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #9
0
        public async Task CreateFamily_BusinessNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newFamily = new NodeDto
            {
                Id       = 2,
                Name     = "Fast food",
                Type     = "Family",
                ParentId = 2
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newFamily);

            var expectResult = new ServiceResult($"Business with id: {newFamily.ParentId} - not found.");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #10
0
        public async Task CreateCountry_OrganizationNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newCountry = new NodeDto
            {
                Id         = 2,
                Name       = "Canada",
                Type       = "Country",
                Properties = new NodePropertiesDto
                {
                    Code = "1234"
                },
                ParentId = 2
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newCountry);

            var expectResult = new ServiceResult($"Organization with id: {newCountry.ParentId} - not found.");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #11
0
        public async Task CreateDepartment_OfferingNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newDepartment = new NodeDto
            {
                Id       = 2,
                Name     = "Service",
                Type     = "Department",
                ParentId = 2
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newDepartment);

            var expectResult = new ServiceResult($"Offering with id: {newDepartment.ParentId} - not found.");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #12
0
 public MeetingService(IMeetingQueries meetingQueries, IMeetingCommands meetingCommands, ITreeService treeService, IMapper mapper)
 {
     this.MeetingQueries = meetingQueries;
     this.TreeService    = treeService;
     this.MeetingCommand = meetingCommands;
     this.Mapper         = mapper;
 }
Example #13
0
 public Endpoint1(IAssociateService associateService, IRequestParsingService requestParsing, ILoggingService logger, ITreeService treeService)
 {
     _associateService = associateService;
     _requestParsing   = requestParsing;
     _logger           = logger;
     _treeService      = treeService;
 }
Example #14
0
        public async Task UpdateOffering_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOffering = new NodeDto
            {
                Id       = 1,
                Name     = "Pizza",
                Type     = "Home",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOffering);

            var expectResult = new ServiceResult($"Not found such type as: {newOffering.Type}");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #15
0
        private Dictionary <string, SearchableApplicationTree> CreateDictionary(ITreeService treeService)
        {
            var appTrees = treeService.GetAll()
                           .OrderBy(x => x.SortOrder)
                           .ToArray();
            var dictionary      = new Dictionary <string, SearchableApplicationTree>(StringComparer.OrdinalIgnoreCase);
            var searchableTrees = this.ToArray();

            foreach (var appTree in appTrees)
            {
                var found = searchableTrees.FirstOrDefault(x => x.TreeAlias.InvariantEquals(appTree.TreeAlias));
                if (found != null)
                {
                    var searchableTreeAttribute = found.GetType().GetCustomAttribute <SearchableTreeAttribute>(false);
                    dictionary[found.TreeAlias] = new SearchableApplicationTree(
                        appTree.SectionAlias,
                        appTree.TreeAlias,
                        searchableTreeAttribute?.SortOrder ?? SearchableTreeAttribute.DefaultSortOrder,
                        searchableTreeAttribute?.ServiceName ?? string.Empty,
                        searchableTreeAttribute?.MethodName ?? string.Empty,
                        found
                        );
                }
            }
            return(dictionary);
        }
Example #16
0
        public async Task UpdateOrganization_OrganizationNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOrganization = new NodeDto
            {
                Id         = 0,
                Name       = "newOrganization1",
                Type       = "Organization",
                Properties = new NodePropertiesDto
                {
                    Code              = "1234",
                    OrganizationType  = OrganizationType.GeneralPartnership,
                    OrganizationOwner = "Mr. Lu"
                },
                ParentId = 0
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOrganization);

            var expectResult = new ServiceResult($"Organization with id: {newOrganization.Id} - not found.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #17
0
        public async Task CreateDepartment_DepartmentAlreadyExist_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newDepartment = new NodeDto
            {
                Id       = 2,
                Name     = "Kitchen",
                Type     = "Department",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newDepartment);

            var expectResult = new ServiceResult($"Department with name: {newDepartment.Name} - already exist.");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #18
0
        public async Task UpdateOffering_OfferingNotFound_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOffering = new NodeDto
            {
                Id       = 0,
                Name     = "Pizza",
                Type     = "Offering",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOffering);

            var expectResult = new ServiceResult($"Offering with id: {newOffering.Id} - not found.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #19
0
        public async Task CreateCountry_CountryAlreadyExist_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newCountry = new NodeDto
            {
                Id         = 2,
                Name       = "USA",
                Type       = "Country",
                Properties = new NodePropertiesDto
                {
                    Code = "1111"
                },
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.CreateNodeAsync(newCountry);

            var expectResult = new ServiceResult($"Country with code: {newCountry.Properties.Code} - already exist.");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(6, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #20
0
        public async Task UpdateFamily_FamilyAlreadyExist_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newFamily = new NodeDto
            {
                Id       = 1,
                Name     = "Cinema",
                Type     = "Family",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newFamily);

            var expectResult = new ServiceResult($"Family with name: {newFamily.Name} - already exist.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #21
0
        public async Task UpdateCountry_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newCountry = new NodeDto
            {
                Id         = 1,
                Name       = "Canada",
                Type       = "Home",
                Properties = new NodePropertiesDto
                {
                    Code = "1234"
                },
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newCountry);

            var expectResult = new ServiceResult($"Not found such type as: {newCountry.Type}");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #22
0
        public async Task CreateOrganization_WrongNodeType_IsFailed()
        {
            _treeService = GetTreeService();

            var newOrganization = new NodeDto
            {
                Id         = 1,
                Name       = "Organization1",
                Type       = "Home",
                Properties = new NodePropertiesDto
                {
                    Code              = "1234",
                    OrganizationType  = OrganizationType.LimitedLiabilityCompany,
                    OrganizationOwner = "Mr. Bin"
                },
                ParentId = 0
            };

            var actualResult = await _treeService.CreateNodeAsync(newOrganization);

            var expectResult = new ServiceResult($"Not found such type as: {newOrganization.Type}");

            var actualListOfNodes = await _treeService.GetTreeAsync();

            Assert.Equal(0, actualListOfNodes.Count);
            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #23
0
        public async Task UpdateOrganization_OrganizationAlreadyExist_IsFailed()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOrganization = new NodeDto
            {
                Id         = 1,
                Name       = "Organization2",
                Type       = "Organization",
                Properties = new NodePropertiesDto
                {
                    Code              = "5678",
                    OrganizationType  = OrganizationType.GeneralPartnership,
                    OrganizationOwner = "Mr. Paul"
                },
                ParentId = 0
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var actualResult = await _treeService.UpdateNodeAsync(newOrganization);

            var expectResult = new ServiceResult($"Organization with code: {newOrganization.Properties.Code} - already exist.");

            Assert.Equal(expectResult.Succeeded, actualResult.Succeeded);
            Assert.Equal(expectResult.Error, actualResult.Error);
        }
Example #24
0
        public async Task CreateDepartment_IsSuccessful()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newDepartment = new NodeDto
            {
                Id       = 2,
                Name     = "Service",
                Type     = "Department",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var result = await _treeService.CreateNodeAsync(newDepartment);

            var actualDepartment = (await _treeService.GetTreeAsync())[6];

            Assert.True(result.Succeeded);
            Assert.Equal(newDepartment.Id, actualDepartment.Id);
            Assert.Equal(newDepartment.Name, actualDepartment.Name);
            Assert.Equal(newDepartment.ParentId, actualDepartment.ParentId);
            Assert.Equal(newDepartment.Type, actualDepartment.Type);
        }
Example #25
0
        public async Task CreateOffering_IsSuccessful()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newOffering = new NodeDto
            {
                Id       = 2,
                Name     = "Pizza",
                Type     = "Offering",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var result = await _treeService.CreateNodeAsync(newOffering);

            var actualOffering = (await _treeService.GetTreeAsync())[5];

            Assert.True(result.Succeeded);
            Assert.Equal(newOffering.Id, actualOffering.Id);
            Assert.Equal(newOffering.Name, actualOffering.Name);
            Assert.Equal(newOffering.ParentId, actualOffering.ParentId);
            Assert.Equal(newOffering.Type, actualOffering.Type);
        }
Example #26
0
        public async Task CreateFamily_IsSuccessful()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newFamily = new NodeDto
            {
                Id       = 2,
                Name     = "Fast food",
                Type     = "Family",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var result = await _treeService.CreateNodeAsync(newFamily);

            var actualFamily = (await _treeService.GetTreeAsync())[4];

            Assert.True(result.Succeeded);
            Assert.Equal(newFamily.Id, actualFamily.Id);
            Assert.Equal(newFamily.Name, actualFamily.Name);
            Assert.Equal(newFamily.ParentId, actualFamily.ParentId);
            Assert.Equal(newFamily.Type, actualFamily.Type);
        }
Example #27
0
        public async Task CreateBusiness_IsSuccessful()
        {
            _treeService = GetTreeService();

            var dataToSetupDB = GetNodes();

            var newBusiness = new NodeDto
            {
                Id       = 2,
                Name     = "Internet",
                Type     = "Business",
                ParentId = 1
            };

            foreach (var node in dataToSetupDB)
            {
                var dbSetupResult = await _treeService.CreateNodeAsync(node);

                Assert.True(dbSetupResult.Succeeded);
            }

            var result = await _treeService.CreateNodeAsync(newBusiness);

            var actualBusiness = (await _treeService.GetTreeAsync())[3];

            Assert.True(result.Succeeded);
            Assert.Equal(newBusiness.Id, actualBusiness.Id);
            Assert.Equal(newBusiness.Name, actualBusiness.Name);
            Assert.Equal(newBusiness.ParentId, actualBusiness.ParentId);
            Assert.Equal(newBusiness.Type, actualBusiness.Type);
        }
 public ApplicationTreeController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor,
                                  ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger,
                                  IRuntimeState runtimeState, ITreeService treeService, ISectionService sectionService, UmbracoHelper umbracoHelper)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
     _treeService    = treeService;
     _sectionService = sectionService;
 }
Example #29
0
        public TreesActor(ITreeService treeService)
        {
            _treeService = treeService;
            // _treeService.NamePropertyConflicted += NamePropertyConflicted;
            nameConflictSubscribes = new HashSet <IActorRef>();

            Receive <SubscribeNameConflict>(message => HandleSubscribeNameConflict(message));
        }
Example #30
0
 public EntityController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState,
                         ITreeService treeService, UmbracoHelper umbracoHelper, SearchableTreeCollection searchableTreeCollection, UmbracoTreeSearcher treeSearcher)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
     _treeService = treeService;
     _searchableTreeCollection = searchableTreeCollection;
     _treeSearcher             = treeSearcher;
 }
 public IndividualController()
 {
     var cache = Util.CreateCacheProvider();
     var unitOfWork = Util.CreateUnitOfWork(cache);
     var serviceFactory = new FamilyTreeServiceFactory(unitOfWork, cache);
     _factService = serviceFactory.CreateFactService();
     _familyService = serviceFactory.CreateFamilyService();
     _individualService = serviceFactory.CreateIndividualService();
     _treeService = serviceFactory.CreateTreeService();
 }
 /// <summary>
 /// Construct the proxy object and open it if necessary.
 /// </summary>
 private ServiceProxyHolder()
 {
     if (null == _proxy)
     {
         if (BeforeCallBegin != null)
             BeforeCallBegin(this, new EventArgs());
         // Create a new proxy
         _proxy = ChannelFactory.CreateChannel();
         var channel = (IClientChannel)_proxy;
         channel.Open();
         _mustClose = true;
     }
     else
         _mustClose = false;
 }
        public FamilyTreeServiceFactory(IUnitOfWork unitOfWork, ICacheProvider cache)
        {
            Requires.NotNull(unitOfWork);
            Requires.NotNull(cache);

            _citationService = new CitationService(unitOfWork);
            _familyService = new FamilyService(unitOfWork);
            _individualService = new IndividualService(unitOfWork);
            _factService = new FactService(unitOfWork);
            _multimediaService = new MultimediaLinkService(unitOfWork);
            _noteService = new NoteService(unitOfWork);
            _repositoryService = new RepositoryService(unitOfWork);
            _sourceService = new SourceService(unitOfWork);
            _treeService = new TreeService(unitOfWork);
        }
 public TreeViewModel()
 {
     this.treeService = CurrentContext.CurrentTreeService;
     treeService.LoadRootNodes();
 }
 public TreeNodeViewModel(TreeNode currentNode, ITreeService treeService)
 {
     // TODO: Complete member initialization
     this.currentNode = currentNode;
     this.treeService = treeService;
 }
Example #36
0
        /// <summary>
        /// This method can initialize the ITreeService parameters for this class with another ITreeService object.
        /// This method could be used for Dependency Injection.
        /// </summary>
        /// <param name="treeParams"></param>
        public void SetTreeParameters(ITreeService treeParams)
        {
            this.DialogMode = treeParams.DialogMode;
            this.NodeKey = treeParams.NodeKey;
            this.FunctionToCall = treeParams.FunctionToCall;
            this.IsDialog = treeParams.IsDialog;
            this.ShowContextMenu = treeParams.ShowContextMenu;
            this.id = treeParams.StartNodeID;

            if (!treeParams.ShowContextMenu)
                this.RootNode.Menu = null;
        }
        /// <summary>
        /// Ensure that the service proxy is closed if necessary
        /// </summary>
        public void Dispose()
        {
            if (_mustClose)
            {
                if (BeforeCallComplete != null)
                    BeforeCallComplete(this, new EventArgs());
                ITreeService temp = _proxy;
                _proxy = null;

                IClientChannel channel = temp as IClientChannel;
                if (null != channel)
                    CloseChannel(channel);
            }
        }
 public void CompleteCall(ITreeService endPoint)
 {
     if (BeforeCallComplete != null)
         BeforeCallComplete(this, new EventArgs());
 }
 public TreeViewModel(ITreeService treeService)
 {
     this.treeService = treeService;
     treeService.LoadRootNodes();
 }