예제 #1
0
        public ActionResult GenerateKeywords(String virtualPath)
        {
            DCEOperations    dceOps           = new DCEOperations();
            TemplateKeywords templateKeywords = new TemplateKeywords();

            templateKeywords.Keywords = GetKeywordsByVirtualPath(virtualPath);
            DCE_Templates template = dceOps.GetTemplateByVirtualPath(virtualPath);

            if (template != null)
            {
                templateKeywords.Template  = GenerateUploadedTemplates(template);
                templateKeywords.SkipPages = template.SkipPages;
            }
            templateKeywords.TemplateOCRContent = template.DocumentOCRContent;
            return(View(templateKeywords));
        }
예제 #2
0
        public ActionResult GenerateKeywords(TemplateKeywords templateKeywords, String virtualPath, String inputKeyword, String templateDocType, String submit)
        {
            DCEOperations dceOps   = new DCEOperations();
            DCE_Templates template = dceOps.GetTemplateByVirtualPath(virtualPath);

            if (template != null)
            {
                templateKeywords.Template  = GenerateUploadedTemplates(template);
                templateKeywords.SkipPages = template.SkipPages;
            }
            templateKeywords.TemplateOCRContent = template.DocumentOCRContent;
            switch (submit)
            {
            case "System Generation":
                templateKeywords.GeneratedBySystem = true;
                List <InputtedKeyword> arr = dceOps.GetKeywordsGeneratedBySystem(templateKeywords.Template);
                templateKeywords.Keywords = dceOps.GetKeywordsGeneratedBySystem(templateKeywords.Template);
                break;

            case "Keyword Checking":
                if (inputKeyword.Trim() == "")
                {
                    ViewData["GenerateKeywordsReturnMsg"] = "Input Keyword is empty ...";
                }
                else
                {
                    templateKeywords.GeneratedBySystem = true;
                    templateKeywords.Keywords          = dceOps.GetKeywordByInput(templateKeywords.Template, inputKeyword);
                }
                break;

            case "Added Keywords":
                return(RedirectToAction("GenerateKeywords", new { virtualPath = virtualPath }));

            case "Update":
                DocumentsOperations docOps = new DocumentsOperations();
                docOps.RenameDocumentTypeByVirtualPath(templateKeywords.Template.VirtualPath, templateDocType);
                templateKeywords.Template.DocumentType = templateDocType;
                break;

            default:
                templateKeywords.GeneratedBySystem = false;
                templateKeywords.Keywords          = GetKeywordsByVirtualPath(virtualPath);
                break;
            }
            return(View(templateKeywords));
        }
예제 #3
0
        public void DownloadDCETEmplateJson(String virtualPath)
        {
            DCEOperations             dceOps   = new DCEOperations();
            DCE_Templates             template = dceOps.GetTemplateByVirtualPath(virtualPath);
            DCETemplateKeywordsInJson retJson  = new DCETemplateKeywordsInJson();

            if (template != null)
            {
                retJson.DocType = template.DocumentType;
                List <DCEKeysList> dceKeysList = new List <DCEKeysList>();
                foreach (InputtedKeyword keyword in GetKeywordsByVirtualPath(virtualPath))
                {
                    dceKeysList.Add(new DCEKeysList {
                        Keyword = keyword.Keyword, Rank = keyword.Rank
                    });
                    retJson.Score += keyword.Rank;
                }
                retJson.KeysList = dceKeysList;
            }
            HttpContext httpContext = this.HttpContext.ApplicationInstance.Context;

            UtilityOperations.DownloadJson(JsonConvert.SerializeObject(retJson), template.DocumentType, httpContext);
        }