Files
GPW/GPW_Admin/WebUserControls/cmp_userCard.ascx.cs
T
2021-03-29 19:36:26 +02:00

100 lines
2.4 KiB
C#

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
{
/// <summary>
/// Payload da deserializzare json
/// </summary>
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 string logoPath
{
get
{
return memLayer.ML.CRS("imgLogoPath");
}
}
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
}
}