public List <DocumentFolderEntity> Get(long parent_Id) { DocumentFolder objDocumentFolder = new DocumentFolder(); List <DocumentFolderEntity> result = objDocumentFolder.GetAllDocumentFolder(parent_Id); return(result); }
/// <summary> /// Reads the pcc.config file for local conditions are locations. /// </summary> /// <param name="configPath">The xml file name to read.</param> private static void LoadConfig() { var doc = new XmlDocument(); doc.Load(FullName); DocumentFolder = GetNode(doc, "DocumentPath"); PrizmApplicationServicesScheme = GetNode(doc, "PrizmApplicationServicesScheme"); PrizmApplicationServicesHost = GetNode(doc, "PrizmApplicationServicesHost"); PrizmApplicationServicesPort = Convert.ToInt32(GetNode(doc, "PrizmApplicationServicesPort")); if (!string.IsNullOrEmpty(DocumentFolder)) { DocumentFolder = InlineEnvVariables(DocumentFolder); if (!(DocumentFolder.EndsWith("\\") || DocumentFolder.EndsWith("/"))) { DocumentFolder += Path.DirectorySeparatorChar; } } if (!(DocumentFolder.EndsWith("\\") || DocumentFolder.EndsWith("/"))) { DocumentFolder += Path.DirectorySeparatorChar; } }
private Dictionary <DocumentFolder, ContainerInfo> GetDocumentFolders( AnalysisSession analysisSession, IEnumerable <ContainerInfo> containerInfos, DocumentFolder parentFolder) { var result = new Dictionary <DocumentFolder, ContainerInfo>(); foreach (var container in containerInfos) { var documentFolder = DbContext.DocumentFolderRepository.SingleOrDefault(f => f.Path == container.Id); if (documentFolder == null) { documentFolder = new DocumentFolder() { Name = container.Name, ParentFolder = parentFolder, Path = container.Id, NavigationProviderId = Id }; DbContext.DocumentFolderRepository.Add(documentFolder); } documentFolder.LatestAnalysisSession = analysisSession; result.Add(documentFolder, container); } return(result); }
/// <summary> ///*** Create Docuemnt Folder inside parent folder /// *** Incase of error it set static variable MsgError with error details /// </summary> /// <param name="FolderName">FolderName</param> /// <param name="strParentFolderGUID">Parent Folder GUID.</param> /// <returns>Folder GUID</returns> public string CreateDocumentFolder(string FolderName, string strParentFolderGUID) { try { //*** Create new entity Instance var objDocumentFolder = new DocumentFolder { Code = FolderName, Description = FolderName }; if (strParentFolderGUID != "") { objDocumentFolder.ParentFolder = Guid.Parse(strParentFolderGUID); } var client = new ExactOnlineClient(_endpoint, GetAccessToken); if (client.For <DocumentFolder>().Insert(ref objDocumentFolder)) { return(objDocumentFolder.ID.ToString()); } else { return(""); } } catch (Exception e) //*** Error { MsgError = e.ToString(); return(""); } }
public DocumentFolder GetDocumentFolder(int id) { using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand command = connection.CreateCommand()) { command.CommandText = selectQuery + "WHERE folder.Id = @Id "; command.Parameters.AddWithValue("@Id", id); connection.Open(); var reader = command.ExecuteReader(); if (reader.HasRows) { if (reader.Read()) { DocumentFolder folder = Read(reader); return(folder); } } } } return(null); }
private async void SearchSavedFolders(string searchString = "") { List <DocumentFolder> lstDocFolders = new List <DocumentFolder>(); string RootFolderExternalStorage = StorageUtilities.GetInstance().GetAppExternalStorageFolderName(); PermissionStatus readPermission = await PermissionUtilities.GetInstance().RequestExtrenalStorageReadPermission(); if (Directory.Exists(RootFolderExternalStorage) && readPermission == PermissionStatus.Granted) { string[] folderNamesList = Directory.GetDirectories(RootFolderExternalStorage); foreach (string folderName in folderNamesList) { DocumentFolder docFolder = new DocumentFolder(); DirectoryInfo dir = new DirectoryInfo(folderName); docFolder.FolderName = dir.Name; docFolder.FolderPath = dir.FullName; lstDocFolders.Add(docFolder); } //--For Search: lstDocFolders = lstDocFolders.FindAll(d => d.FolderName.ToLower().Contains(searchString.ToLower())); _lstFolders = new ObservableCollection <DocumentFolder>(lstDocFolders); lstFolders.ItemsSource = _lstFolders; lstFolders.SelectedItem = null; } }
public async Task <ObjectId> CreateFolder(ObjectId userID, ObjectId parentFolderID, string folderName) { try { ObjectId newFolderID = ObjectId.GenerateNewId(); DocumentFolder documentFolder = new DocumentFolder() { ID = newFolderID, CreationDate = DateTime.Now, UserID = userID, ParentFolderID = parentFolderID, FolderName = folderName, IsDeleted = false, LastUpdateDate = DateTime.Now }; await database.Connect().ConfigureAwait(false); await database.Insert(documentFolder).ConfigureAwait(false); return(newFolderID); } catch (Exception ex) { exceptionLogger.Log(new ApplicationError(ex), LogLevel.Error, logConfiguration); throw new DatabaseException("The error occured while creating new folder"); } }
private List <DocumentFolder> GetDocumentFolders(AnalysisSession analysisSession, IEnumerable <string> folderPaths, DocumentFolder parentFolder) { var result = new List <DocumentFolder>(); foreach (var folder in folderPaths) { var documentFolder = DbContext.DocumentFolderRepository.SingleOrDefault(f => f.Path == folder); if (documentFolder == null) { documentFolder = new DocumentFolder() { Name = Path.GetFileName(folder), ParentFolder = parentFolder, Path = folder, NavigationProviderId = Id }; DbContext.DocumentFolderRepository.Add(documentFolder); } documentFolder.LatestAnalysisSession = analysisSession; result.Add(documentFolder); } return(result); }
public async Task RenameFolder(ObjectId folderID, string newFolderName) { try { await database.Connect().ConfigureAwait(false); var getFilter = new EqualityFilter <ObjectId>(typeof(DocumentFolder).GetBsonPropertyName("ID"), folderID); DocumentFolder documentFolder = (await database.Get(getFilter).ConfigureAwait(false)).FirstOrDefault(); if (documentFolder == null) { throw new ArgumentException(); } documentFolder.FolderName = newFolderName; await database.Update(documentFolder).ConfigureAwait(false); } catch (Exception ex) when(ex.GetType() != typeof(ArgumentException)) { exceptionLogger.Log(new ApplicationError(ex), LogLevel.Error, logConfiguration); throw new DatabaseException("The error occured while renaming the folder"); } }
protected async Task <Document> GetOrCreateDocument() { var navProvider = await this.DbContext.NavigationProvidersInfo.FirstOrDefaultAsync(); if (navProvider == null) { navProvider = new NavigationProviderInfo() { Name = "Test", Type = NavigationProviderType.File, ParametersRaw = "test" }; this.DbContext.NavigationProvidersInfo.Add(navProvider); await this.DbContext.SaveChangesAsync(); } var document = await this.DbContext.DocumentRepository.FirstOrDefaultAsync(); if (document == null) { var folder = new DocumentFolder() { Name = "Temp", Path = "Test", NavigationProviderId = navProvider.Id }; document = new Document() { Name = "Temp", Path = "Test", Folder = folder }; this.DbContext.DocumentRepository.Add(document); await this.DbContext.SaveChangesAsync(); } return(document); }
//获取文件夹 public DocumentFolder GetFolder(int folderId) { IBaseEntity folder = new DocumentFolder(); SqlHelper.GetSingleEntity(folderId, ref folder, true, false); return(folder as DocumentFolder); }
public void ExportLinks(string space, string protocol, string qvsCluster, string qvwsMachine, string category, string csvFileName) { protocol = string.IsNullOrEmpty(protocol) ? "http" : protocol; links = new List <string>(); try { if (client != null) { ServiceInfo qvs = FindService(client, ServiceTypes.QlikViewServer, qvsCluster.Trim()); if (qvs == null) { commSupport.PrintMessage("Could not find QlikView Server", true); } ServiceInfo qvwsService = FindService(client, ServiceTypes.QlikViewWebServer, qvwsMachine.Trim()); if (qvwsService == null) { commSupport.PrintMessage("Could not find Qvws", true); } string qvwsUrl = qvwsService.Address.Scheme + "://" + qvwsService.Address.Host; links.Add("Name" + delimiter + "URL" + delimiter + "Description" + delimiter + "Space" + delimiter + "Type" + delimiter + "DateCreated"); client.ClearQVSCache(QVSCacheObjects.UserDocumentList); List <DocumentNode> userDocs = client.GetUserDocuments(qvs.ID); List <DocumentFolder> userDocFolders = client.GetUserDocumentFolders(qvs.ID, DocumentFolderScope.All); bool filterForCategories = !string.IsNullOrEmpty(category); foreach (DocumentNode userDoc in userDocs) { DocumentFolder docFolder = userDocFolders.FirstOrDefault(x => x.ID.Equals(userDoc.FolderID)); string mountName = string.Empty; if (docFolder != null) { mountName = docFolder.General.Path.ToLower(); } if (filterForCategories) { DocumentMetaData dmd = client.GetDocumentMetaData(userDoc, DocumentMetaDataScope.All); if (dmd.DocumentInfo.Category.ToLower().Equals(category.ToLower())) { ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, ""); } } else { ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, ""); } } WriteToCSVFile(csvFileName); } else { commSupport.PrintMessage("Could not create connection to QMS", true); } } catch (Exception e) { commSupport.PrintMessage("Exception when exporting links, run help command for information about usage: Exeception:" + e.Message, true); } }
public List <DocumentFolderEntity> GetAddressBarURL(long folder_Id) { DocumentFolder objDocumentFolder = new DocumentFolder(); List <DocumentFolderEntity> result = objDocumentFolder.GetAddressBarURL(folder_Id); return(result); }
private void RefreshData() { Customers = DBHelper.Instance.GetCustomers(); AllFolderNames = DocumentFolder.GetAllFolderNames(); FileTypes = LookupItem.GetLookupStrings(LookupItem.LookupTypesEnum.FileType); FileTypes.Insert(0, string.Empty); DocumentTypes = LookupItem.GetLookupStrings(LookupItem.LookupTypesEnum.DocumentType); DocumentTypes.Insert(0, string.Empty); }
//创建文件夹 public int CreateFolder(DocumentFolder folder) { if (folder == null || folder.ParentId < 0 || string.IsNullOrEmpty(folder.Name)) { return(-1); } folder.CreateTime = DateTime.Now; SqlHelper.Insert(folder); return(folder.Identity); }
public static List <DocumentFolder> ConvertToDocumentFolderList(this IEnumerable <DocumentFolderViewModel> documentFolderViewModels) { List <DocumentFolder> documentFolders = new List <DocumentFolder>(); foreach (DocumentFolderViewModel DocumentFolder in documentFolderViewModels) { documentFolders.Add(DocumentFolder.ConvertToDocumentFolder()); } return(documentFolders); }
public static List <DocumentFolderViewModel> ConvertToDocumentFolderViewModelList(this IEnumerable <DocumentFolder> DocumentFolders) { List <DocumentFolderViewModel> DocumentFolderViewModels = new List <DocumentFolderViewModel>(); foreach (DocumentFolder DocumentFolder in DocumentFolders) { DocumentFolderViewModels.Add(DocumentFolder.ConvertToDocumentFolderViewModel()); } return(DocumentFolderViewModels); }
public async Task <IActionResult> UpdateFolder(DocumentFolderViewModel documentFolder) { var invalidChars = Path.GetInvalidFileNameChars(); string validFolderName = new string(documentFolder.FolderName .Where(x => !invalidChars.Contains(x)) .ToArray()); string oldValidFolderName = new string(documentFolder.OldFolderName .Where(x => !invalidChars.Contains(x)) .ToArray()); if (ModelState.IsValid) { try { //string root = _hostingEnv.WebRootPath + "\\UploadFiles\\"; string root = _networkDocPath; string oldPath = root + await _unitOfWork.Documents.GetCurrentPath(documentFolder.ParentFolderId) + "\\" + oldValidFolderName; string newPath = root + await _unitOfWork.Documents.GetCurrentPath(documentFolder.ParentFolderId) + "\\" + validFolderName; if (Directory.Exists(oldPath)) { Directory.Move(oldPath, newPath); //rename folder } else { Directory.CreateDirectory(newPath); } DocumentFolder updatedFolder = new DocumentFolder { Name = documentFolder.FolderName.TrimEnd(), ParentFolderId = documentFolder.ParentFolderId, CreateUserId = _userSession.Id, ModifiedDateTime = DateTime.Now, CreateDate = DateTime.Now, FolderId = Convert.ToInt32(documentFolder.FolderId), FolderStatusId = documentFolder.FolderStatusId }; _unitOfWork.Documents.UpdateFolder(updatedFolder); await _unitOfWork.CompleteAsync(); return(Redirect(Request.Headers["Referer"].ToString())); } catch (Exception ex) { throw ex; } } return(View(documentFolder)); }
/// <summary> /// 更新文件 /// </summary> /// <param name="folderModel"></param> /// <returns></returns> public CommonResult Update(DocumentFolder DocumentFolderModel) { db.DocumentFolder.Where(documentFolder => documentFolder.UID == DocumentFolderModel.UID).Update(u => DocumentFolderModel); if (db.SaveChanges() < 0) { return(CommonResult.Instance("新建失败")); } Log4NetHelper.Info("更新关联文件记录", DocumentFolderModel.ToJson()); //AllServices.ActionLogService.AddLog("更新项目信息",model.ToJson(),Enums.ActionCategory.Update); return(CommonResult.Instance()); }
private void RefreshFolderTree() { if (SelectedCustomer != null) { DocumentFolders = DocumentFolder.GetCustomerDocumentFolders(SelectedCustomer.ID, ShowHiddenFolders); } else { DocumentFolders = null; } }
private IEnumerable <Document> GetHierarchyDocuments( AnalysisSession analysisSession, IEnumerable <ContainerInfo> containerInfos, DocumentFolder parentFolder, bool newOnly) { if (newOnly) { throw new NotSupportedException($"{nameof(newOnly)} is for WebNavigationProvider only"); } var result = new List <Document>(); var documentFolders = GetDocumentFolders(analysisSession, containerInfos, parentFolder); foreach (var dFolderKVP in documentFolders) { foreach (var pageInfo in dFolderKVP.Value.Pages) { var document = DbContext.DocumentRepository.SingleOrDefault(d => d.Path == pageInfo.Id); if (document == null) { document = new Document() { Folder = dFolderKVP.Key, Name = pageInfo.Name, Path = pageInfo.Id, LastModifiedTime = pageInfo.LastModifiedTime, }; DbContext.DocumentRepository.Add(document); analysisSession.CreatedDocumentsCount++; } else { if (document.LastModifiedTime != pageInfo.LastModifiedTime) { document.LastModifiedTime = pageInfo.LastModifiedTime; analysisSession.UpdatedDocumentsCount++; } } document.LatestAnalysisSession = analysisSession; if (!newOnly || document.Id <= 0) // По непонятным причинам EF Core для нового файла выставляет Id = -2147482647 { result.Add(document); } } result.AddRange(GetHierarchyDocuments(analysisSession, dFolderKVP.Value.ChildrenContainers, dFolderKVP.Key, newOnly)); } return(result); }
private async void lstFolders_ItemSelected(object sender, SelectedItemChangedEventArgs e) { DocumentFolder selectedFolder = e.SelectedItem as DocumentFolder; GC.Collect(); if (selectedFolder != null) { await Navigation.PushAsync(new FolderDetails(selectedFolder.FolderPath)); lstFolders.SelectedItem = null; } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if (folderCache == null) { return; } DocumentFolder folder = null; if (FolderName != null) { folder = folderCache.Get(FolderName) as DocumentFolder; } FolderName = txtFolder.Text; if (_validateFolderName && Utilities.Utility.HasSpecialCharacters(FolderName)) { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("Invalid"), Uniconta.ClientTools.Localization.lookup("Error")); return; } ErrorCodes result = ErrorCodes.NoSucces; switch (Action) { case 0: var folderClient = new DocumentFolderClient(); folderClient._Name = FolderName; result = api.Insert(folderClient).GetAwaiter().GetResult(); break; case 1: if (folder != null) { folder._Name = FolderName; result = api.Update(folder).GetAwaiter().GetResult(); } break; case 2: if (folder != null) { result = api.Delete(folder).GetAwaiter().GetResult(); } break; } if (result != ErrorCodes.Succes) { Uniconta.ClientTools.Util.UtilDisplay.ShowErrorCode(result); } this.DialogResult = true; }
public string UpdateDocumentFolder(long Id, string Name, long Status_Id, long Parent_Id) { DocumentFolder objDocumentFolder = new DocumentFolder(); DocumentFolderEntity objData = new DocumentFolderEntity(); objData.Id = Id; objData.Name = Name; objData.Status_Id = Status_Id; objData.Parent_Id = Parent_Id; string result = objDocumentFolder.updateDocumentFolder(objData); return(result); }
//返回上级菜单 public List <FileSystemEntity> BackToParentFolder(int folderId, int userId) { IBaseEntity entity = new DocumentFolder(); SqlHelper.GetSingleEntity(folderId, ref entity); var folder = entity as DocumentFolder; if (folder != null && folder.FolderId == folderId && !string.IsNullOrEmpty(folder.Name)) { return(GetFileSystemEntityByFolder(folder.ParentId, userId).Where(o => o.OrgId == folder.OrganizationId).ToList()); } return(null); }
public async Task Update(DocumentFolder folder) { try { await database.Connect().ConfigureAwait(false); await database.Update(folder); } catch (Exception ex) { exceptionLogger.Log(new ApplicationError(ex), LogLevel.Error, logConfiguration); throw new DatabaseException("The error happened while updating the folder"); } }
public async Task <IActionResult> Create(DocumentFolderViewModel documentFolder) { var invalidChars = Path.GetInvalidFileNameChars(); if (ModelState.IsValid) { string validFolderName = new string(documentFolder.FolderName .Where(x => !invalidChars.Contains(x)) .ToArray()); try { string path = _networkDocPath + (await _unitOfWork.Documents.GetCurrentPath(documentFolder.ParentFolderId) + @"\" + validFolderName); //string path = _hostingEnv.WebRootPath + "\\UploadFiles\\" + // await _unitOfWork.Documents.GetCurrentPath(documentFolder.ParentFolderId) + // "\\" + validFolderName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DocumentFolder newFolder = new DocumentFolder(); newFolder.Name = documentFolder.FolderName.TrimEnd(); newFolder.ParentFolderId = documentFolder.ParentFolderId; newFolder.CreateUserId = _userSession.Id; newFolder.ModifiedDateTime = DateTime.Now; newFolder.CreateDate = DateTime.Now; newFolder.FolderStatusId = await _unitOfWork.Documents.GetDocumentStatusIdAsync("Active"); await _unitOfWork.Documents.CreateFolder(newFolder); await _unitOfWork.CompleteAsync(); if (newFolder.ParentFolderId != null) { return(RedirectToAction("Details", "Documents", new { id = newFolder.ParentFolderId })); } else { return(Redirect(Request.Headers["Referer"].ToString())); } } catch (Exception) { throw; } } return(View(documentFolder)); }
public FolderModel(DocumentFolder folder, bool isHierarchical = false) : base(folder) { ColorCode = folder.ColorCode; ParentId = folder.ParentId; ParentIds = folder.ParentIds; ChildIds = folder.ChildIds; if (isHierarchical) { Children = folder.InverseParent .Where(w => w.Status == 1) .Select(s => new FolderModel(s, isHierarchical)) .ToList(); } }
public async Task <IDictionary <int?, string> > GetParentFolders(int?folderId) { var parents = new Dictionary <int?, string>(); while (folderId != null) { DocumentFolder parent = await _context.DocumentFolder .Where(f => f.FolderId == folderId) .SingleOrDefaultAsync(); parents.Add(parent.FolderId, parent.Name); folderId = parent.ParentFolderId; } return(parents); }
private void OnCreateFolderButtonClick(object sender, RoutedEventArgs e) { var orgId = OrganizationTreeView.SelectedValue as String; if (!string.IsNullOrEmpty(orgId)) { var source = FileEntityListBox.ItemsSource as List <FileSystemEntity> ?? new List <FileSystemEntity>(); string strFolderName; while (true) { strFolderName = CustomMessageBox.Prompt("请输入文件夹名称"); if (string.IsNullOrEmpty(strFolderName)) { return; } if (source.Any(o => o.Name == strFolderName && o.Type == FileSystemEntityType.Folder)) { if (CustomMessageBox.Ask("文件夹名重复,是否重新指定?")) { continue; } return; } break; } var folder = new DocumentFolder { FolderId = 0, ParentId = FolderId, Name = strFolderName, CreatedBy = AuthenticateStatus.CurrentUser.UserId, CreateTime = DateTime.Now, OrganizationId = orgId, Status = ActiveStatus.Active }; BusyIndicator1.IsBusy = true; BusyIndicator1.BusyContent = "正在创建文件夹..."; documentContext.CreateFolder(folder, obj => { BusyIndicator1.IsBusy = false; if (Utility.Utility.CheckInvokeOperation(obj)) { OpenFolder(FolderId); } }, null); } }