Compare commits
	
		
			6 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fb2aeb8192 | |||
| 24c25ab26c | |||
| 9da91e460f | |||
| 2634cf7de9 | |||
| 7417091f3f | |||
| f9aad50f46 | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -24288,8 +24288,23 @@ BEGIN
 | 
				
			|||||||
		Delete from ROFSTs where ROFSTID not in(select rofstid from Associations) and DTS < @dte
 | 
							Delete from ROFSTs where ROFSTID not in(select rofstid from Associations) and DTS < @dte
 | 
				
			||||||
		delete from roimages where rodbid not in(select rodbid from rofsts) and DTS < @dte
 | 
							delete from roimages where rodbid not in(select rodbid from rofsts) and DTS < @dte
 | 
				
			||||||
		delete from documents where docid not in(select docid from entries) and DTS < @dte
 | 
							delete from documents where docid not in(select docid from entries) and DTS < @dte
 | 
				
			||||||
 | 
						PRINT 'Temporarally storing Items to delete'
 | 
				
			||||||
 | 
						    declare @Items table (ItemID bigint PRIMARY KEY, deletestatus int)
 | 
				
			||||||
 | 
							INSERT INTO @Items
 | 
				
			||||||
 | 
								Select Child.ItemID, Child.deletestatus
 | 
				
			||||||
 | 
									FROM tblItems AS Child
 | 
				
			||||||
 | 
									INNER JOIN tblContents AS parent
 | 
				
			||||||
 | 
									ON Parent.ContentID = Child.ContentID
 | 
				
			||||||
 | 
										AND Parent.deletestatus = Child.deletestatus
 | 
				
			||||||
 | 
									Where
 | 
				
			||||||
 | 
									parent.deletestatus != 0 and parent.ActionDTS < @dte
 | 
				
			||||||
	PRINT 'Phase 1'
 | 
						PRINT 'Phase 1'
 | 
				
			||||||
		delete from tblAnnotations where deletestatus != 0 and DTS < @dte
 | 
							delete from tblAnnotations where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
 | 
							delete tblAnnotations 
 | 
				
			||||||
 | 
							  from tblAnnotations
 | 
				
			||||||
 | 
							   INNER JOIN @Items Itms
 | 
				
			||||||
 | 
							     ON Itms.ItemID = tblAnnotations.ItemID AND tblAnnotations.deletestatus != 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		delete from drousages where docid in(select docid from tbldocuments where deletestatus != 0) and DTS < @dte
 | 
							delete from drousages where docid in(select docid from tbldocuments where deletestatus != 0) and DTS < @dte
 | 
				
			||||||
		delete from tblEntries where deletestatus != 0 and DTS < @dte
 | 
							delete from tblEntries where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
		delete from tblDocuments where deletestatus != 0 and DTS < @dte
 | 
							delete from tblDocuments where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
@@ -24297,11 +24312,46 @@ BEGIN
 | 
				
			|||||||
		delete from tblImages where deletestatus != 0 and DTS < @dte
 | 
							delete from tblImages where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
	PRINT 'Phase 2'
 | 
						PRINT 'Phase 2'
 | 
				
			||||||
		delete from tblROUsages where deletestatus != 0 and DTS < @dte
 | 
							delete from tblROUsages where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
		delete from tblTransitions where deletestatus != 0 and DTS < @dte
 | 
							delete tblROUsages 
 | 
				
			||||||
		delete from tblParts where deletestatus != 0 and DTS < @dte
 | 
							   from tblROUsages
 | 
				
			||||||
		delete from tblItems where deletestatus != 0 and ItemID Not IN (Select ItemID from Parts) and DTS < @dte
 | 
							   INNER JOIN tblContents ON tblContents.ContentID = tblROUsages.ContentID
 | 
				
			||||||
	PRINT 'Purge Contents'
 | 
							     AND tblContents.deletestatus = tblROUsages.deletestatus
 | 
				
			||||||
		delete from tblContents where deletestatus != 0 and DTS < @dte
 | 
							    where tblContents.deletestatus != 0 and tblContents.ActionDTS < @dte
 | 
				
			||||||
 | 
						PRINT 'Deleting Transitions'
 | 
				
			||||||
 | 
							delete from tblTransitions where deletestatus != 0 and 
 | 
				
			||||||
 | 
							  (DTS < @dte
 | 
				
			||||||
 | 
							   OR RangeID in (Select ItemID FROM @Items)
 | 
				
			||||||
 | 
							   OR ToID in (Select ItemID FROM @Items)
 | 
				
			||||||
 | 
							   OR FromID in (Select ContentID from tblContents where deletestatus != 0 and ActionDTS < @dte)
 | 
				
			||||||
 | 
							  )
 | 
				
			||||||
 | 
						PRINT 'Deleting Items and Parts'
 | 
				
			||||||
 | 
							delete from tblItems where deletestatus != 0 and DTS < @dte
 | 
				
			||||||
 | 
							delete from tblParts where deletestatus != 0 and ItemID Not IN (Select ItemID from Items) and DTS < @dte
 | 
				
			||||||
 | 
						PRINT 'Purging Parts with deleted Contents'
 | 
				
			||||||
 | 
							DELETE from Child
 | 
				
			||||||
 | 
							 FROM tblParts AS Child
 | 
				
			||||||
 | 
							 INNER JOIN tblItems
 | 
				
			||||||
 | 
							   ON tblItems.ItemID = Child.ItemID
 | 
				
			||||||
 | 
							    AND tblItems.deletestatus = Child.deletestatus
 | 
				
			||||||
 | 
							 INNER JOIN tblContents AS parent
 | 
				
			||||||
 | 
							   ON parent.ContentID = tblItems.ContentID
 | 
				
			||||||
 | 
							    AND parent.deletestatus = tblItems.deletestatus
 | 
				
			||||||
 | 
							   Where
 | 
				
			||||||
 | 
							    parent.deletestatus != 0 and parent.ActionDTS < @dte
 | 
				
			||||||
 | 
							DELETE FROM tblParts 
 | 
				
			||||||
 | 
							where deletestatus != 0 AND
 | 
				
			||||||
 | 
							ContentID in
 | 
				
			||||||
 | 
					         (Select ContentID from tblContents where deletestatus != 0 and ActionDTS < @dte)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PRINT 'Purging Items with deleted Contents'
 | 
				
			||||||
 | 
						   alter table tblItems nocheck constraint FK_Items_Items
 | 
				
			||||||
 | 
							DELETE tblItems
 | 
				
			||||||
 | 
							 FROM tblItems
 | 
				
			||||||
 | 
							 INNER JOIN @Items Itms
 | 
				
			||||||
 | 
							   ON Itms.ItemID = tblItems.ItemID AND Itms.deletestatus = tblItems.deletestatus
 | 
				
			||||||
 | 
						   alter table tblItems check constraint FK_Items_Items
 | 
				
			||||||
 | 
						PRINT 'Purging Contents'
 | 
				
			||||||
 | 
							delete from tblContents where deletestatus != 0 and ActionDTS < @dte 
 | 
				
			||||||
	PRINT 'Phase 3' 
 | 
						PRINT 'Phase 3' 
 | 
				
			||||||
		delete from AnnotationAudits where DTS < @dte
 | 
							delete from AnnotationAudits where DTS < @dte
 | 
				
			||||||
		delete from ContentAudits where DTS < @dte
 | 
							delete from ContentAudits where DTS < @dte
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -614,7 +614,7 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
					AddDummyGroup(db, tn);
 | 
										AddDummyGroup(db, tn);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				_currRofstID = (int?)MyROFST.ROFstID;
 | 
									_currRofstID = (IsRofstValid) ? (int?)_myROFST.ROFstID : null;
 | 
				
			||||||
				_currDocVersionID = null;
 | 
									_currDocVersionID = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if(_docVersionInfo != null) _currDocVersionID = (int?)_docVersionInfo.VersionID;
 | 
									if(_docVersionInfo != null) _currDocVersionID = (int?)_docVersionInfo.VersionID;
 | 
				
			||||||
@@ -789,7 +789,7 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		private void AddDummyGroup(ROFSTLookup.rodbi rodbi, TreeNode tn)
 | 
							private void AddDummyGroup(ROFSTLookup.rodbi rodbi, TreeNode tn)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (MyROFSTLookup.HasChildren(ref rodbi))
 | 
								if (IsRofstValid && MyROFSTLookup.HasChildren(ref rodbi))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				TreeNode tmp = new TreeNode(DummyNodeText);
 | 
									TreeNode tmp = new TreeNode(DummyNodeText);
 | 
				
			||||||
				tn.Nodes.Add(tmp);
 | 
									tn.Nodes.Add(tmp);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user