// ------------------------------------------------ // Edit Document from Tree. Allow only Documents // ------------------------------------------------ private void EditDocument(object sender, EventArgs e) { if (!string.IsNullOrEmpty(defaultActionDoubleClick)) { if (defaultActionDoubleClick == "Select") { this.btnSelect_Click(sender, e); return; } } // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; var rm = new Document(); if (docSelected == null) { return; } rm = (Document)docSelected.Tag; // Cast // Show Document Screen // UIDocumentEdit uide = new UIDocumentEdit(this, rm, docSelected); uide.ShowDialog(); docSelected.Text = rm.FileName; }
private void EditMetadata() { UIDocumentEdit uide = new UIDocumentEdit(this); if (dgvDocumentList.SelectedRows.Count <= 0) { return; } var selectedRow = dgvDocumentList.SelectedRows; Document rm = new Document(); rm.CUID = selectedRow[0].Cells["CUID"].Value.ToString(); rm.Directory = selectedRow[0].Cells["Directory"].Value.ToString(); rm.LatestIssueLocation = selectedRow[0].Cells["LatestIssueLocation"].Value.ToString(); rm.LatestIssueNumber = selectedRow[0].Cells["LatestIssueNumber"].Value.ToString(); rm.Name = selectedRow[0].Cells["Name"].Value.ToString(); rm.SequenceNumber = selectedRow[0].Cells["SequenceNumber"].Value.ToString(); rm.Subdirectory = selectedRow[0].Cells["Subdirectory"].Value.ToString(); rm.Comments = selectedRow[0].Cells["Comments"].Value.ToString(); uide.SetValues(rm); uide.Show(); }
private void NewDocument_Click(object sender, EventArgs e) { // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; if (docSelected == null) { return; } Document treeSelectedDoco = new Document(); treeSelectedDoco = (Document)docSelected.Tag; // Cast // If current tree selected item is a document // issue an error saying that only folder can hold // an item if (treeSelectedDoco.RecordType.Trim() != FCMConstant.RecordType.FOLDER) { MessageBox.Show("Only folders allow items inside."); return; } // New Document or Folder being added // var document = new Document(); // Set the parent uid as current tree selected // folder // document.ParentUID = treeSelectedDoco.UID; UIDocumentEdit uide = new UIDocumentEdit(this, document, docSelected); uide.ShowDialog(); if (uide.documentSavedSuccessfully) { int im = FCMConstant.Image.Document; if (document.RecordType == FCMConstant.RecordType.FOLDER) { im = FCMConstant.Image.Folder; } var treeNode = new TreeNode(document.Name, im, im); treeNode.Tag = document; treeNode.Name = document.UID.ToString(); docSelected.Nodes.Add(treeNode); } Refresh(); }