private void tsbSave_Click(object sender, EventArgs e) { foreach (TreeNode tn in tvLinkedDocuments.Nodes[0].Nodes) { var nodeType = tn.Tag.GetType().Name; if (nodeType == "DocumentLink") { DocumentSetDocumentLink doc = new DocumentSetDocumentLink(); doc = (DocumentSetDocumentLink)tn.Tag; DocumentSetDocumentLink.LinkDocuments( documentSetUID, SelectedParentDocumentUID, doc.FKChildDocumentUID, cbxLinkType.Text); } if (nodeType == "Document") { Document doc = new Document(); doc = (Document)tn.Tag; DocumentSetDocumentLink.LinkDocuments( documentSetUID, SelectedParentDocumentUID, doc.UID, cbxLinkType.Text); } } MessageBox.Show("Saved successfully."); }
// Remove document from selected list // private void RemoveDocument() { TreeNode tn = new TreeNode(); tn = tvLinkedDocuments.SelectedNode; var nodeType = tn.Tag.GetType().Name; if (nodeType == "Document") { Document doc = new Document(); doc = (Document)tn.Tag; DocumentSetDocumentLink dl = new DocumentSetDocumentLink(); // Logically delete the record if the record is commited. if (dl.Read(documentSetUID, SelectedParentDocumentUID, doc.UID, cbxLinkType.Text)) { dl.Delete(dl.UID); } tn.Remove(); } if (nodeType == "DocumentSetDocumentLink") { var doc = new DocumentSetDocumentLink(); doc = (DocumentSetDocumentLink)tn.Tag; DocumentSetDocumentLink dl = new DocumentSetDocumentLink(); // Logically delete the record if the record is commited. if (dl.Read(documentSetUID, SelectedParentDocumentUID, doc.FKChildDocumentUID, cbxLinkType.Text)) { dl.Delete(dl.UID); } tn.Remove(); } }