Beispiel #1
0
        public ActionResult CommonFolderMgt(CommonFolderManagement cfm, String submit, String tableSelectedFolder)
        {
            DocumentsOperations docOps = new DocumentsOperations();
            String virtualPath = "", physicalPath = "", folderPath = "";

            switch (submit)
            {
            case "Create":
                virtualPath  = UtilityOperations.GetDockerCommonFolderPath();
                physicalPath = UtilityOperations.GetServerMapPath(virtualPath);
                folderPath   = Path.Combine(UtilityOperations.DecodePath(physicalPath, Server), cfm.FolderName);
                if (folderPath != "\\")
                {
                    if (!Directory.Exists(folderPath))
                    {
                        docOps.InsertNewFolder(virtualPath, folderPath, HttpContext.User.Identity.Name, cfm.FolderName);
                    }
                    else
                    {
                        TempData["CommonFolderMgtErrorMsg"] = "Warning - Folder already existed.";
                    }
                }
                break;

            case "Edit":
                return(RedirectToAction("EditCommonFolder", new { virtualPath = tableSelectedFolder }));

            case "Delete":
                physicalPath = UtilityOperations.DecodePath(UtilityOperations.GetServerMapPath(tableSelectedFolder), Server);
                FileAttributes attr = System.IO.File.GetAttributes(physicalPath);
                if (Directory.Exists(physicalPath))
                {
                    if (docOps.GetFilesStartsWithVirtualPath(tableSelectedFolder) != null)
                    {
                        docOps.DeleteFile(tableSelectedFolder);
                    }
                    Directory.Delete(physicalPath, true);
                }
                else
                {
                    TempData["CommonFolderMgtErrorMsg"] = "Warning - Folder not exist in the system.";
                }
                break;
            }
            return(RedirectToAction("CommonFolderMgt"));
        }
Beispiel #2
0
        public ActionResult CommonFolderMgt()
        {
            CommonFolderManagement        cfm     = new CommonFolderManagement();
            List <CommonFolderAssignment> cfaList = new List <CommonFolderAssignment>();
            DocumentsOperations           docOps  = new DocumentsOperations();

            foreach (var item in docOps.GetFilesStartsWithVirtualPath(UtilityOperations.GetDockerCommonFolderPath()))
            {
                cfaList.Add(new CommonFolderAssignment {
                    FolderName  = item.Name,
                    CreatedAt   = item.DateTimeUploaded.ToString(),
                    VirtualPath = item.VirtualPath,
                    UsersName   = docOps.GetUsersNameByFileID(item.ID),
                    RolesName   = docOps.GetRolesNameByFileID(item.ID)
                });
            }
            cfm.CommonFolderAssignment = cfaList;
            return(View(cfm));
        }