From 9585eb3386abd240625d6fc51ec138f32791dbd5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 29 Mar 2021 19:04:19 +0200 Subject: [PATCH] Fix gestione QRCode link --- GPW_Admin/GPW_Admin.csproj | 8 ++ GPW_Admin/WebUserControls/cmp_userCard.ascx | 43 +++++++++ .../WebUserControls/cmp_userCard.ascx.cs | 92 +++++++++++++++++++ .../cmp_userCard.ascx.designer.cs | 53 +++++++++++ .../mod_adminDipendenti.ascx.cs | 12 +++ GPW_Admin/dipendenti.aspx | 16 +++- GPW_Admin/dipendenti.aspx.cs | 37 ++++++++ GPW_Admin/dipendenti.aspx.designer.cs | 49 +++++++--- 8 files changed, 298 insertions(+), 12 deletions(-) create mode 100644 GPW_Admin/WebUserControls/cmp_userCard.ascx create mode 100644 GPW_Admin/WebUserControls/cmp_userCard.ascx.cs create mode 100644 GPW_Admin/WebUserControls/cmp_userCard.ascx.designer.cs diff --git a/GPW_Admin/GPW_Admin.csproj b/GPW_Admin/GPW_Admin.csproj index ed1d6cc..de79093 100644 --- a/GPW_Admin/GPW_Admin.csproj +++ b/GPW_Admin/GPW_Admin.csproj @@ -539,6 +539,7 @@ + @@ -949,6 +950,13 @@ cmp_toggle.ascx + + cmp_userCard.ascx + ASPXCodeBehind + + + cmp_userCard.ascx + cmp_vocabolario.ascx ASPXCodeBehind diff --git a/GPW_Admin/WebUserControls/cmp_userCard.ascx b/GPW_Admin/WebUserControls/cmp_userCard.ascx new file mode 100644 index 0000000..c897828 --- /dev/null +++ b/GPW_Admin/WebUserControls/cmp_userCard.ascx @@ -0,0 +1,43 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_userCard.ascx.cs" Inherits="GPW_Admin.WebUserControls.cmp_userCard" %> + +
+ + + +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ <%# Eval("Cognome") %> + <%# Eval("Nome") %> +
+
+ SMART Access Link +
+
+
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/GPW_Admin/WebUserControls/cmp_userCard.ascx.cs b/GPW_Admin/WebUserControls/cmp_userCard.ascx.cs new file mode 100644 index 0000000..c403d87 --- /dev/null +++ b/GPW_Admin/WebUserControls/cmp_userCard.ascx.cs @@ -0,0 +1,92 @@ +using Newtonsoft.Json; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace GPW_Admin.WebUserControls +{ + /// + /// Payload da deserializzare json + /// + public struct qrPayload + { + #region Public Properties + + public string baseUrl { get; set; } + public string[] parameters { get; set; } + + #endregion Public Properties + } + + public partial class cmp_userCard : System.Web.UI.UserControl + { + #region Public Properties + + public bool showAll + { + get + { + bool answ = false; + bool.TryParse(hfShowAll.Value, out answ); + return answ; + } + set + { + hfShowAll.Value = $"{value}"; + repUserCards.DataBind(); + } + } + + public bool showExt + { + get + { + bool answ = false; + bool.TryParse(hfShowExt.Value, out answ); + return answ; + } + set + { + hfShowExt.Value = $"{value}"; + repUserCards.DataBind(); + } + } + + #endregion Public Properties + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + } + + #endregion Protected Methods + + #region Public Methods + + public string getImgUrl(object idxDip, object UserAuthkey) + { + string urlName = showExt ? "smartBaseUrlExt" : "smartBaseUrlInt"; + string[] valori = new string[2]; + valori[0] = $"{idxDip}"; + valori[1] = $"{UserAuthkey}"; + + string baseUrl = $"{memLayer.ML.CRS("UrlQRCodeGen")}/HOME/QR_site/JSON?val="; + qrPayload currPayload = new qrPayload() + { + // NB: & --> %26 + baseUrl = memLayer.ML.CRS(urlName) + "jumper?idxDipendente={0}%26UserAuthkey={1}", + parameters = valori + }; + string payload = JsonConvert.SerializeObject(currPayload); + string answ = $"{baseUrl}{payload}"; + return answ; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/GPW_Admin/WebUserControls/cmp_userCard.ascx.designer.cs b/GPW_Admin/WebUserControls/cmp_userCard.ascx.designer.cs new file mode 100644 index 0000000..271ff02 --- /dev/null +++ b/GPW_Admin/WebUserControls/cmp_userCard.ascx.designer.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GPW_Admin.WebUserControls +{ + + + public partial class cmp_userCard + { + + /// + /// hfShowExt control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfShowExt; + + /// + /// repUserCards control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater repUserCards; + + /// + /// ods control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource ods; + + /// + /// hfShowAll control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfShowAll; + } +} diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs index d0de240..bdeae3f 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs @@ -33,6 +33,14 @@ namespace GPW_Admin.WebUserControls } } + public bool showAll + { + get + { + return chkshowAll.Checked; + } + } + #endregion Public Properties #region Protected Methods @@ -71,6 +79,10 @@ namespace GPW_Admin.WebUserControls protected void chkshowAll_CheckedChanged(object sender, EventArgs e) { grView.DataBind(); + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } } /// diff --git a/GPW_Admin/dipendenti.aspx b/GPW_Admin/dipendenti.aspx index a53f3ca..2ecfcaf 100644 --- a/GPW_Admin/dipendenti.aspx +++ b/GPW_Admin/dipendenti.aspx @@ -2,13 +2,27 @@ <%@ Register Src="~/WebUserControls/mod_adminDipendenti.ascx" TagName="mod_adminDipendenti" TagPrefix="uc1" %> <%@ Register Src="~/WebUserControls/mod_pageSize.ascx" TagPrefix="uc1" TagName="mod_pageSize" %> +<%@ Register Src="~/WebUserControls/cmp_userCard.ascx" TagPrefix="uc1" TagName="cmp_userCard" %> +<%@ Register Src="~/WebUserControls/cmp_toggle.ascx" TagPrefix="uc1" TagName="cmp_toggle" %> +
- <%: traduci(titolo) %> +
+
+ <%: traduci(titolo) %> +
+
+ + +   + +
+
+