* Makefile: cleans the StyleCop cache

* CalendarController.cs: removes useless spaces

* FrontOfficeApiController.cs: Makes the tex to pdf exceptions
  available to the user interface, as part of the application process.
Cleans the using clauses.

* TexToPdfFormatter.cs: sets the filename as response header.

* Web.csproj: a new FormatterException, thrown when exit code of
  texi2pdf is not null
This commit is contained in:
Paul Schneider 2015-06-07 01:04:09 +02:00
commit 8c4a6b9f19
7 changed files with 49 additions and 40 deletions

View file

@ -26,6 +26,7 @@ using System.IO;
using System.Web;
using System.Diagnostics;
using System.Net.Http;
using Yavsc.Helpers;
namespace Yavsc.Formatters
{
@ -99,7 +100,7 @@ namespace Yavsc.Formatters
p.Start ();
p.WaitForExit ();
if (p.ExitCode != 0)
throw new Exception ("Pdf generation failed with exit code:" + p.ExitCode);
throw new FormatterException ("Pdf generation failed with exit code:" + p.ExitCode);
}
using (StreamReader sr = new StreamReader (fo.FullName)) {
@ -108,7 +109,14 @@ namespace Yavsc.Formatters
}
fi.Delete();
fo.Delete();
if (contentHeaders != null)
SetFileName(contentHeaders, value.GetHashCode ().ToString ());
}
public static void SetFileName(HttpContentHeaders contentHeaders, string basename) {
contentHeaders.ContentDisposition = new ContentDispositionHeaderValue ("attachment") {
FileName = "doc-" + basename + ".pdf"
};
}
}
}