// ----------------------------------------------------------- // Delete Document (Logical delete) // ----------------------------------------------------------- private void deleteDocument(HeaderInfo headerInfo) { Document rm = new Document(); // rm.SetToVoid(rm.UID); // RepDocument.SetToVoid(rm.UID); BUSDocument.SetToVoid(rm.UID); loadDocumentList(headerInfo); }
// ---------------------------------------------- // Removing an element from the tree // ---------------------------------------------- private void btnDelete_DragDrop(object sender, DragEventArgs e) { TreeNode tndocSelected = tvFileList.SelectedNode; TreeNode parent = tndocSelected.Parent; tndocSelected.Remove(); // Update database with new sequence numbers // UpdateSequence(parent); // Delete element Document document = new Document(); document = (Document)tndocSelected.Tag; // document.SetToVoid(document.UID); // RepDocument.SetToVoid(document.UID); BUSDocument.SetToVoid(document.UID); tvFileList.SelectedNode = parent; }
/// <summary> /// Delete document selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteDocument_Click(object sender, EventArgs e) { var resp = MessageBox.Show("Are you sure?", "Delete Document", MessageBoxButtons.YesNo); if (resp != DialogResult.Yes) { return; } // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; if (docSelected == null) { return; } if (docSelected.Tag.GetType().Name == "scClientDocSetDocLink") { var rm = new scClientDocSetDocLink(); rm = (scClientDocSetDocLink)docSelected.Tag; // Cast try { // rm.document.Delete( rm.document.UID ); // RepDocument.Delete(rm.document.UID); BUSDocument.DeleteDocument(rm.document.UID); } catch { // Using Logical Deletion // rm.document.SetToVoid( rm.document.UID ); // RepDocument.SetToVoid(rm.document.UID); BUSDocument.SetToVoid(rm.document.UID); } } if (docSelected.Tag.GetType().Name == "Document") { var rm = new Document(); rm = (Document)docSelected.Tag; // Cast try { // rm.Delete( rm.UID ); // RepDocument.Delete(rm.UID); BUSDocument.DeleteDocument(rm.UID); } catch { // rm.SetToVoid( rm.UID ); // RepDocument.SetToVoid(rm.UID); BUSDocument.SetToVoid(rm.UID); } } // Physically delete items // Remove item docSelected.Remove(); }