DeleteDataset() public method

Marks the dataset as deleted but does not physically remove it from the database. If the dataset is checked out and the rollbackCheckout is True, the dataset's changes will be roll-backed and then the delete operation takes place, but if the rollbackCheckout is false, The changes will be checked in as a new version and then the deletion operation is executed.
public DeleteDataset ( System.Int64 datasetId, string username, bool rollbackCheckout ) : bool
datasetId System.Int64 The identifier of the dataset to be checked-in.
username string The username that performs the check-in, which should be the same as the check-out username.
rollbackCheckout bool Determines whether latest uncommitted changes should be rolled back or checked in before marking the dataset as deleted.
return bool
示例#1
0
 /// <summary>
 /// Deletes a dataset, which means the dataset is marked as deleted, but is not physically removed from the database.
 /// </summary>
 /// <param name="id">the identifier of the dataset to be purged.</param>
 /// <remarks>When a dataset is deleted, it is consodered as non-exisiting, but for the sake or provenance, citation, history, etc, it is not removed froom the database.
 /// The function to recover a deleted dataset, will not be provided.</remarks>
 /// <returns></returns>
 public ActionResult Delete(long id)
 {
     ViewBag.Title = PresentationModel.GetViewTitleForTenant("Delete", this.Session.GetTenant());
     try
     {
         DatasetManager dm = new DatasetManager();
         if (dm.DeleteDataset(id, this.ControllerContext.HttpContext.User.Identity.Name, true))
         {
             // during the delete permissions are not removed, to allow purging the dataset later on.
             // it is a safe operation, because deleted datasets are not returned by the DLM anyway.
             // Javad and Sven decided on 22.11.2016.
             //try
             //{
             //    PermissionManager pm = new PermissionManager();
             //    pm.DeleteDataPermissionsByEntity(1, id);
             //}
             //catch
             //{
             //    ViewData.ModelState.AddModelError("", string.Format("Dataset {0} was deleted, but its permissions were not altered. You need to remove them manually from the data permission management.", id));
             //}
             try
             {
                 ISearchProvider provider = IoCFactory.Container.ResolveForSession<ISearchProvider>() as ISearchProvider;
                 provider?.UpdateSingleDatasetIndex(id, IndexingAction.DELETE);
             }
             catch
             {
                 ViewData.ModelState.AddModelError("", string.Format("Dataset {0} was deleted, but it is still indexed for searching. You need to reindex the search via the managemnet console.", id));
             }
         }
         else
         {
             ViewData.ModelState.AddModelError("", string.Format("Dataset {0} could not be deleted. Details: Internal system error!", id));
         }
     }
     catch (Exception ex)
     {
         ViewData.ModelState.AddModelError("", string.Format("Dataset {0} could not be deleted. Details: {1}", id, ex.Message));
     }
     return View();
     //return RedirectToAction("List");
 }
示例#2
0
 private void deleteDataset(long dsId)
 {
     DatasetManager dm = new DatasetManager();
     dm.DeleteDataset(dsId, "Javad", false);
 }