public ActionResult CancelUpload()
        {
            TaskManager = (ImportMetadataStructureTaskManager)Session["Taskmanager"];

            // delete created metadatastructure
            #region delete mds

            if (TaskManager.Bus.ContainsKey(ImportMetadataStructureTaskManager.SCHEMA_NAME))
            {
                string schemaName = TaskManager.Bus[ImportMetadataStructureTaskManager.SCHEMA_NAME].ToString();
                MetadataStructureManager msm = new MetadataStructureManager();

                if (msm.Repo.Query(m => m.Name.Equals(schemaName)).Any())
                {
                    MetadataStructure ms = msm.Repo.Query(m => m.Name.Equals(schemaName)).FirstOrDefault();
                    msm.Delete(ms);
                }
            }

            #endregion
            Session["Taskmanager"] = null;
            TaskManager = null;

            return RedirectToAction("ImportMetadataStructureWizard", "ImportMetadataStructure", new RouteValueDictionary { { "area", "DCM" } });
        }
Exemple #2
0
        public ActionResult Delete(long id)
        {
            MetadataStructureManager metadataStructureManager = new MetadataStructureManager();


            try
            {
                MetadataStructure metadataStructure = metadataStructureManager.Repo.Get(id);
                // delete local files
                if (XmlSchemaManager.Delete(metadataStructure))
                {
                    metadataStructureManager.Delete(metadataStructure);
                }

                if (metadataStructureManager.Repo.Get(id) == null)
                {
                    return(Json(true));
                }

                return(Json(false));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
            finally
            {
                metadataStructureManager.Dispose();
            }
        }
        public ActionResult Delete(long id)
        {
            MetadataStructureManager metadataStructureManager = new MetadataStructureManager();
            MetadataStructure metadataStructure = metadataStructureManager.Repo.Get(id);

            try
            {
                // delete local files
                if (XmlSchemaManager.Delete(metadataStructure))
                {
                    metadataStructureManager.Delete(metadataStructure);
                }
            }
            catch (Exception ex)
            {
                return Json(ex.Message);
            }

            // delete links from search index

            if (metadataStructureManager.Repo.Get(id) == null) return Json(true);

            return Json(false);
        }
Exemple #4
0
        public ActionResult CancelUpload()
        {
            TaskManager = (ImportMetadataStructureTaskManager)Session["Taskmanager"];

            // delete created metadatastructure
            #region delete mds

            if (TaskManager.Bus.ContainsKey(ImportMetadataStructureTaskManager.SCHEMA_NAME))
            {
                string schemaName            = TaskManager.Bus[ImportMetadataStructureTaskManager.SCHEMA_NAME].ToString();
                MetadataStructureManager msm = new MetadataStructureManager();

                if (msm.Repo.Query(m => m.Name.Equals(schemaName)).Any())
                {
                    MetadataStructure ms = msm.Repo.Query(m => m.Name.Equals(schemaName)).FirstOrDefault();
                    var deleted          = msm.Delete(ms);

                    if (deleted)
                    {
                        //delete xsds

                        if (TaskManager.Bus.ContainsKey(ImportMetadataStructureTaskManager.SCHEMA_NAME))
                        {
                            schemaName = RegExHelper.GetCleanedFilename(schemaName);
                            string directoryPath = Path.Combine(AppConfiguration.GetModuleWorkspacePath("Dcm"), "Metadata", schemaName);

                            if (Directory.Exists(directoryPath))
                            {
                                Directory.Delete(directoryPath, true);
                            }
                        }

                        //delete mappingfiles
                        if (TaskManager.Bus.ContainsKey(ImportMetadataStructureTaskManager.MAPPING_FILE_NAME_IMPORT))
                        {
                            string filepath = Path.Combine(AppConfiguration.GetModuleWorkspacePath("Dim"), TaskManager.Bus[ImportMetadataStructureTaskManager.MAPPING_FILE_NAME_IMPORT].ToString());
                            if (FileHelper.FileExist(filepath))
                            {
                                FileHelper.Delete(filepath);
                            }
                        }

                        if (TaskManager.Bus.ContainsKey(ImportMetadataStructureTaskManager.MAPPING_FILE_NAME_EXPORT))
                        {
                            string filepath = Path.Combine(AppConfiguration.GetModuleWorkspacePath("Dim"), TaskManager.Bus[ImportMetadataStructureTaskManager.MAPPING_FILE_NAME_EXPORT].ToString());
                            if (FileHelper.FileExist(filepath))
                            {
                                FileHelper.Delete(filepath);
                            }
                        }
                    }
                }
            }


            #endregion
            Session["Taskmanager"] = null;
            TaskManager            = null;



            return(RedirectToAction("ImportMetadataStructureWizard", "ImportMetadataStructure", new RouteValueDictionary {
                { "area", "DCM" }
            }));
        }
Exemple #5
0
 public void Delete(string schemaName)
 {
     MetadataStructureManager mdsManager = new MetadataStructureManager();
     // create default metadataStructure
     MetadataStructure test = mdsManager.Repo.Get(p => p.Name == SchemaName).FirstOrDefault();
     if (test != null) mdsManager.Delete(test);
 }