public JsonResult Upload(String virtualPath) { String jsonRet = ""; if (String.IsNullOrEmpty(virtualPath) || virtualPath == "/") { virtualPath = UtilityOperations.GetDockerRootPath(Server); } String userName = HttpContext.User.Identity.Name; foreach (String file in Request.Files) { var fileContent = Request.Files[file]; var fileNiceName = Request.Form["fileNiceName"]; var fileDesc = Request.Form["fileDesc"]; if (fileContent != null && fileContent.ContentLength > 0) { String filePath = Path.Combine(UtilityOperations.GetServerMapPath(virtualPath), Path.GetFileName(fileContent.FileName)); DocumentsOperations docOps = new DocumentsOperations(); //docOps.InsertFile(fileContent.FileName, virtualPath, fileNiceName, fileDesc); docOps.InsertFileEncodeFileName(fileContent.FileName, virtualPath + "/" + fileContent.FileName, fileNiceName, fileDesc, userName, false); fileContent.SaveAs(filePath); jsonRet = "Uploaded"; } } return(new JsonResult() { Data = jsonRet }); }
public ActionResult DocClassification(HttpPostedFileBase file) { DocClassification docCls = new DocClassification(); try { String physicalPath = ""; if (file.ContentLength > 0) { String fileHashName = (DateTime.Now).ToString("yyyyMMddHHmmssffff") + file.FileName; physicalPath = DecodePath( Path.Combine( UtilityOperations.GetServerMapPath( UtilityOperations.GetDCEDockerRootPath()) + "\\_temp", Path.GetFileName(fileHashName))); file.SaveAs(physicalPath); String varet = (new DocumentsOperations()).IdentifyDocumentType(physicalPath); FileInfo uploadedFile = new FileInfo(physicalPath); docCls.DocClassifiedOutcome += "<input hidden id=\"UploadedFileName\" value=\"" + uploadedFile.Name + "\"/>"; docCls.DocClassifiedOutcome += "<span>File Name : " + (uploadedFile.Name).Substring(18) + "</span><br/>"; docCls.DocClassifiedOutcome += "<span>Document Type : " + varet + "</span><br/>"; docCls.DocClassifiedOutcome += "<span>File Uploaded @ : " + uploadedFile.CreationTime + "</span><br/>"; } else { docCls.DocClassifiedMsg = "Error - Please attach the file ..."; } } catch (Exception ex) { docCls.DocClassifiedMsg = "Error - File upload failed! " + ex.Message; } return(View(docCls)); }
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 }); }
/// <summary> /// Files and containers initialisation /// </summary> private void Init(int bFactor, int overflowBFactor, string mainFileDiskLetter, string overflowFileDiskLetter) { UtilityOperations.GetDiskFreeSpace(mainFileDiskLetter, out var SectorsPerCluster, out var BytesPerSector, out _, out _); var ClusterSize = SectorsPerCluster * BytesPerSector; _BFactor = bFactor == -1 ? (ClusterSize - 8) / _emptyClass.GetSize() : bFactor; _OverflowBFactor = overflowBFactor == -1 ? (ClusterSize - 8) / _emptyClass.GetSize() : overflowBFactor; _blocksInformations = new List <BlockInfo>((int)Math.Pow(2, _hashDepth)); var block = new Block <T>(_BFactor, _emptyClass.GetEmptyClass()); var overflowBlock = new Block <T>(_OverflowBFactor, _emptyClass.GetEmptyClass()); _fileManager = new FileManager(_filePath, block.GetSize()); _overflowManager = new OverflowFileManager <T>("overflow." + _filePath, overflowBlock.GetSize(), _emptyClass, _OverflowBFactor); var address = _fileManager.GetFreeAddress(); _blocksInformations.Add(new BlockInfo { Address = address, Depth = 1, Records = 0 }); WriteBlock(address, block); address = _fileManager.GetFreeAddress(); _blocksInformations.Add(new BlockInfo { Address = address, Depth = 1, Records = 0 }); WriteBlock(address, block); }
private void buttonLogin_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); int userKey = 0; if (!string.IsNullOrEmpty(textBoxUserId.Text) && !string.IsNullOrEmpty(textBoxPassword.Text)) { if (AM.checkUserLogin(textBoxUserId.Text, textBoxPassword.Text, out userKey)) { UtilityClass.UtilityOperations.updateRegistryValue(textBoxUserId.Text, textBoxPassword.Text, userKey, true); this.Close(); UtilityOperations.showMessage("User is set. Please restart the application"); } else { UtilityClass.UtilityOperations.updateRegistryValue(" ", " ", 0, false); UtilityOperations.showMessage("User not found. Please signup"); } } else { UtilityOperations.showMessage("Please enter userid and password"); } //UtilityClass.UtilityOperations.updateRegistryValue("", "", true); Cursor.Current = Cursors.Default; }
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 }); }
public FileModel(String virtualPath, String userPath) { Name = virtualPath; FullPath = Encode("\\"); Category = new Category(FileType.DiscRoot); VirtualPath = virtualPath; String physicalPath = UtilityOperations.GetServerMapPath(virtualPath); CurrentFolderFiles = GetFoldersAndFiles(physicalPath); IsFolder = true; if (String.Equals(virtualPath, UtilityOperations.GetDockerCommonFolderPath())) { IsCommonFolder = true; } if (String.Equals(virtualPath, UtilityOperations.GetDockerRootPath() + userPath)) { IsRootDir = true; parentVirtualPath = virtualPath; } else { IsRootDir = false; parentVirtualPath = UtilityOperations.GetVirtualPath(Directory.GetParent(physicalPath).FullName); } }
public ActionResult SubFolder(String virtualPath) { if (String.Equals(virtualPath, IsSystemAdministrator(HttpContext.User.Identity.Name)) || String.Equals(virtualPath, UtilityOperations.GetDockerCommonFolderPath())) { return(RedirectToAction("Files")); } return(View(FilterAccessibleFolderAndFiles(virtualPath, HttpContext.User.Identity.Name))); }
private String DecodePath(String path) { if (String.IsNullOrEmpty(path) || path == "/") { path = UtilityOperations.GetDockerRootPath(Server) + "/DCEDocker"; } String decodePath = path.Replace("/", "\\"); return(decodePath); }
public JsonResult UploadTemplate() { String retJsonMsg = String.Empty; foreach (String file in Request.Files) { var fileContent = Request.Files[file]; var docType = Request.Form["DocType"]; var docDesc = Request.Form["DocDesc"]; var skipPages = Request.Form["SkipPages"]; List <int> pagesToSkill = new List <int>(); if (skipPages.Length > 0) { List <String> skippages = skipPages.Split(',').ToList(); foreach (String skip in skippages) { int number; bool retInt = int.TryParse(skip, out number); if (retInt) { pagesToSkill.Add(number); } else { retJsonMsg = "ERROR - Skip page value [" + skip + "] is not a number!"; break; } } } if (fileContent != null && fileContent.ContentLength > 0 && String.IsNullOrEmpty(retJsonMsg)) { String virtualPath = UtilityOperations.GetDCEDockerRootPath(); String physicalPath = DecodePath(Path.Combine(UtilityOperations.GetServerMapPath(virtualPath), Path.GetFileName(fileContent.FileName))); String userName = HttpContext.User.Identity.Name; DocumentsOperations docOps = new DocumentsOperations(); if (docOps.GetFileByVirtualPath(virtualPath + "/" + fileContent.FileName) == null) { System.IO.Directory.CreateDirectory(UtilityOperations.GetServerMapPath(virtualPath)); fileContent.SaveAs(physicalPath); docOps.InsertFileEncodeFileName(fileContent.FileName, virtualPath + "/" + fileContent.FileName, "_DCEDockerFile", docDesc, userName, false); DCEOperations dceOps = new DCEOperations(); dceOps.InsertTemplate(virtualPath + "/" + fileContent.FileName, docType, docDesc, userName); List <String> retStrArr = GetPDFContents(physicalPath, pagesToSkill); dceOps.InsertOCRContents(fileContent.FileName, retStrArr[0], retStrArr[1]); } else { retJsonMsg = "ERROR - The file already eixsts."; } } } return(new JsonResult() { Data = retJsonMsg }); }
private void buttonLoadFIle_Click(object sender, EventArgs e) { if (buttonLoadFIle.Text == "Load File") { DialogResult result = openFileDialog.ShowDialog(); fileLoc = openFileDialog.FileName; if (result == DialogResult.OK) // Test result. { string ext = Path.GetExtension(openFileDialog.FileName); if (ext == ".xml") { labelFile.Text = fileLoc; string xmlRawText = string.Empty; try { try { textBoxSource.Text = XmlOperation.LoadFileToXML(fileLoc, out newDocument); textBoxSource.ForeColor = Color.Black; buttonLoadFIle.Text = "UnLoad File"; fileLoadStatus = true; } catch { } } catch { textBoxSource.Text = xmlRawText; textBoxSource.ForeColor = Color.Red; } } else { UtilityOperations.ShowMessageBox("File Format Not Supported. (I.E. .XML or .TXT)", MessageBoxIcon.Error); } if (ext == ".xml") { textBoxElement.Enabled = true; } else { textBoxElement.Enabled = false; } } } else { buttonLoadFIle.Text = "Load File"; labelFile.Text = "File Location"; fileLoadStatus = false; textBoxSource.Text = ""; textBoxElement.Enabled = true; } }
public void DownloadFile(String virtualPath, String userID) { String physicalPath = UtilityOperations.GetServerMapPath(virtualPath); physicalPath = UtilityOperations.DecodePath(physicalPath, Server); List <String> archives = new List <String>(); archives.Add(physicalPath); RecordFileDownload(virtualPath, userID); UtilityOperations.DownloadFiles(archives, this.HttpContext.ApplicationInstance.Context); }
private String IsSystemAdministrator(String userName) { AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); String virtualPath = UtilityOperations.GetDockerRootPath(); if (!aNaOps.IsSystemAdministratorUser(userName) && !aNaOps.IsDMSAdministratorUser(userName)) { virtualPath += "/" + userName; } return(virtualPath); }
private void buttonGenerate_Click(object sender, EventArgs e) { propertyList = new List <string>(); if (comboBoxAM.SelectedIndex == -1 || comboBoxProperty.SelectedIndex == -1 || comboBoxReturn.SelectedIndex == -1 || labelFile.Text == "" || textBoxClass.Text == "" || textBoxElement.Text == "") { UtilityOperations.ShowMessageBox("Please load a file using load file or fill source text area. Also select \"Access Specifier, Return Type, Property Type, Class Name & Element for Property\" for the same.", MessageBoxIcon.Warning); } else { if (fileLoadStatus) { try { XmlDocument docIn = new XmlDocument(); docIn.Load(fileLoc); XmlNodeList headerNodeList = docIn.SelectSingleNode("/ROOT").ChildNodes; if (headerNodeList != null) { foreach (XmlNode headerAttribute in headerNodeList) { processXMLNodes(headerAttribute); } } } catch { } generateProperty(); textBoxDestination.Text = textBoxDestination.Text + "\r\n" + "}"; } else { if (string.IsNullOrEmpty(textBoxSource.Text)) { UtilityOperations.ShowMessageBox("Please load a file using load file or fill source text area.", MessageBoxIcon.Warning); } else { string[] lines = Regex.Split(textBoxSource.Text, "\r\n"); for (int i = 0; i < lines.Length; i++) { propertyList.Add(lines[i].ToString()); } generateProperty(); textBoxDestination.Text = textBoxDestination.Text + "\r\n" + "}"; } } } }
private void buttonSearch_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); resultList = new List <PropertyClass>(); int userKey = 0; if (!string.IsNullOrEmpty(textBoxSearch.Text)) { int cDbKey = 0; if (string.IsNullOrEmpty(comboBoxCatagory.Text)) { UtilityOperations.showMessage("Please select some category"); } else { if (newCategoryList.ContainsKey(comboBoxCatagory.Text)) { cDbKey = Convert.ToInt32(newCategoryList[comboBoxCatagory.Text]); } if (checkBoxAllorMine.Checked) { userKey = UtilityOperations.getUserKey(); } else { userKey = 0; } resultList = AM.getResultList(textBoxSearch.Text, cDbKey, userKey); } } else { UtilityOperations.showMessage("Please enter the search text"); } loadDataGrid(); foreach (PropertyClass pClass in resultList) { dataGridViewResult.Rows.Add(pClass.Id, pClass.Title, pClass.ArticleType, pClass.URL); } Cursor.Current = Cursors.Default; }
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")); }
public ActionResult SearchFile(String searchValue, String virtualPath) { FileModel fileModel = new FileModel(virtualPath, ""); fileModel.IsRootDir = true; fileModel.IsSearchResult = true; String userName = HttpContext.User.Identity.Name; DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); if (aNaOps.IsSystemAdministratorUser(userName) || aNaOps.IsDMSAdministratorUser(userName)) { userName = null; } String[] usersPath = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/"); List <FileModel> searchCurrentResult = new List <FileModel>(); List <FileModel> searchCommonResult = new List <FileModel>(); foreach (String vPath in docOps.GetVirtualPathsBySearchValue(searchValue, userName)) { FileModel file = null; if (vPath.StartsWith(UtilityOperations.GetDockerCommonFolderPath())) { file = (new FileModel()).GetFolderOrFile(vPath); file.IsCommonFolder = true; if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCommonResult.Add(file); } else if (vPath.StartsWith(virtualPath) && !String.Equals(vPath, virtualPath)) { file = (new FileModel()).GetFolderOrFile(vPath); if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCurrentResult.Add(file); } } fileModel.CurrentFolderFiles = searchCurrentResult; fileModel.CommonFolderFiles = searchCommonResult; fileModel.Tags = new List <String>(); return(View(fileModel)); }
private FileModel FilterAccessibleFolderAndFiles(String virtualPath, String userName) { FileModel fileModel = null; AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); DocumentsOperations docOps = new DocumentsOperations(); FileModel commonFileModel = new FileModel(UtilityOperations.GetDockerCommonFolderPath(), ""); if (!aNaOps.IsSystemAdministratorUser(userName) && !aNaOps.IsDMSAdministratorUser(userName)) { fileModel = new FileModel(virtualPath, "/" + userName); List <String> dbFilesVPath = docOps.GetFilesByUserName(userName).Select(file => file.VirtualPath).ToList(); if (fileModel.IsRootDir) { fileModel.CommonFolderFiles = commonFileModel.CurrentFolderFiles.Where(file => dbFilesVPath.Contains(file.VirtualPath)).ToList(); } else { fileModel.CommonFolderFiles = new List <FileModel>(); } fileModel.Tags = docOps.GetAllTagsByUserId(aNaOps.GetUserIDByUserName(userName)); } else { fileModel = new FileModel(virtualPath, ""); String[] usersPath = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/"); foreach (FileModel file in fileModel.CurrentFolderFiles) { if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } } if (fileModel.IsRootDir) { fileModel.CommonFolderFiles = commonFileModel.CurrentFolderFiles; } else { fileModel.CommonFolderFiles = new List <FileModel>(); } fileModel.Tags = docOps.GetAllTagsByUserId(aNaOps.GetUserIDByUserName(userName)); } return(fileModel); }
public void Start() { Console.WriteLine("--- Extended Hashing Tester ---"); UtilityOperations.GetDiskFreeSpace("C:\\", out var SectorsPerCluster, out var BytesPerSector, out var NumberOfFreeClusters, out var TotalNumberOfClusters); var ClusterSize = SectorsPerCluster * BytesPerSector; var emptyProp = new Property(); Console.WriteLine($"Record size: {emptyProp.GetSize()}"); Console.WriteLine($"Cluster size: {ClusterSize}"); var bFactor = (ClusterSize - 8) / emptyProp.GetSize(); Console.WriteLine($"Recomended BFactor: {bFactor}"); Console.Write($"Blocking factor (default {bFactor}): "); var inp = Console.ReadLine(); bFactor = string.IsNullOrWhiteSpace(inp) ? bFactor : int.Parse(inp); Console.Write("File path (default file.dat): "); inp = Console.ReadLine(); inp = String.IsNullOrWhiteSpace(inp) ? "file.dat" : inp; hashing = new ExtendibleHashingDirectory <Property>(inp, bFactor, 9); Console.Write("Seed (default is random): "); inp = Console.ReadLine(); var seed = string.IsNullOrWhiteSpace(inp) ? Guid.NewGuid().GetHashCode() : int.Parse(inp); Console.WriteLine($"Seed = {seed}"); rnd = new Random(seed); helpStructure = new Dictionary <int, Property>(); do { Console.WriteLine(); PrintStats(); Console.WriteLine(); PrintMenu(); GetInput(); Console.WriteLine(); HandleInput(); } while (!exit); }
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)); }
public JsonResult DeleteFile(String virtualPath) { bool retJsonBool = false; if (virtualPath.Length > 1) { String physicalPath = UtilityOperations.GetServerMapPath(virtualPath); physicalPath = UtilityOperations.DecodePath(physicalPath, Server); FileAttributes attr = System.IO.File.GetAttributes(physicalPath); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { if (Directory.Exists(physicalPath)) { DocumentsOperations docOps = new DocumentsOperations(); if (docOps.GetFilesStartsWithVirtualPath(virtualPath) != null) { docOps.DeleteFile(virtualPath); } Directory.Delete(physicalPath, true); retJsonBool = true; } } else { if (System.IO.File.Exists(physicalPath)) { DocumentsOperations docOps = new DocumentsOperations(); if (docOps.GetFileByVirtualPath(virtualPath) != null) { docOps.DeleteFile(virtualPath); } System.IO.File.Delete(physicalPath); retJsonBool = true; } } } return(new JsonResult() { Data = retJsonBool }); }
public ActionResult SearchTags(String virtualPath, String tagName) { FileModel fileModel = new FileModel(virtualPath, ""); fileModel.IsRootDir = true; fileModel.IsSearchResult = true; DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); String[] usersPath = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/"); List <FileModel> searchCurrentResult = new List <FileModel>(); List <FileModel> searchCommonResult = new List <FileModel>(); foreach (String vPath in docOps.GetVirtualPathsByTagName(aNaOps.GetUserIDByUserName(HttpContext.User.Identity.Name), tagName)) { FileModel file = null; if (vPath.StartsWith(UtilityOperations.GetDockerCommonFolderPath())) { file = (new FileModel()).GetFolderOrFile(vPath); file.IsCommonFolder = true; if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCommonResult.Add(file); } else { file = (new FileModel()).GetFolderOrFile(vPath); if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCurrentResult.Add(file); } } fileModel.CurrentFolderFiles = searchCurrentResult; fileModel.CommonFolderFiles = searchCommonResult; fileModel.Tags = new List <String>(); return(View(fileModel)); }
private void buttonShare_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxCode.Text)) { string resultId = AM.addSharedCode(userInfo, textBoxCode.Text, "0"); //textBoxLink.Text = EncryptDecrypt.EncryptDecrypt.Encrypt(resultId, true); textBoxLink.Text = Encrypt(resultId); } else { UtilityOperations.showMessage("Please write some code."); } } catch { } Cursor.Current = Cursors.Default; }
public JsonResult Rename() { var virtualPath = Request.Form["virtualPath"]; var newName = Request.Form["newName"]; var oldName = Request.Form["oldName"]; String decodePath = UtilityOperations.DecodePath(UtilityOperations.GetServerMapPath(virtualPath), Server); String newDecodePath = decodePath.Replace(oldName, newName); String retJsonMsg = ""; FileAttributes attr = System.IO.File.GetAttributes(decodePath); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { if (System.IO.Directory.Exists(decodePath)) { System.IO.Directory.Move(decodePath, decodePath.Replace(oldName, newName)); retJsonMsg += " DirRenamed"; } } else { if (System.IO.File.Exists(decodePath)) { System.IO.File.Move(decodePath, decodePath.Replace(oldName, newName)); retJsonMsg += " FileRenamed"; } } DocumentsOperations docOps = new DocumentsOperations(); if (docOps.GetFileByVirtualPath(virtualPath) != null) { docOps.RenameFile(newName, virtualPath, virtualPath.Replace(oldName, newName)); retJsonMsg += " DBRenamed"; } return(new JsonResult() { Data = retJsonMsg }); }
private void buttonGet_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxLink.Text)) { string keyVal = textBoxLink.Text; //string key = EncryptDecrypt.EncryptDecrypt.Decrypt(keyVal, true); string key = Decrypt(keyVal); string result = AM.getShareKey(Convert.ToString(Convert.ToInt32(key))); textBoxCode.Text = result; } else { UtilityOperations.showMessage("Please verify the key."); } } catch { } Cursor.Current = Cursors.Default; }
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); }
private void buttonAddArticle_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxTitleAdd.Text) && !string.IsNullOrEmpty(textBoxCodeAdd.Text)) { int cDbKey = 0; if (string.IsNullOrEmpty(comboBoxCategoryAdd.Text)) { UtilityOperations.showMessage("Please select some category"); } else { if (newCategoryList.ContainsKey(comboBoxCategoryAdd.Text)) { cDbKey = Convert.ToInt32(newCategoryList[comboBoxCategoryAdd.Text]); } bool status = AM.addArticle("<pre><xmp>" + textBoxCodeAdd.Text + "</xmp></pre>", textBoxTitleAdd.Text, cDbKey); if (status) { UtilityOperations.showMessage("Article added successfully"); clearAddFields(); } else { UtilityOperations.showMessage("Error adding article"); } } } else { UtilityOperations.showMessage("Please enter the required fields"); } Cursor.Current = Cursors.Default; }
public JsonResult CreateNewFolder(String virtualPath, String userName, String folderName) { String physicalPath = UtilityOperations.GetServerMapPath(virtualPath); String decodePath = UtilityOperations.DecodePath(physicalPath, Server); String folderPath = Path.Combine(decodePath, folderName); String retJsonMsg = ""; if (folderPath != "\\") { if (!Directory.Exists(folderPath)) { DocumentsOperations docOps = new DocumentsOperations(); docOps.InsertNewFolder(virtualPath, folderPath, userName, folderName); } else { retJsonMsg += "Folder name already exists. Please enter a different folder name"; } } return(new JsonResult() { Data = retJsonMsg }); }
public void designUIForSBLUI(int column, StringBuilder sb) { //int lleftSpace = 20, lwidth = 100, iwidth = 120, readOnly = 0, maxLength = 16, verticalGap = 30, horizontalGap = 300; string iName = "", displayFormat = ""; for (int i = 0; i < column; i++) { if (counter < idList.Count) { if (!string.IsNullOrEmpty(idList[counter].Id)) { string elementData = string.Empty; string elementDataHtml = string.Empty; if (idList[counter].ControlType.ToString() == "TEXTBOX") { iName = idList[counter].Id; displayFormat = idList[counter].DisplayFormat; if (IsAuto) { iwidth = UtilityOperations.GetInputLength(displayFormat); maxLength = iwidth; iwidth = maxLength * 7; if (iwidth < 20) { iwidth = 20; } if (iwidth > 250) { iwidth = 250; } } if (readOnlyStatus == "true") { readOnly = "readonly=\"0\""; } else { readOnly = string.Empty; } elementData = string.Format("<FIELDSET class=\"field\" style=\"LEFT: {0}px; WIDTH: {1}px; POSITION: absolute; TOP: {2}px; POSITION: absolute\" FNSType=\"field\"><INPUT class=\"fieldinput\" style=\"LEFT:{3}px; WIDTH: {4}px; POSITION: absolute; POSITION: absolute\" tabindex=\"{5}\" {6} maxlength=\"{7}\" name=\"{8}\" FNSType=\"fieldinput\" RXField=\"{9}\" TXField=\"{10}\" DisplayFormat=\"{11}\" Value=\"{12}\"></INPUT>{13}</FIELDSET>", lleftSpace, lwidth, ltopSpace, lwidth + 10, iwidth, tabindex, readOnly, maxLength, iName, idList[counter].Id, idList[counter].Id, displayFormat, idList[counter].Value, idList[counter].Label); } else if (idList[counter].ControlType.ToString() == "COMBOBOX") { iName = idList[counter].Id; displayFormat = idList[counter].DisplayFormat; //ileftSpace = lleftSpace + lwidth + 20; if (readOnlyStatus == "true") { readOnly = "readonly=\"0\""; } else { readOnly = string.Empty; } elementData = string.Format("<FIELDSET class=\"combobox\" style=\"LEFT: {0}px; WIDTH: {1}px; POSITION: absolute; TOP: {2}px; POSITION: absolute\" FNSType=\"combobox\"><SELECT class=\"comboboxselect\" style=\"LEFT:{3}px; WIDTH: {4}px; POSITION: absolute; POSITION: absolute\" tabindex=\"{5}\" readonly=\"{6}\" maxlength=\"{7}\" name=\"{8}\" FNSType=\"comboboxselect\" RXField=\"{9}\" TXField=\"{10}\" DisplayFormat=\"{11}\" SelectionSet=\"default.htm\"><OPTION value=\"\" selected=\"-1\"></OPTION></SELECT>{12}</FIELDSET>", lleftSpace, lwidth, ltopSpace, lwidth + 10, iwidth, tabindex, readOnly, maxLength, iName, idList[counter].Id, idList[counter].Id, displayFormat, idList[counter].Label); } sb.Append(elementData); counter++; tabindex++; } } lleftSpace = lleftSpace + horizontalGap; } ltopSpace = ltopSpace + verticalGap; lleftSpace = leftSpaceMaster; }
public FileModel GetFolderOrFile(String virtualPath) { String physicalPath = UtilityOperations.GetServerMapPath(virtualPath); if (!string.IsNullOrEmpty(physicalPath)) { physicalPath = Decode(physicalPath); } DocumentsOperations docOps = new DocumentsOperations(); FileModel fileModel = null; try { FileAttributes attr = System.IO.File.GetAttributes(physicalPath); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { DirectoryInfo di = new DirectoryInfo(physicalPath); fileModel = new FileModel(di); RMA_Docker.Models.File dbFile = docOps.GetFileByVirtualPath(UtilityOperations.GetVirtualPath(physicalPath)); if (dbFile != null) { fileModel.Description = dbFile.Description; fileModel.NiceNameOrAreaName = dbFile.NiceNameOrAreaName; fileModel.UploadedDT = dbFile.DateTimeUploaded; fileModel.VirtualPath = dbFile.VirtualPath; } } else { FileInfo fi = new FileInfo(physicalPath); fileModel = new FileModel(fi); var dbFile = docOps.GetFileByVirtualPath(UtilityOperations.GetVirtualPath(physicalPath)); if (dbFile != null) { fileModel.Description = dbFile.Description; fileModel.NiceNameOrAreaName = dbFile.NiceNameOrAreaName; fileModel.UploadedDT = dbFile.DateTimeUploaded; fileModel.VirtualPath = dbFile.VirtualPath; var fileOCR = docOps.GetFileBeenOCR(dbFile.ID); if (fileOCR != null) { fileModel.IsOCR = true; fileModel.AllowToOCR = false; fileModel.OcrDocType = fileOCR.DocumentType; } else { fileModel.IsOCR = false; fileModel.AllowToOCR = false; if (docOps.IsFileBeenOCRByFileName(dbFile.Name.Replace(".pdf", "_ocr.pdf"))) { fileModel.AllowToOCR = false; } else { fileModel.AllowToOCR = ((new DCEOperations()).GetFileExtensionsAllowToOCR() .Select(fileExt => fileExt.FileExtension.ToLower())) .Contains(fileModel.Extension.ToLower()); } fileModel.OcrDocType = ""; } } } } catch (Exception) { } fileModel.parentVirtualPath = virtualPath; return(fileModel); }