Ejemplo n.º 1
0
        public JsonResult OCRThisFile(String virtualPath)
        {
            String        physicalPath  = UtilityOperations.DecodePath(UtilityOperations.GetServerMapPath(virtualPath), Server);
            SingleFileOCR singleFileOCR = new SingleFileOCR(physicalPath);
            String        retVal        = singleFileOCR.StartOCR();

            if (!retVal.StartsWith("ERROR"))
            {
                DocumentsOperations docOps = new DocumentsOperations();
                var    file       = docOps.GetFileByVirtualPath(virtualPath);
                String oriFileExt = (new System.IO.FileInfo(physicalPath)).Extension;
                String retFileExt = (new System.IO.FileInfo(retVal)).Extension;
                retFileExt = retVal.Substring(retVal.Length - (retFileExt.Length + 4));
                docOps.InsertFileEncodeFileName(file.Name.Replace(oriFileExt, retFileExt), file.VirtualPath.Replace(oriFileExt, retFileExt), "", "OCR Performed @ " + DateTime.Now, HttpContext.User.Identity.Name, false);
                docOps.InsertFileBeenOCR(docOps.GetFileIDByVirtualPath(file.VirtualPath.Replace(oriFileExt, retFileExt)), docOps.IdentifyDocumentType(retVal));
                return(new JsonResult()
                {
                    Data = ""
                });
            }
            return(new JsonResult()
            {
                Data = retVal
            });
        }
Ejemplo n.º 2
0
        public void RecordFileDownload(String virtualPath, String userName)
        {
            DocumentsOperations docOps = new DocumentsOperations();

            (new AuditTrailOperations()).InsertFilesDownloadAuditTrails(docOps.GetFileIDByVirtualPath(virtualPath),
                                                                        (new AuthenticationsAndAuthorizationsOperations()).GetUserIDByUserName(userName));
        }
Ejemplo n.º 3
0
        public JsonResult InsertFileTags(IEnumerable <String> tags, String virtualPath)
        {
            DocumentsOperations docOps = new DocumentsOperations();

            if (tags != null && tags.Count() > 0)
            {
                docOps.InsertTagsByFileID(docOps.GetFileIDByVirtualPath(virtualPath), tags);
            }
            else
            {
                docOps.DeleteTagsByFileID(docOps.GetFileIDByVirtualPath(virtualPath));
            }
            return(new JsonResult()
            {
                Data = ""
            });
        }
Ejemplo n.º 4
0
 public static void LogDocumentsDownloaded(List<string> virtualPaths)
 {
     string userID = System.Web.Security.Membership.GetUser().ProviderUserKey.ToString();
     DocumentsOperations documentsOperations = new DocumentsOperations();
     foreach (string path in virtualPaths)
     {
         Guid fileID = documentsOperations.GetFileIDByVirtualPath(path);
         documentsOperations.InsertFilesDownloadAuditTrails(fileID,new Guid(userID));
     }
 }
Ejemplo n.º 5
0
        public JsonResult GetFileTags(String virtualPath)
        {
            DocumentsOperations docOps   = new DocumentsOperations();
            List <TagsOnFile>   tags     = docOps.GetTagsByFileID(docOps.GetFileIDByVirtualPath(virtualPath));
            List <TagsMetadata> jsonTags = new List <TagsMetadata>();

            foreach (TagsOnFile tag in tags)
            {
                jsonTags.Add(new TagsMetadata {
                    TagName = tag.TagName, LastModified = tag.LastModifiedDateTime.ToString()
                });
            }
            return(Json(new { Total = jsonTags.Count, Data = jsonTags }));
        }
Ejemplo n.º 6
0
        public ActionResult EditCommonFolder(CommonFolderAssignment cfa, String submit, String editCommonFolderKey, String editCommonFolderVal)
        {
            DocumentsOperations docOps = new DocumentsOperations();
            AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations();

            switch (submit)
            {
            case "Add":
                if (String.Equals(editCommonFolderKey.ToUpper(), "USER"))
                {
                    docOps.InsertUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE"))
                {
                    docOps.InsertRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                break;

            case "Remove":
                if (String.Equals(editCommonFolderKey.ToUpper(), "USER"))
                {
                    docOps.RemoveUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE"))
                {
                    docOps.RemoveRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                break;
            }
            return(RedirectToAction("EditCommonFolder", new { virtualPath = cfa.VirtualPath }));
        }
 private void AssignRoleAccessToFileOrFolder(string roleID, string path)
 {
     DocumentsOperations documentsOperations = new DocumentsOperations();
     string virtualPath = UtilityOperations.GetVirtualPath(path);
     Guid fileID = documentsOperations.GetFileIDByVirtualPath(virtualPath);
     documentsOperations.InsertRolesFilesAuthorizations(new Guid(roleID), fileID);
 }