OK User list con QR code...

This commit is contained in:
Samuele E. Locatelli
2018-05-29 11:15:46 +02:00
parent 46b5676df6
commit 43d4db2f68
4 changed files with 38 additions and 16 deletions
+32 -12
View File
@@ -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);
}
/// <summary>
/// Restituisce un QR code dato valore
/// </summary>
/// <param name="valore"></param>
/// <returns></returns>
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");
}
/// <summary>
/// Path locale dove scaricare gli installer
+3 -3
View File
@@ -11,11 +11,11 @@
@foreach (var item in Model)
{
<div class="col-xs-4">
@item.MatrOpr
<h2><b>@item.Cognome</b> @item.Nome</h2>
matr: @item.MatrOpr
</div>
<div class="col-xs-8">
@item.authKey
<img src="@Url.Action("QR", new { valore = @ViewBag.BaseUrl + "?MatrOpr=" + @item.MatrOpr + "&authKey=" + item.authKey })" alt="Image 12345" style="width: 100px;" />
</div>
}
</div>
+1 -1
View File
@@ -21,6 +21,7 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
@*<li>@Html.ActionLink("Home", "Index", "Home")</li>*@
<li>@Html.ActionLink("User List", "UserListQR", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
<li>@Html.ActionLink("Package Versions", "Packages", "Home")</li>
@@ -40,7 +41,6 @@
{
cssFixFooter = "navbar-fixed-bottom";
}
<footer class="navbar navbar-inverse @cssFixFooter text-gray">
<div class="row">
<div class="col-xs-6 fontSmall text-left">
+2
View File
@@ -82,6 +82,8 @@
<add key="chkIdxOdlEndProd" value="false" />
<add key="AutoCleanUpInterval" value="10" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
<!--stringhe connessione SQL2016-->
<add key="DbConfConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
</appSettings>
<connectionStrings>
<!-- usare red://*/ se non andasse x caricare assembly e metadati -->