public LinqFileSystemProvider(string bd, IContextService context, HttpServerUtilityBase server) : base(ConfigurationManager.AppSettings["FileManagerNodoRaiz"]) { _ficherosService = FService.Instance.GetService(typeof(FicherosGaleriaModel), context) as FicherosService; _carpetasService = FService.Instance.GetService(typeof(CarpetasModel), context) as CarpetasService; _rutaBase = GetRootFolder(server, context.Empresa, bd); _empresa = context.Empresa; _azureblob = context.Azureblob; }
public FileStreamResult DownloadFiles() { FileStreamResult result; var param = HttpContext.Request.Params["DXMVCFileManagerDownloadArgument"]; var vector = param.Split('|'); var id = vector[2]; var ficherosService = FService.Instance.GetService(typeof(FicherosGaleriaModel), ContextService); var ficheroModel = ficherosService.get(id) as FicherosGaleriaModel; var mappath = Path.Combine(LinqFileSystemProvider.GetRootFolder(Server, ContextService.Empresa, ContextService.BaseDatos), string.Format("{0}{1}", ficheroModel.Id, ficheroModel.Tipo)); if (string.IsNullOrEmpty(ContextService.Azureblob)) { result = new FileStreamResult(new MemoryStream(System.IO.File.ReadAllBytes(mappath)), ficheroModel.Tipo) { FileDownloadName = ficheroModel.Nombre }; } else { FicherosService _ficherosService = new FicherosService(this.ContextService); result = new FileStreamResult (new MemoryStream(_ficherosService.ReadAllBytesAzure(ContextService.Empresa, ContextService.Azureblob, ficheroModel.Id, ficheroModel.Tipo)) , ficheroModel.Tipo) { FileDownloadName = ficheroModel.Nombre }; } return(result); }