Ejemplo n.º 1
0
        public void CreateFolderTemplate(string contractGuid, string projectNumber, string resourceType, Guid resourceId, Guid userGuid)
        {
            var structureApplied = _documentManagementService.HasDefaultStructure(resourceType, resourceId);

            if (!structureApplied)
            {
                var masterData = _folderStructureMasterService.GetActive("ESSWeb", resourceType);
                if (masterData.Count() > 0)
                {
                    var templateFolders = _folderStructureFolderService.GetFolderTree(masterData.SingleOrDefault().FolderStructureMasterGuid);
                    _documentManagementService.ManageDefaultStructure(contractGuid, projectNumber, templateFolders, resourceType, resourceId, userGuid);
                }
            }
        }
        private IDocumentEntity GetTemplateFolderTree(Guid masterFolderGuid, string resourceType, Guid resourceId, string pathPrefixName)
        {
            var structureApplied = _documentManagementService.HasDefaultStructure(resourceType, resourceId);
            var contract         = _contractsService.GetContractEntityByContractId(resourceId);

            if (!structureApplied && contract != null)
            {
                var masterData = _folderStructureMasterService.GetActive("ESSWeb", resourceType);
                if (masterData.Count() > 0)
                {
                    var templateFolders = _folderStructureFolderService.GetFolderTree(masterData.SingleOrDefault().FolderStructureMasterGuid);
                    _documentManagementService.ManageDefaultStructure(resourceId.ToString(), contract.ContractNumber, templateFolders, resourceType, resourceId, UserHelper.CurrentUserGuid(HttpContext));
                }
            }
            var folders = _documentManagementService.GetFolderByMasterFolderGuid(masterFolderGuid, resourceType, resourceId);

            return(folders);
        }