Example #1
0
        public ActionResult Read(string entityName, int id, string acronym)
        {
            ZFileTypes fileType = LibraryHelper.GetFileType(acronym);

            byte[] file      = EDMManager.ReadFile(entityName, id, fileType);
            string extension = LibraryHelper.GetFileExtension(fileType);

            return(File(file, LibraryHelper.GetContentType(fileType), entityName + "-" + id.ToString().Trim() + extension));
        }
Example #2
0
        public ActionResult Read(string entityName, int id, string acronym)
        {
            IEdmManager edmManager = DependencyResolver.Current.GetService <IEdmManager>();
            ZFileTypes  fileType   = LibraryHelper.GetFileType(acronym);

            byte[] file      = edmManager.ReadFile(entityName, id, fileType);
            string extension = LibraryHelper.GetFileExtension(fileType);

            return(File(file, LibraryHelper.GetContentType(fileType), entityName + "-" + id.ToString().Trim() + extension));
        }
Example #3
0
        public string GetFilePath(string entityName, int key, ZFileTypes fileType, bool create)
        {
            string filePath         = "";
            string extension        = LibraryHelper.GetFileExtension(fileType);
            string workingDirectory = "";

            try
            {
                workingDirectory = ftpClient.GetWorkingDirectory();

                entityName = (entityName == null) ? "" : entityName;
                string entityKey     = String.Format("{0:000000000}", (key / 100) * 100);
                string directoryPath = LibraryHelper.AddDirectorySeparator(RootDirectory) +
                                       ((entityName == "") ? entityName : entityName + "/") +
                                       entityKey;

                FTPCreateDirectoryPath(directoryPath);

                /*
                 * ftpClient.SetWorkingDirectory("/");
                 * if (!FTPDirectoryExists(path) && create) // /root/entityName/entityTree
                 * {
                 *  if (FTPCreateDirectory(RootDirectory))
                 *  {
                 *      ftpClient.SetWorkingDirectory(RootDirectory);
                 *      if (FTPCreateDirectory(entityName))
                 *      {
                 *          ftpClient.SetWorkingDirectory(entityName);
                 *          FTPCreateDirectory(entityTree);
                 *      }
                 *  }
                 * }
                 */

                ftpClient.SetWorkingDirectory("/");
                if (FTPDirectoryExists(directoryPath))
                {
                    filePath = directoryPath + "/" + String.Format("{0:000000000}", key) + extension;
                }
            }
            finally
            {
                if (!String.IsNullOrEmpty(workingDirectory))
                {
                    ftpClient.SetWorkingDirectory(workingDirectory);
                }
            }

            return(filePath);
        }
        public string GetFilePath(string entityName, int key, ZFileTypes fileType, bool create)
        {
            string filePath  = "";
            string extension = LibraryHelper.GetFileExtension(fileType);

            entityName = (entityName == null) ? "" : entityName;
            string entityKey     = String.Format("{0:000000000}", (key / 100) * 100);
            string directoryPath = LibraryHelper.AddDirectorySeparator(RootDirectory) +
                                   ((entityName == "") ? entityName : entityName + "/") +
                                   entityKey;

            if (!Directory.Exists(directoryPath) && create)
            {
                Directory.CreateDirectory(directoryPath);
            }

            if (Directory.Exists(directoryPath))
            {
                filePath = directoryPath + "/" + String.Format("{0:000000000}", key) + extension;
            }

            return(filePath);
        }