Exemple #1
0
        public JsonResult DeleteTemplate(String virtualPath)
        {
            bool retJsonBool           = false;
            DocumentsOperations docOps = new DocumentsOperations();

            if (docOps.GetFileByVirtualPath(virtualPath) != null)
            {
                DCEOperations dceOps = new DCEOperations();
                Guid          fileID = dceOps.GetFileIDFromTemplateByVirtualPath(virtualPath);
                if (fileID != Guid.Empty)
                {
                    dceOps.DeleteUploadedTemplateKeywords(fileID);
                    dceOps.DeleteUploadedTemplates(virtualPath);
                    docOps.DeleteFile(virtualPath);
                    String physicalPath = UtilityOperations.GetServerMapPath(virtualPath);
                    physicalPath = DecodePath(physicalPath);
                    if (System.IO.File.Exists(physicalPath))
                    {
                        System.IO.File.Delete(physicalPath);
                    }
                    retJsonBool = true;
                }
            }
            return(new JsonResult()
            {
                Data = retJsonBool
            });
        }
Exemple #2
0
        private List <InputtedKeyword> GetKeywordsByVirtualPath(String virtualPath)
        {
            DCEOperations          dceOps           = new DCEOperations();
            List <DCE_Keywords>    keywords         = dceOps.GetKeywordsByFileID(dceOps.GetFileIDFromTemplateByVirtualPath(virtualPath));
            List <InputtedKeyword> inputtedKeywords = new List <InputtedKeyword>();

            if (keywords != null)
            {
                foreach (DCE_Keywords keyword in keywords)
                {
                    InputtedKeyword inputtedKeyword = new InputtedKeyword {
                        Keyword = keyword.Keyword,
                        Rank    = (decimal)keyword.Rank,
                    };
                    inputtedKeywords.Add(inputtedKeyword);
                }
                return(inputtedKeywords);
            }
            return(null);
        }