Пример #1
0
 public async Task <IActionResult> Excel_LiquidacionesDetalle([FromQuery] int idEmpresa, int idUsuario, int idLegajo, string periodo, int idSeccion)
 {
     try
     {
         Servcios srv            = new Servcios();
         byte[]   mybytearray    = srv.Excel_LiquidacionesDetalle(idEmpresa, idUsuario, idLegajo, periodo, idSeccion);
         string   mimeType       = "application/octet-stream";
         string   FileOutPutName = "asd";
         return(new FileContentResult(mybytearray, mimeType)
         {
             FileDownloadName = FileOutPutName
         });
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #2
0
 public async Task <IActionResult> DownloadDocVacacionesPdf([FromQuery] long idEmpresa, long idDocumento)
 {
     try
     {
         byte[]   mybytearray = null;
         Servcios srv         = new Servcios();
         String   strHTML     = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ClientKeyString");
         mybytearray = srv.PDF_vacDocumento(strHTML, idEmpresa, idDocumento);
         string mimeType       = "application/octet-stream";
         string FileOutPutName = "asd";
         return(new FileContentResult(mybytearray, mimeType)
         {
             FileDownloadName = FileOutPutName
         });
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #3
0
        public async Task <IActionResult> descargaArchivo([FromBody] dynamic paramsBody)
        {
            Servcios srv = new Servcios();

            try
            {
                byte[] mybytearray = null;

                //srv.setLog("TestPrint");
                string stringHtml = paramsBody.html;

                // BORRAR DESPUES DE PROBAR TODO
                //string e = "";
                //try
                //{
                //    e = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"ClientApp/dist/assets/documents/docVacaciones.html");
                //}
                //catch (Exception)
                //{
                //    e = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ClientApp\src\assets\documents\docVacaciones.html");
                //}
                long idEmpresa   = Convert.ToInt64(paramsBody.idEmpresa);
                long idDocuemnto = Convert.ToInt64(paramsBody.idDocumento);
                mybytearray = srv.PDF_vacDocumento(stringHtml, idEmpresa, idDocuemnto);
                string mimeType       = "application/octet-stream";
                string FileOutPutName = "asd";
                try
                {
                    return(new FileContentResult(mybytearray, mimeType)
                    {
                        FileDownloadName = FileOutPutName
                    });
                }
                catch (Exception exx)
                {
                    Console.WriteLine(exx.Message);
                    throw;
                }



                //using (var httpClient = new HttpClient())
                //{
                //	using (var response = await httpClient.GetAsync(filtro.Replace("\"", string.Empty)))
                //	{


                //		string result = null;
                //		result = response.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);


                //                    byte[] mybytearray = Convert.FromBase64String(result);
                //                    string mimeType = "application/octet-stream";
                //		string FileOutPutName = "asd";
                //		return new FileContentResult(mybytearray, mimeType)
                //		{
                //			FileDownloadName = FileOutPutName
                //		};

                //	}
                //}
            }
            catch (Exception ex)
            {
                srv.setLog(ex.Message);
                return(BadRequest(ex.Message));
            }
        }