diff --git a/MP/Controllers/HomeController.cs b/MP/Controllers/HomeController.cs index 1626a8e3..5b47d438 100644 --- a/MP/Controllers/HomeController.cs +++ b/MP/Controllers/HomeController.cs @@ -8,6 +8,9 @@ using System.Web.Mvc; using ZXing.Common; using ZXing; using ZXing.QrCode; +using System.Drawing; +using System.IO; +using System.Drawing.Imaging; namespace MP.Controllers { @@ -181,19 +184,9 @@ namespace MP.Controllers public ActionResult UserListQR() { - QrCodeEncodingOptions options = new QrCodeEncodingOptions - { - DisableECI = true, - CharacterSet = "UTF-8", - Width = 250, - Height = 250, - }; - var writer = new BarcodeWriter(); - writer.Format = BarcodeFormat.QR_CODE; - writer.Options = options; - - ViewBag.Title = "MAPO QR"; + ViewBag.Title = "MP"; ViewBag.Message = "Elenco Utenti"; + ViewBag.BaseUrl = "http://iis02/MP/TAB/jumper"; ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"]; using (var ctx = new MoonProEntities()) { @@ -208,6 +201,33 @@ namespace MP.Controllers } return View(ViewBag.elOperatori); } + /// + /// Restituisce un QR code dato valore + /// + /// + /// + public ActionResult QR(string valore) + { + QrCodeEncodingOptions options = new QrCodeEncodingOptions + { + DisableECI = true, + CharacterSet = "UTF-8", + Width = 600, + Height = 600, + Margin = 0 + }; + var writer = new BarcodeWriter(); + writer.Format = BarcodeFormat.QR_CODE; + writer.Options = options; + // scrivo bitmap + var pixelData = writer.Write(valore); + + //Return Image + MemoryStream ms = new MemoryStream(); + pixelData.Save(ms, ImageFormat.Png); + ms.Position = 0; + return new FileStreamResult(ms, "image/png"); + } /// /// Path locale dove scaricare gli installer diff --git a/MP/Views/Home/UserListQR.cshtml b/MP/Views/Home/UserListQR.cshtml index b9438a39..22faf6b8 100644 --- a/MP/Views/Home/UserListQR.cshtml +++ b/MP/Views/Home/UserListQR.cshtml @@ -11,11 +11,11 @@ @foreach (var item in Model) {
- @item.MatrOpr +

@item.Cognome @item.Nome

+ matr: @item.MatrOpr
- - @item.authKey + Image 12345
} \ No newline at end of file diff --git a/MP/Views/Shared/_Layout.cshtml b/MP/Views/Shared/_Layout.cshtml index c03d5003..0c4503bf 100644 --- a/MP/Views/Shared/_Layout.cshtml +++ b/MP/Views/Shared/_Layout.cshtml @@ -21,6 +21,7 @@