or

| public override string DeleteDirectory(string virtualTargetPath) |
| { |
| string physicalTargetPath; |
| physicalTargetPath = this.GetPhysicalFromVirtualPath(virtualTargetPath); |
| if (physicalTargetPath == null) |
| return "The virtual path :" + virtualTargetPath + " cannot be converted to a physical path"; |
| //if (!HasDeletePermission(physicalTargetPath)) |
| //{ |
| // string error = "You do not have delete permissions set to the '" + virtualTargetPath + "' folder"; |
| // return error; |
| //} |
| //================Checking for the Delete permission for Source Folder as on 14th November 2009========================= |
| if (!Dms_CheckFolderPermissions.GetAccessList(virtualTargetPath.TrimEnd('/')).Contains("F")) |
| { |
| string error = "You do not have delete permissions set to the '" + virtualTargetPath + "' folder"; |
| return error; |
| } |
| //======================================================================================================================= |
| // There is not permission issue with the FileExplorer's permissions ==> Delete can be performed |
| // but there can be some FileSystems' error |
| string errorMessage = FileSystem.DeleteDirectory(physicalTargetPath, virtualTargetPath); |
| return errorMessage; |
| } |
| public static string DeleteDirectory(string physicalTargetPath, string virtualTargetPath) |
| { |
| try |
| { |
| string NewFolder_Name = ""; |
| string FolderName = ""; |
| string FolderPath = ""; |
| physicalTargetPathphysicalTargetPath = physicalTargetPath.TrimEnd("\\".ToCharArray()); |
| FolderName = physicalTargetPath.Substring(physicalTargetPath.LastIndexOf("\\") + 1); |
| if (physicalTargetPath.Contains("SharedDocuments")) |
| { |
| FolderPath = physicalTargetPath.Substring(physicalTargetPath.IndexOf("SharedDocuments")); |
| NewFolder_Name = FolderPath.Replace("\\", "#") + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + "-" + HttpContext.Current.Session["UserID"].ToString(); |
| } |
| if (physicalTargetPath.Contains("SharedDocuments")) |
| { |
| Directory.Move(physicalTargetPath, physicalTargetPath.Substring(0, physicalTargetPath.IndexOf("SharedDocuments")) + "DeletedDocuments\\" + NewFolder_Name); |
| } |
| else |
| { |
| Directory.Delete(physicalTargetPath, true);// physicalTargetPath.Substring(0, physicalTargetPath.IndexOf("FTPDocuments")) + "DeletedDocuments\\" + NewFolder_Name); |
| } |
| if (physicalTargetPath.Contains("SharedDocuments")) |
| { |
| Glb_Entities.ExecuteSP(new object[] {"Usp_Dms_DeleteFolder" |
| ,"Folder_Name", FolderName |
| ,"NewFolder_Name", NewFolder_Name |
| ,"Folder_Path", FolderPath.Substring(FolderPath.IndexOf("SharedDocuments")).TrimEnd(FolderName.ToCharArray()).Replace("\\","/").TrimEnd("/".ToCharArray()) |
| ,"Folder_DeletedBy", HttpContext.Current.Session["UserID"].ToString() |
| }); |
| } |
| } |
| catch (DirectoryNotFoundException) |
| { |
| string message = "FileSystem's restriction: Directory with name '" + virtualTargetPath + "' is not found!"; |
| return message; |
| } |
| catch (UnauthorizedAccessException) |
| { |
| string message = "FileSystem's restriction: You do not have enough permissions for this operation!"; |
| return message; |
| } |
| catch (IOException) |
| { |
| string message = "FileSystem's restriction: The directory '" + virtualTargetPath + "' cannot be deleted!"; |
| return message; |
| } |
| return "Directory Deleted Successfully"; |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| try |
| { |
| if (Session["UserID"] == null) |
| { |
| Session.Clear(); |
| Response.Redirect("~/ExpiredMessage.aspx", false); |
| } |
| RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "PopForReport", "function newWindow(url) { var popupWindow = window.open(url,'popUpWindow','height=700,width=600,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no, location=no,directories=no, status=yes'); return false; }", true); |
| RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ErrorHandler", "function handlerFunction(description,page,line) {return true;} window.onerror = handlerFunction;", true); |
| RadScriptManager.RegisterClientScriptInclude(Page, Page.GetType(), "pasword_encrypt", "script/encode.js"); |
| } |
| catch (Exception exLoad) |
| { |
| StackTrace stackError = new StackTrace(new StackFrame(true)); |
| BLLError.SetErrorProperties(exLoad.Message, stackError, short.Parse(Session["UserID"].ToString())); |
| } |
| GetMappedPath GMP = new GetMappedPath(); |
| Dictionary<string, string> mappedPathsInConfigFile = GMP.GetMappingsFromConfigFile(); |
| string DocumentPath = ""; |
| foreach (KeyValuePair<string, string> mappedPath in mappedPathsInConfigFile) |
| { |
| DocumentPath = mappedPath.Value.Replace("/", "\\"); |
| break; |
| } |
| string VirtualPath = Request["__EVENTARGUMENT"]; |
| string EventTarget = Request["__EVENTTARGET"]; |
| if (EventTarget == "Archive") |
| { |
| if (VirtualPath.LastIndexOf("/") + 1 == VirtualPath.Length) |
| { |
| Archive(VirtualPath, "Folder", DocumentPath); |
| } |
| else |
| { |
| Archive(VirtualPath, "File", DocumentPath); |
| } |
| } |
| string[] viewPaths = new string[] { DocumentPath }; |
| string[] uploadPaths = new string[] { DocumentPath }; |
| string[] deletePaths = new string[] { DocumentPath }; |
| DocumentsRadFileExplorer.Configuration.ContentProviderTypeName = typeof(CustomFileSystemProvider).AssemblyQualifiedName; |
| SetAccordToPermissions(viewPaths, uploadPaths, deletePaths); |
| if (!IsPostBack) |
| { |
| AddCreatedAndModifiedDate(); |
| } |
| } |


