public ActionResult ExportAlbumByArtist(TaskModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (!IsAuthorized("ExportAlbumByArtist", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    string templateDirectory = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryTemplate"));
                    string fileDirectory     = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryExport"));
                    string filePath;

                    if (Application.ExportAlbumByArtistXLSX(viewModel.OperationResult, templateDirectory, fileDirectory, out filePath))
                    {
                        byte[] file = System.IO.File.ReadAllBytes(filePath);
                        return(File(file, LibraryHelper.GetContentType(ZFileTypes.ftXLSX), Path.GetFileName(filePath)));
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult ExportSecurity(TaskViewModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (IsTask("ExportSecurity", viewModel.OperationResult))
                {
                    if (IsValid(viewModel.OperationResult, viewModel))
                    {
                        string templateDirectory = Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Template"));
                        string fileDirectory     = Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Export"));
                        string filePath;

                        if (ExportSecurity(viewModel.OperationResult, templateDirectory, fileDirectory, out filePath))
                        {
                            byte[] file = System.IO.File.ReadAllBytes(filePath);

                            return(File(file, LibraryHelper.GetContentType(ZFileTypes.ftXLSX), Path.GetFileName(filePath)));
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(ZView("Task", viewModel));
        }
Exemplo n.º 3
0
        public virtual ActionResult Download(string filePath)
        {
            string     extension = System.IO.Path.GetExtension(filePath);
            ZFileTypes fileType  = LibraryHelper.GetFileType(extension);

            return(File(filePath, LibraryHelper.GetContentType(fileType), Path.GetFileName(filePath)));
        }
Exemplo n.º 4
0
        public ActionResult RDLExport(string exportFormat, string reportDirectory, string reportName)
        {
            OperationResultModel viewModel = new OperationResultModel();

            string exportPath = Path.Combine(Server.MapPath(ConfigurationHelper.AppSettings <string>("EasyLOB.Directory.Export")),
                                             reportName + String.Format(".{0:yyyyMMdd.HHmmss.fff}", DateTime.Now));

            IDictionary <string, string> reportParameters = new Dictionary <string, string>();

            if (System.Web.HttpContext.Current.Request.QueryString.Count > 3)
            {
                for (int q = 3; q < System.Web.HttpContext.Current.Request.QueryString.Count; q++)
                {
                    reportParameters.Add(System.Web.HttpContext.Current.Request.QueryString.AllKeys[q],
                                         System.Web.HttpContext.Current.Request.QueryString[q]);
                }
            }

            if (SyncfusionHelper.ExportRDL(viewModel.OperationResult, ref exportPath, exportFormat,
                                           reportDirectory, reportName, reportParameters))
            {
                byte[] file = System.IO.File.ReadAllBytes(exportPath);
                return(File(file,
                            LibraryHelper.GetContentType(LibraryHelper.GetFileType(Path.GetExtension(exportPath))),
                            Path.GetFileName(exportPath)));
            }

            return(ZViewOperationResult(viewModel.OperationResult));
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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));
        }